]> granicus.if.org Git - fcron/commitdiff
clearer error messages in gen-in.pl
authorThibault Godouet <fcron@free.fr>
Wed, 5 Dec 2012 21:18:43 +0000 (21:18 +0000)
committerThibault Godouet <fcron@free.fr>
Wed, 5 Dec 2012 21:18:43 +0000 (21:18 +0000)
script/gen-in.pl

index fa2e8d7008da4590bb16ddfa6596e96383bfa5dc..5bc4de92fbabea10843d971dd968316ff9319aa6 100755 (executable)
@@ -16,7 +16,7 @@
 
 
 
-open(CONFIG, "$ARGV[2]/config.h") or print "error while opening config.h\n" and exit;
+open(CONFIG, "$ARGV[2]/config.h") or print "error while opening config.h: $!\n" and exit;
 while ( <CONFIG> ) {
     if ( /^\#define\s+(\w+?)\s+([\w\/-]+?)\s/ ) {
        $map{$1} = $2;
@@ -28,7 +28,7 @@ while ( <CONFIG> ) {
 }
 close(CONFIG);
 
-open(MAKEFILE, "$ARGV[2]/Makefile") or print "error while opening Makefile\n" and exit;
+open(MAKEFILE, "$ARGV[2]/Makefile") or print "error while opening Makefile: $!\n" and exit;
 while ( <MAKEFILE> ) {
     if ( /^\s*?(\w+?)\s*?=\s*?([^\s]+)\s/ ) {
        $name = $1;
@@ -47,8 +47,8 @@ close(MAKEFILE);
 
 chop ($map{Date} = `date +%m/%d/%Y`);
 
-open(SRC, $ARGV[0]) or print "error while opening $ARGV[0]\n" and exit;
-open(DEST, ">$ARGV[1]") or print "error while opening $ARGV[1]\n" and exit;
+open(SRC, $ARGV[0]) or print "error while opening $ARGV[0]: $!\n" and exit;
+open(DEST, ">$ARGV[1]") or print "error while opening $ARGV[1]: $!\n" and exit;
 
 while ( <SRC> ) {
     s/@@([^@]*)@/$map{$1}/g;