]> git.ipfire.org Git - thirdparty/rsync.git/blobdiff - daemon-parm.awk
More tweaks for Actions.
[thirdparty/rsync.git] / daemon-parm.awk
index 8fc4c237c438782861b5130c17ad4665dbe45785..ad52e9d9682603a135e75bca62527993a55735fb 100755 (executable)
@@ -4,10 +4,9 @@
 # The resulting code is output into daemon-parm.h
 
 BEGIN {
-    heading = "/* DO NOT EDIT THIS FILE!  It is auto-generated from a list of values in " ARGV[1] "! */"
+    heading = "/* DO NOT EDIT THIS FILE!  It is auto-generated from a list of values in " ARGV[1] "! */\n\n"
     sect = psect = defines = accessors = prior_ptype = ""
-    values = "\nstatic const all_vars Defaults = {\n    { /* Globals: */\n"
-    params = "\nstatic struct parm_struct parm_table[] = {"
+    parms = "\nstatic struct parm_struct parm_table[] = {"
     comment_fmt = "\n/********** %s **********/\n"
     tdstruct = "typedef struct {"
 }
@@ -22,6 +21,7 @@ BEGIN {
        exit
     }
     defines = tdstruct
+    values = "\nstatic const all_vars Defaults = {\n    { /* Globals: */\n"
     exps = exp_values = sprintf(comment_fmt, "EXP")
     sect = "GLOBAL"
     psect = ", P_GLOBAL, &Vars.g."
@@ -41,7 +41,7 @@ BEGIN {
     next
 }
 
-/^(STRING|CHAR|PATH|INTEGER|ENUM|OCTAL|BOOL|BOOLREV)[ \t]/ {
+/^(STRING|CHAR|PATH|INTEGER|ENUM|OCTAL|BOOL|BOOLREV|BOOL3)[ \t]/ {
     ptype = $1
     name = $2
     $1 = $2 = ""
@@ -51,7 +51,7 @@ BEGIN {
        comment = sprintf(comment_fmt, ptype)
        defines = defines comment
        values = values comment
-       params = params "\n"
+       parms = parms "\n"
        accessors = accessors "\n"
        prior_ptype = ptype
     }
@@ -59,7 +59,7 @@ BEGIN {
     if (ptype == "STRING" || ptype == "PATH") {
        atype = "STRING"
        vtype = "char*"
-    } else if (ptype == "BOOL" || ptype == "BOOLREV") {
+    } else if (ptype ~ /BOOL/) {
        atype = vtype = "BOOL"
     } else if (ptype == "CHAR") {
        atype = "CHAR"
@@ -69,16 +69,12 @@ BEGIN {
        vtype = "int"
     }
 
-    # We have 2 variables that don't match their conf string. Oh well...
-    if (name == "bind_address")
-       spname = "address"
-    else if (name == "rsync_port")
-       spname = "port"
-    else {
-       spname = name
-       gsub(/_/, " ", spname)
-       gsub(/-/, "", name)
-    }
+    # The name might be var_name|public_name
+    pubname = name
+    sub(/\|.*/, "", name)
+    sub(/.*\|/, "", pubname)
+    gsub(/_/, " ", pubname)
+    gsub(/-/, "", name)
 
     if (ptype == "ENUM")
        enum = "enum_" name
@@ -87,7 +83,7 @@ BEGIN {
 
     defines = defines "\t" vtype " " name ";\n"
     values = values "\t" $0 ", /* " name " */\n"
-    params = params " {\"" spname "\", P_" ptype psect name ", " enum ", 0},\n"
+    parms = parms " {\"" pubname "\", P_" ptype psect name ", " enum ", 0},\n"
     accessors = accessors "FN_" sect "_" atype "(lp_" name ", " name ")\n"
 
     if (vtype == "char*") {
@@ -109,8 +105,8 @@ END {
        defines = defines exps "} local_vars;\n\n"
        defines = defines tdstruct "\n\tglobal_vars g;\n\tlocal_vars l;\n} all_vars;\n"
        values = values exp_values "\n    }\n};\n\nstatic all_vars Vars;\n"
-       params = params "\n {NULL, P_BOOL, P_NONE, NULL, NULL, 0}\n};\n"
-       print heading "\n\n" defines values params accessors > "daemon-parm.h"
+       parms = parms "\n {NULL, P_BOOL, P_NONE, NULL, NULL, 0}\n};\n"
+       print heading defines values parms accessors > "daemon-parm.h"
     } else {
        print "Failed to parse the data in " ARGV[1]
        exit 1