]> git.draconx.ca Git - dxcommon.git/blobdiff - scripts/gen-options.awk
Import getline helper from cdecl99.
[dxcommon.git] / scripts / gen-options.awk
index f2cdfe7825ab6f600334a7bb76fbe32408b6f1a4..450f85c3713f5aeeea09d93f89aa7acedb10ace7 100755 (executable)
@@ -181,7 +181,7 @@ $0 ~ /^-/ {
     # packed form is not possible w/ actions
     has_actions = 1;
 
-    n = split(work, a, /,[ \t]*/)
+    n = split(work, a, ",[ \t]*")
     if (n == 2) {
       flag = substr(a[1], 2) ", " substr(a[2], 1, length(a[2])-1)
     } else if (n == 1) {
@@ -213,11 +213,10 @@ $0 ~ /^-/ {
 }
 
 # Ignore any line beginning with a #
-$0 ~ /^#/ { next }
+$0 ~ /^#/ { next; }
 
-lopt {
-  sub(/^[ \t]*/, "")
-  if (!$0) { next }
+NF && lopt != "" {
+  sub(/^[ \t]*/, "");
 
   if (lopt in optionhelp)
     $0 = "\n" $0;