]> git.ipfire.org Git - thirdparty/rsync.git/commitdiff
Also change dashes in the dict var names to make jq use easier.
authorWayne Davison <wayne@opencoder.net>
Sun, 11 Sep 2022 00:30:54 +0000 (17:30 -0700)
committerWayne Davison <wayne@opencoder.net>
Sun, 11 Sep 2022 00:30:54 +0000 (17:30 -0700)
support/json-rsync-version
usage.c

index 6f083baea04a037ff01e391662603c6be2a5092d..afaf7382d5369491081cf61a27e4f15c4b9d8805 100755 (executable)
@@ -35,11 +35,12 @@ def main():
                 for x in line.strip(' ,').split(', '):
                     if ' ' in x:
                         val, var = x.split(' ', 1)
-                        var = var.replace(' ', '_')
                         if var == 'protect-args':
                             var = 'secluded-args'
+                        var = var.replace(' ', '_').replace('-', '_')
                         info[sect_name][var] = False if val == 'no' else val
                     else:
+                        x = x.replace('-', '_')
                         info[sect_name][x] = True
             else:
                 info[sect_name] += [ x for x in line.split() if not x.startswith('(') ]
diff --git a/usage.c b/usage.c
index 84a94b82ab431b38a2989677acde7620fe6a490c..a2c2a3f03e7b4e4954dcb325f48f94694faf6338 100644 (file)
--- a/usage.c
+++ b/usage.c
@@ -179,7 +179,7 @@ static void print_info_flags(enum logcode f)
                        item_len = snprintf(item_buf, sizeof item_buf,
                                           " \"%s\": %s%.*s%s%s", item, quot, val_len, val, quot,
                                           need_comma ? "," : "");
-                       for (space = item; (space = strchr(space, ' ')) != NULL; space++)
+                       for (space = item; (space = strpbrk(space, " -")) != NULL; space++)
                                item_buf[space - item + 2] = '_';
                } else
                        item_len = snprintf(item_buf, sizeof item_buf, " %s%s", str, need_comma ? "," : "");