| 216 | } |
| 217 | |
| 218 | static void output_nno_list(enum logcode f, const char *name, struct name_num_obj *nno) |
| 219 | { |
| 220 | char namebuf[64], tmpbuf[256]; |
| 221 | char *tok, *next_tok, *comma = ","; |
| 222 | char *cp; |
| 223 | |
| 224 | /* Using '(' ensures that we get a trailing "none" but also includes aliases. */ |
| 225 | get_default_nno_list(nno, tmpbuf, sizeof tmpbuf - 1, '('); |
| 226 | if (f != FNONE) { |
| 227 | rprintf(f, "%s:\n", name); |
| 228 | rprintf(f, " %s\n", tmpbuf); |
| 229 | return; |
| 230 | } |
| 231 | |
| 232 | strlcpy(namebuf, name, sizeof namebuf); |
| 233 | for (cp = namebuf; *cp; cp++) { |
| 234 | if (*cp == ' ') |
| 235 | *cp = '_'; |
| 236 | else if (isUpper(cp)) |
| 237 | *cp = toLower(cp); |
| 238 | } |
| 239 | |
| 240 | printf(",\n \"%s\": [\n ", namebuf); |
| 241 | |
| 242 | for (tok = strtok(tmpbuf, " "); tok; tok = next_tok) { |
| 243 | next_tok = strtok(NULL, " "); |
| 244 | if (*tok != '(') /* Ignore the alises in the JSON output */ |
| 245 | printf(" \"%s\"%s", tok, comma + (next_tok ? 0 : 1)); |
| 246 | } |
| 247 | |
| 248 | printf("\n ]"); |
| 249 | } |
| 250 | |
| 251 | /* A request of f == FNONE wants json on stdout. */ |
| 252 | void print_rsync_version(enum logcode f) |
no test coverage detected