Hello,
I sent this same diff to @tech a few days ago, but I think it was rejected
since the patch was
added as an attachment.
I apologize if you already received this.
This diff removes some white spaces/tabs and fixes a few inconsistencies in the
formatting style.
There is no change in binary.
Index: who.c
===================================================================
RCS file: /cvs/src/usr.bin/who/who.c,v
retrieving revision 1.27
diff -u -p -u -p -r1.27 who.c
--- who.c 21 Oct 2015 16:06:57 -0000 1.27
+++ who.c 8 Apr 2018 14:10:25 -0000
@@ -35,6 +35,7 @@
#include <sys/types.h>
#include <sys/stat.h>
+
#include <paths.h>
#include <pwd.h>
#include <utmp.h>
@@ -110,10 +111,9 @@ main(int argc, char *argv[])
argc -= optind;
argv += optind;
- if (show_quick) {
+ if (show_quick)
only_current_term = show_term = show_idle = show_labels = 0;
- }
-
+
if (show_term)
hostwidth -= 2;
if (show_idle)
@@ -126,22 +126,22 @@ main(int argc, char *argv[])
case 0: /* who */
ufp = file(_PATH_UTMP);
- if (only_current_term) {
+ if (only_current_term)
who_am_i(ufp);
- } else if (show_quick) {
+ else if (show_quick) {
int count = 0;
-
+
while (fread((char *)&usr, sizeof(usr), 1, ufp) == 1) {
if (*usr.ut_name && *usr.ut_line) {
(void)printf("%-*.*s ", NAME_WIDTH,
- UT_NAMESIZE, usr.ut_name);
+ UT_NAMESIZE, usr.ut_name);
if ((++count % 8) == 0)
- (void) printf("\n");
+ (void)printf("\n");
}
}
if (count % 8)
- (void) printf("\n");
- (void) printf ("# users=%d\n", count);
+ (void)printf("\n");
+ (void)printf("# users=%d\n", count);
} else {
/* only entries with both name and line fields */
while (fread((char *)&usr, sizeof(usr), 1, ufp) == 1)
@@ -152,22 +152,22 @@ main(int argc, char *argv[])
case 1: /* who utmp_file */
ufp = file(*argv);
- if (only_current_term) {
+ if (only_current_term)
who_am_i(ufp);
- } else if (show_quick) {
+ else if (show_quick) {
int count = 0;
while (fread((char *)&usr, sizeof(usr), 1, ufp) == 1) {
if (*usr.ut_name && *usr.ut_line) {
(void)printf("%-*.*s ", NAME_WIDTH,
- UT_NAMESIZE, usr.ut_name);
+ UT_NAMESIZE, usr.ut_name);
if ((++count % 8) == 0)
- (void) printf("\n");
+ (void)printf("\n");
}
}
if (count % 8)
- (void) printf("\n");
- (void) printf ("# users=%d\n", count);
+ (void)printf("\n");
+ (void)printf("# users=%d\n", count);
} else {
/* all entries */
while (fread((char *)&usr, sizeof(usr), 1, ufp) == 1)
@@ -222,7 +222,7 @@ output(struct utmp *up)
if (show_term || show_idle) {
if (now == 0)
time(&now);
-
+
memset(line, 0, sizeof line);
strlcpy(line, _PATH_DEV, sizeof line);
strlcat(line, up->ut_line, sizeof line);
@@ -234,29 +234,26 @@ output(struct utmp *up)
state = '?';
idle = 0;
}
-
}
(void)printf("%-*.*s ", NAME_WIDTH, UT_NAMESIZE, up->ut_name);
- if (show_term) {
+ if (show_term)
(void)printf("%c ", state);
- }
(void)printf("%-*.*s ", UT_LINESIZE, UT_LINESIZE, up->ut_line);
(void)printf("%.12s ", ctime(&up->ut_time) + 4);
if (show_idle) {
- if (idle < 60)
+ if (idle < 60)
(void)printf(" . ");
else if (idle < (24 * 60 * 60))
- (void)printf("%02d:%02d ",
- ((int)idle / (60 * 60)),
- ((int)idle % (60 * 60)) / 60);
+ (void)printf("%02d:%02d ", ((int)idle / (60 * 60)),
+ ((int)idle % (60 * 60)) / 60);
else
(void)printf(" old ");
}
-
+
if (*up->ut_host)
printf(" (%.*s)", hostwidth, up->ut_host);
(void)putchar('\n');
@@ -297,7 +294,7 @@ file(char *name)
if (pledge("stdio getpw", NULL) == -1)
err(1, "pledge");
}
- return(ufp);
+ return (ufp);
}
void
Is it ok to send diffs which try to improve the coding style?
Best,
Alessandro