Commit d506dd76 d506dd765e214dd7b29f58cf89fa6065efb2458a by Sergey Poznyakoff

Report error if no output lines were produced.

1 parent 6ce5f7f6
1 # generr.awk -- Create error reporting sources for GNU Mailutils 1 # generr.awk -- Create error reporting sources for GNU Mailutils
2 # Copyright (C) 2005 Free Software Foundation, Inc. 2 # Copyright (C) 2005, 2006 Free Software Foundation, Inc.
3 # 3 #
4 # GNU Mailutils is free software; you can redistribute it and/or 4 # GNU Mailutils is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License as 5 # modify it under the terms of the GNU General Public License as
...@@ -38,7 +38,8 @@ ARGIND == 1 { ...@@ -38,7 +38,8 @@ ARGIND == 1 {
38 38
39 ARGIND == 2 && /\$AUTOWARN/ { 39 ARGIND == 2 && /\$AUTOWARN/ {
40 match($0,"\\$AUTOWARN"); 40 match($0,"\\$AUTOWARN");
41 print substr($0,1,RSTART-1) "This file is generated automatically. Please, do not edit." substr($0,RSTART+RLENGTH) 41 rest = (RSTART+RLENGTH < length($0)) ? substr($0,RSTART+RLENGTH) : "";
42 print substr($0,1,RSTART-1) "This file is generated automatically. Please, do not edit." rest
42 next 43 next
43 } 44 }
44 45
...@@ -48,6 +49,7 @@ ARGIND == 2 && $1 == "$MESSAGE_STRINGS" { ...@@ -48,6 +49,7 @@ ARGIND == 2 && $1 == "$MESSAGE_STRINGS" {
48 printf "%*.*scase %s:\n", RLENGTH, RLENGTH, "", def[i] 49 printf "%*.*scase %s:\n", RLENGTH, RLENGTH, "", def[i]
49 printf "%*.*sreturn %s;\n\n", RLENGTH+2,RLENGTH+2,"", text[i] 50 printf "%*.*sreturn %s;\n\n", RLENGTH+2,RLENGTH+2,"", text[i]
50 } 51 }
52 total += defno;
51 next 53 next
52 } 54 }
53 55
...@@ -57,6 +59,7 @@ ARGIND == 2 && $1 == "$MESSAGE_CODES" { ...@@ -57,6 +59,7 @@ ARGIND == 2 && $1 == "$MESSAGE_CODES" {
57 printf "%*.*scase %s:\n", RLENGTH, RLENGTH, "", def[i] 59 printf "%*.*scase %s:\n", RLENGTH, RLENGTH, "", def[i]
58 printf "%*.*sreturn \"%s\";\n\n", RLENGTH+2,RLENGTH+2,"", def[i] 60 printf "%*.*sreturn \"%s\";\n\n", RLENGTH+2,RLENGTH+2,"", def[i]
59 } 61 }
62 total += defno;
60 next 63 next
61 } 64 }
62 65
...@@ -64,6 +67,7 @@ ARGIND == 2 && $1 == "$MESSAGE_DEFS" { ...@@ -64,6 +67,7 @@ ARGIND == 2 && $1 == "$MESSAGE_DEFS" {
64 for (i = 0; i < defno; i++) { 67 for (i = 0; i < defno; i++) {
65 print "#define " def[i] " (MU_ERR_BASE+" i ")" 68 print "#define " def[i] " (MU_ERR_BASE+" i ")"
66 } 69 }
70 total += defno;
67 next 71 next
68 } 72 }
69 73
...@@ -71,4 +75,10 @@ ARGIND == 2 { ...@@ -71,4 +75,10 @@ ARGIND == 2 {
71 print 75 print
72 } 76 }
73 77
78 END {
79 if (total == 0) {
80 print "Output file is empty" > "/dev/stderr"
81 exit 1
82 }
83 }
74 # End of generr.awk 84 # End of generr.awk
......