[hackers] [ubase][PATCH] uptime: Fix user/s printing (grammar error) when users == 0.

From: parazyd <parazyd_AT_dyne.org>
Date: Fri, 28 Dec 2018 07:49:54 -0500

Signed-off-by: parazyd <parazyd_AT_dyne.org>
---
 uptime.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/uptime.c b/uptime.c
index e0dd6fa..3979964 100644
--- a/uptime.c
+++ b/uptime.c
_AT_@ -44,7 +44,7 @@ main(int argc, char *argv[])
 	hours = info.uptime % 24;
 	days = info.uptime / 24;
 	if (days)
-		printf("%d day%s, ", days, days > 1 ? "s" : "");
+		printf("%d day%s, ", days, days != 1 ? "s" : "");
 	if (hours)
 		printf("%2d:%02d, ", hours, minutes);
 	else
_AT_@ -61,7 +61,7 @@ main(int argc, char *argv[])
 		if (ferror(ufp))
 			eprintf("%s: read error:", UTMP_PATH);
 		fclose(ufp);
-		printf(" %d user%s, ", nusers, nusers > 1 ? "s" : "");
+		printf(" %d user%s, ", nusers, nusers != 1 ? "s" : "");
 	}
 
 	printf(" load average: %.02f, %.02f, %.02f\n",
-- 
2.20.0
Received on Fri Dec 28 2018 - 13:49:54 CET

This archive was generated by hypermail 2.3.0 : Fri Dec 28 2018 - 14:00:21 CET