From 48c1cc8c89a9329f384b35a677e669c3a8e47704 Mon Sep 17 00:00:00 2001
From: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Date: Tue, 5 Jan 2010 17:57:11 +0100
Subject: [PATCH] better error reporting

---
 doc/fixnavi.pl | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/doc/fixnavi.pl b/doc/fixnavi.pl
index b492ae41425..093cf08a84a 100755
--- a/doc/fixnavi.pl
+++ b/doc/fixnavi.pl
@@ -2,8 +2,9 @@
 
 use strict;
 
+@ARGV == 1 or die "usage: $0 <qdoc-file>\n";
 my $file = $ARGV[0];
-open FILE, $file or die "File $file cannot be opened.";
+open FILE, $file or die "File $file cannot be opened.\n";
 my @toc = ();
 my %title2page = ();
 my $doctitle = "";
@@ -17,7 +18,7 @@ while (<FILE>) {
             $curpage = $1;
         } elsif (/^\h*\\title\h+(.+)$/) {
             if ($curpage eq "") {
-                die "Title '$1' appears in no \\page\n";
+                die "Title '$1' appears in no \\page.\n";
             }
             $title2page{$1} = $curpage;
             $doctitle = $1 if (!$doctitle);
@@ -42,8 +43,8 @@ for my $title (@toc) {
     $last = $title;
 }
 
-open IN, $file or die "File $file cannot be opened a second time?!";
-open OUT, '>'.$file.".out" or die "File $file.out cannot be created.";
+open IN, $file or die "File $file cannot be opened a second time?!\n";
+open OUT, '>'.$file.".out" or die "File $file.out cannot be created.\n";
 my $cutting = 0;
 while (<IN>) {
     if (!$cutting) {
@@ -66,4 +67,4 @@ while (<IN>) {
 close OUT;
 close IN;
 
-rename($file.".out", $file) or die "Cannot replace $file with new version.";
+rename($file.".out", $file) or die "Cannot replace $file with new version.\n";
-- 
GitLab