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

Function print_long_entry

src/pinky.c:344–392  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

342/* Display a verbose line of information about UTMP_ENT. */
343
344static void
345print_long_entry (const char name[])
346{
347 struct passwd *pw = getpwnam (name);
348
349 printf (_("Login name: "));
350 printf ("%-28s", name);
351
352 printf (_("In real life: "));
353 if (pw == NULL)
354 {
355 /* TRANSLATORS: Real name is unknown; no hard limit. */
356 printf (" %s", _("???\n"));
357 return;
358 }
359 else
360 {
361 char *const comma = strchr (pw->pw_gecos, ',');
362
363 if (comma)
364 *comma = '\0';
365
366 char *result = create_fullname (pw->pw_gecos, pw->pw_name);
367 printf (" %s", result);
368 free (result);
369 }
370
371 putchar ('\n');
372
373 if (include_home_and_shell)
374 {
375 printf (_("Directory: "));
376 printf ("%-29s", pw->pw_dir);
377 printf (_("Shell: "));
378 printf (" %s", pw->pw_shell);
379 putchar ('\n');
380 }
381
382 if (include_project)
383 cat_file (_("Project: "), pw->pw_dir, ".project");
384
385 if (include_plan)
386 cat_file (_("Plan:\n"), pw->pw_dir, ".plan");
387
388 putchar ('\n');
389
390 if (ferror (stdout))
391 write_error ();
392}
393
394/* Print the username of each valid entry and the number of valid entries
395 in UTMP_BUF, which should have N elements. */

Callers 1

long_pinkyFunction · 0.85

Calls 3

create_fullnameFunction · 0.85
cat_fileFunction · 0.85
write_errorFunction · 0.85

Tested by

no test coverage detected