svn commit: trunk/busybox: coreutils miscutils

vda at busybox.net vda at busybox.net
Fri Jun 27 22:31:08 UTC 2008


Author: vda
Date: 2008-06-27 15:31:07 -0700 (Fri, 27 Jun 2008)
New Revision: 22542

Log:
stat: pointers are not 0L, they are NULL
man: better error handling



Modified:
   trunk/busybox/coreutils/stat.c
   trunk/busybox/miscutils/man.c


Changeset:
Modified: trunk/busybox/coreutils/stat.c
===================================================================
--- trunk/busybox/coreutils/stat.c	2008-06-27 22:05:21 UTC (rev 22541)
+++ trunk/busybox/coreutils/stat.c	2008-06-27 22:31:07 UTC (rev 22542)
@@ -240,14 +240,14 @@
 	} else if (m == 'U') {
 		setpwent();
 		pw_ent = getpwuid(statbuf->st_uid);
-		printfs(pformat, (pw_ent != 0L) ? pw_ent->pw_name : "UNKNOWN");
+		printfs(pformat, (pw_ent != NULL) ? pw_ent->pw_name : "UNKNOWN");
 	} else if (m == 'g') {
 		strcat(pformat, "lu");
 		printf(pformat, (unsigned long) statbuf->st_gid);
 	} else if (m == 'G') {
 		setgrent();
 		gw_ent = getgrgid(statbuf->st_gid);
-		printfs(pformat, (gw_ent != 0L) ? gw_ent->gr_name : "UNKNOWN");
+		printfs(pformat, (gw_ent != NULL) ? gw_ent->gr_name : "UNKNOWN");
 	} else if (m == 't') {
 		strcat(pformat, "lx");
 		printf(pformat, (unsigned long) major(statbuf->st_rdev));
@@ -609,9 +609,9 @@
 		       (unsigned long) (statbuf.st_mode & (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)),
 		       bb_mode_string(statbuf.st_mode),
 		       (unsigned long) statbuf.st_uid,
-		       (pw_ent != 0L) ? pw_ent->pw_name : "UNKNOWN",
+		       (pw_ent != NULL) ? pw_ent->pw_name : "UNKNOWN",
 		       (unsigned long) statbuf.st_gid,
-		       (gw_ent != 0L) ? gw_ent->gr_name : "UNKNOWN");
+		       (gw_ent != NULL) ? gw_ent->gr_name : "UNKNOWN");
 #if ENABLE_SELINUX
 		printf("   S_Context: %lc\n", *scontext);
 #endif

Modified: trunk/busybox/miscutils/man.c
===================================================================
--- trunk/busybox/miscutils/man.c	2008-06-27 22:05:21 UTC (rev 22541)
+++ trunk/busybox/miscutils/man.c	2008-06-27 22:31:07 UTC (rev 22542)
@@ -35,7 +35,9 @@
 		return 1;
 	}
 
-	cmd = xasprintf("%s '%s' | gtbl | nroff -Tlatin1 -mandoc | %s",
+	/* "2>&1" added so that nroff errors are shown in pager too.
+	 * Otherwise it may show just empty screen */
+	cmd = xasprintf("%s '%s' | gtbl | nroff -Tlatin1 -mandoc 2>&1 | %s",
 			unpacker, man_filename, pager);
 	system(cmd);
 	free(cmd);
@@ -123,6 +125,11 @@
 		fclose(cf);
 	}
 
+// TODO: my man3/getpwuid.3.gz contains just one line:
+// .so man3/getpwnam.3
+// (and I _dont_ have man3/getpwnam.3, I have man3/getpwnam.3.gz)
+// need to support this...
+
 	not_found = 0;
 	do { /* for each argv[] */
 		int found = 0;




More information about the busybox-cvs mailing list