MCPcopy Create free account
hub / github.com/coreutils/coreutils / print_stuff

Function print_stuff

src/id.c:430–463  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

428/* Print information about the user based on the arguments passed. */
429
430static void
431print_stuff (char const *pw_name)
432{
433 if (just_user)
434 print_user (use_real ? ruid : euid);
435
436 /* print_group and print_group_list return true on successful
437 execution but false if something goes wrong. We then AND this value with
438 the current value of 'ok' because we want to know if one of the previous
439 users faced a problem in these functions. This value of 'ok' is later used
440 to understand what status program should exit with. */
441 else if (just_group)
442 ok &= print_group (use_real ? rgid : egid, use_name);
443 else if (just_group_list)
444 ok &= print_group_list (pw_name, ruid, rgid, egid,
445 use_name, opt_zero ? '\0' : ' ');
446 else if (just_context)
447 fputs (context, stdout);
448 else
449 print_full_info (pw_name);
450
451 /* When printing records for more than 1 user, at the end of groups
452 of each user terminate the record with two consequent NUL characters
453 to make parsing and distinguishing between two records possible. */
454 if (opt_zero && just_group_list && multiple_users)
455 {
456 putchar ('\0');
457 putchar ('\0');
458 }
459 else
460 {
461 putchar (opt_zero ? '\0' : '\n');
462 }
463}

Callers 1

mainFunction · 0.85

Calls 4

print_groupFunction · 0.85
print_group_listFunction · 0.85
print_full_infoFunction · 0.85
print_userFunction · 0.70

Tested by

no test coverage detected