summaryrefslogtreecommitdiffstats
path: root/bin/ls/ls.c
diff options
context:
space:
mode:
authorjoe <joe@FreeBSD.org>2000-06-17 14:19:33 +0000
committerjoe <joe@FreeBSD.org>2000-06-17 14:19:33 +0000
commit8de98cc2fa7b119cc8deb33c61c9496d25825b49 (patch)
tree33363d4028bb162e624a3a2c5257ab020378f6e0 /bin/ls/ls.c
parent3e8b2c512359fd536c5f66fbd9e265064d461886 (diff)
downloadFreeBSD-src-8de98cc2fa7b119cc8deb33c61c9496d25825b49.zip
FreeBSD-src-8de98cc2fa7b119cc8deb33c61c9496d25825b49.tar.gz
Switch over to using the new fflagstostr and strtofflags library calls.
Diffstat (limited to 'bin/ls/ls.c')
-rw-r--r--bin/ls/ls.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/bin/ls/ls.c b/bin/ls/ls.c
index 0bf1666..69b8d77 100644
--- a/bin/ls/ls.c
+++ b/bin/ls/ls.c
@@ -78,8 +78,6 @@ static const char rcsid[] =
*/
#define STRBUF_SIZEOF(t) (1 + CHAR_BIT * sizeof(t) / 3 + 1)
-char *getflags __P((u_long, char *));
-
static void display __P((FTSENT *, FTSENT *));
static u_quad_t makenines __P((u_long));
static int mastercmp __P((const FTSENT **, const FTSENT **));
@@ -605,7 +603,13 @@ display(p, list)
if ((glen = strlen(group)) > maxgroup)
maxgroup = glen;
if (f_flags) {
- flags = getflags(sp->st_flags, "-");
+ flags = fflagstostr(sp->st_flags);
+ if (flags != NULL && *flags == '\0') {
+ free(flags);
+ flags = strdup("-");
+ }
+ if (flags == NULL)
+ err(1, NULL);
if ((flen = strlen(flags)) > maxflags)
maxflags = flen;
} else
@@ -627,6 +631,7 @@ display(p, list)
if (f_flags) {
np->flags = &np->data[ulen + glen + 2];
(void)strcpy(np->flags, flags);
+ free(flags);
}
cur->fts_pointer = np;
}
OpenPOWER on IntegriCloud