svn commit: trunk/busybox: coreutils include

vda at busybox.net vda at busybox.net
Fri Nov 16 05:24:44 UTC 2007


Author: vda
Date: 2007-11-15 21:24:43 -0800 (Thu, 15 Nov 2007)
New Revision: 20430

Log:
who: add -a (by Tito)



Modified:
   trunk/busybox/coreutils/who.c
   trunk/busybox/include/usage.h


Changeset:
Modified: trunk/busybox/coreutils/who.c
===================================================================
--- trunk/busybox/coreutils/who.c	2007-11-15 17:47:45 UTC (rev 20429)
+++ trunk/busybox/coreutils/who.c	2007-11-16 05:24:43 UTC (rev 20430)
@@ -46,15 +46,15 @@
 	struct utmp *ut;
 	struct stat st;
 	char *name;
+	unsigned opt;
 
-	if (argc > 1) {
-		bb_show_usage();
-	}
+	opt_complementary = "=0";
+	opt = getopt32(argv, "a");
 
 	setutent();
 	printf("USER       TTY      IDLE      TIME            HOST\n");
 	while ((ut = getutent()) != NULL) {
-		if (ut->ut_user[0] && ut->ut_type == USER_PROCESS) {
+		if (ut->ut_user[0] && (opt || ut->ut_type == USER_PROCESS)) {
 			/* ut->ut_line is device name of tty - "/dev/" */
 			name = concat_path_file("/dev", ut->ut_line);
 			str6[0] = '?';

Modified: trunk/busybox/include/usage.h
===================================================================
--- trunk/busybox/include/usage.h	2007-11-15 17:47:45 UTC (rev 20429)
+++ trunk/busybox/include/usage.h	2007-11-16 05:24:43 UTC (rev 20430)
@@ -4112,9 +4112,11 @@
        "/bin/login\n"
 
 #define who_trivial_usage \
-       " "
+       "[-a]"
 #define who_full_usage \
-       "Print the current user names and related information"
+       "Show who is logged on" \
+       "\n\nOptions:\n" \
+       "	-a	show all"
 
 #define whoami_trivial_usage \
        ""




More information about the busybox-cvs mailing list