who: avoid locking standard output for each user with the -q option

* src/who (list_entries_who): Prefer putchar and fputs to printf.
Simplify separator tracking.
This commit is contained in:
Collin Funk committed 2026-03-28 12:45:14 -07:00
1 parent c8b296683f
commit eec7b2a131
1 file changed
+3 -3
+3 -3
View File
@@ -525,7 +525,6 @@ static void
list_entries_who (idx_t n, STRUCT_UTMP const *utmp_buf)
{
idx_t entries = 0;
char const *separator = "";
while (n--)
{
@@ -535,9 +534,10 @@ list_entries_who (idx_t n, STRUCT_UTMP const *utmp_buf)
trimmed_name = extract_trimmed_name (utmp_buf);
printf ("%s%s", separator, trimmed_name);
if (entries)
putchar (' ');
fputs (trimmed_name, stdout);
free (trimmed_name);
separator = " ";
entries++;
}
utmp_buf++;