diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2002-03-12 01:05:16 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2002-03-12 01:05:16 +0000 |
commit | ee676bc2512ad38880923d07c19c73dbac76fcf6 (patch) | |
tree | 4a170f429a8f1da77a4beaedf4a1672c1722dd43 /bin/ls | |
parent | 6b26e3534f7b906382bc4ce699b0d350f0029eb4 (diff) |
o Remove local prototypes for group_from_gid() and user_from_uid()
since they are prototyped in grp.h and pwd.h.
o Increase size of 'buf' to 21 since we store the string representation
of a u_quad_t in it (max 20 chars + the NUL).
o Minor KNF wrt pointers in boolean context.
From Denis Afonin
Diffstat (limited to 'bin/ls')
-rw-r--r-- | bin/ls/ls.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/bin/ls/ls.c b/bin/ls/ls.c index d281cc64c4e..00c03b22091 100644 --- a/bin/ls/ls.c +++ b/bin/ls/ls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ls.c,v 1.16 2002/02/16 21:27:07 millert Exp $ */ +/* $OpenBSD: ls.c,v 1.17 2002/03/12 01:05:15 millert Exp $ */ /* $NetBSD: ls.c,v 1.18 1996/07/09 09:16:29 mycroft Exp $ */ /* @@ -47,7 +47,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)ls.c 8.7 (Berkeley) 8/5/94"; #else -static char rcsid[] = "$OpenBSD: ls.c,v 1.16 2002/02/16 21:27:07 millert Exp $"; +static char rcsid[] = "$OpenBSD: ls.c,v 1.17 2002/03/12 01:05:15 millert Exp $"; #endif #endif /* not lint */ @@ -59,6 +59,8 @@ static char rcsid[] = "$OpenBSD: ls.c,v 1.16 2002/02/16 21:27:07 millert Exp $"; #include <err.h> #include <errno.h> #include <fts.h> +#include <grp.h> +#include <pwd.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -67,9 +69,6 @@ static char rcsid[] = "$OpenBSD: ls.c,v 1.16 2002/02/16 21:27:07 millert Exp $"; #include "ls.h" #include "extern.h" -char *group_from_gid(u_int, int); -char *user_from_uid(u_int, int); - static void display(FTSENT *, FTSENT *); static int mastercmp(const FTSENT **, const FTSENT **); static void traverse(int, char **, int); @@ -420,7 +419,7 @@ display(p, list) u_long btotal, maxblock, maxinode, maxlen, maxnlink; int bcfile, flen, glen, ulen, maxflags, maxgroup, maxuser; int entries, needstats; - char *user, *group, buf[20]; /* 32 bits == 10 digits */ + char *user, *group, buf[21]; /* 64 bits == 20 digits */ char nuser[12], ngroup[12]; char *flags = NULL; @@ -440,7 +439,7 @@ display(p, list) bcfile = 0; maxuser = maxgroup = maxflags = 0; maxsize = 0; - for (cur = list, entries = 0; cur; cur = cur->fts_link) { + for (cur = list, entries = 0; cur != NULL; cur = cur->fts_link) { if (cur->fts_info == FTS_ERR || cur->fts_info == FTS_NS) { warnx("%s: %s", cur->fts_name, strerror(cur->fts_errno)); @@ -554,7 +553,7 @@ display(p, list) output = 1; if (f_longform) - for (cur = list; cur; cur = cur->fts_link) + for (cur = list; cur != NULL; cur = cur->fts_link) free(cur->fts_pointer); } |