MCPcopy Index your code
hub / github.com/RsyncProject/rsync / output_nno_list

Function output_nno_list

usage.c:218–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

216}
217
218static 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. */
252void print_rsync_version(enum logcode f)

Callers 1

print_rsync_versionFunction · 0.85

Calls 5

get_default_nno_listFunction · 0.85
strlcpyFunction · 0.85
isUpperFunction · 0.85
toLowerFunction · 0.85
rprintfFunction · 0.70

Tested by

no test coverage detected