diff options
author | joe <joe@FreeBSD.org> | 2000-06-17 14:19:33 +0000 |
---|---|---|
committer | joe <joe@FreeBSD.org> | 2000-06-17 14:19:33 +0000 |
commit | 8de98cc2fa7b119cc8deb33c61c9496d25825b49 (patch) | |
tree | 33363d4028bb162e624a3a2c5257ab020378f6e0 /bin | |
parent | 3e8b2c512359fd536c5f66fbd9e265064d461886 (diff) | |
download | FreeBSD-src-8de98cc2fa7b119cc8deb33c61c9496d25825b49.zip FreeBSD-src-8de98cc2fa7b119cc8deb33c61c9496d25825b49.tar.gz |
Switch over to using the new fflagstostr and strtofflags library calls.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/chflags/Makefile | 3 | ||||
-rw-r--r-- | bin/chflags/chflags.c | 4 | ||||
-rw-r--r-- | bin/ls/Makefile | 3 | ||||
-rw-r--r-- | bin/ls/extern.h | 1 | ||||
-rw-r--r-- | bin/ls/ls.c | 11 | ||||
-rw-r--r-- | bin/rm/Makefile | 3 | ||||
-rw-r--r-- | bin/rm/rm.c | 14 |
7 files changed, 18 insertions, 21 deletions
diff --git a/bin/chflags/Makefile b/bin/chflags/Makefile index b545bfa..ebc9c0f 100644 --- a/bin/chflags/Makefile +++ b/bin/chflags/Makefile @@ -5,7 +5,6 @@ NOSHARED?=yes PROG= chflags CFLAGS+=-Wall -.PATH: ${.CURDIR}/../../lib/libc/gen -SRCS= chflags.c setflags.c +SRCS= chflags.c .include <bsd.prog.mk> diff --git a/bin/chflags/chflags.c b/bin/chflags/chflags.c index c19c7e4..3ff36ef 100644 --- a/bin/chflags/chflags.c +++ b/bin/chflags/chflags.c @@ -56,8 +56,6 @@ static const char rcsid[] = #include <string.h> #include <unistd.h> -int setflags __P((char **, u_long *, u_long *)); - void usage __P((void)); int @@ -123,7 +121,7 @@ main(argc, argv) set = val; oct = 1; } else { - if (setflags(&flags, &set, &clear)) + if (strtofflags(&flags, &set, &clear)) errx(1, "invalid flag: %s", flags); clear = ~clear; oct = 0; diff --git a/bin/ls/Makefile b/bin/ls/Makefile index 86b91b4..96dffe1 100644 --- a/bin/ls/Makefile +++ b/bin/ls/Makefile @@ -3,8 +3,7 @@ PROG= ls -SRCS= cmp.c setflags.c ls.c print.c util.c -.PATH: ${.CURDIR}/../../lib/libc/gen +SRCS= cmp.c ls.c print.c util.c .if !defined(RELEASE_BUILD_FIXIT) CFLAGS+= -DCOLORLS diff --git a/bin/ls/extern.h b/bin/ls/extern.h index 9ba00ee..4b27be6 100644 --- a/bin/ls/extern.h +++ b/bin/ls/extern.h @@ -43,7 +43,6 @@ int revnamecmp __P((const FTSENT *, const FTSENT *)); int statcmp __P((const FTSENT *, const FTSENT *)); int revstatcmp __P((const FTSENT *, const FTSENT *)); -char *flags_to_string __P((u_long, char *)); void prcopy __P((char *, char *, int)); void printcol __P((DISPLAY *)); void printlong __P((DISPLAY *)); 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; } diff --git a/bin/rm/Makefile b/bin/rm/Makefile index 2bbcdf8..7b85cdf 100644 --- a/bin/rm/Makefile +++ b/bin/rm/Makefile @@ -2,10 +2,9 @@ # $FreeBSD$ PROG= rm -SRCS= rm.c setflags.c +SRCS= rm.c LINKS= ${BINDIR}/rm ${BINDIR}/unlink MLINKS= rm.1 unlink.1 -.PATH: ${.CURDIR}/../../lib/libc/gen .include <bsd.prog.mk> diff --git a/bin/rm/rm.c b/bin/rm/rm.c index c977373..7d01346 100644 --- a/bin/rm/rm.c +++ b/bin/rm/rm.c @@ -60,8 +60,6 @@ static const char rcsid[] = #include <sysexits.h> #include <unistd.h> -char *getflags __P((u_long, char *)); - int dflag, eval, fflag, iflag, Pflag, vflag, Wflag, stdin_ok; uid_t uid; @@ -423,7 +421,7 @@ check(path, name, sp) struct stat *sp; { int ch, first; - char modep[15], flagsp[128]; + char modep[15], *flagsp; /* Check -i first. */ if (iflag) @@ -441,15 +439,15 @@ check(path, name, sp) (!(sp->st_flags & (UF_APPEND|UF_IMMUTABLE)) || !uid))) return (1); strmode(sp->st_mode, modep); - strcpy(flagsp, getflags(sp->st_flags, NULL)); - if (*flagsp) - strcat(flagsp, " "); - (void)fprintf(stderr, "override %s%s%s/%s %sfor %s? ", + if ((flagsp = fflagstostr(sp->st_flags)) == NULL) + err(1, NULL); + (void)fprintf(stderr, "override %s%s%s/%s %s%sfor %s? ", modep + 1, modep[9] == ' ' ? "" : " ", user_from_uid(sp->st_uid, 0), group_from_gid(sp->st_gid, 0), - *flagsp ? flagsp : "", + *flagsp ? flagsp : "", *flagsp ? " " : "", path); + free(flagsp); } (void)fflush(stderr); |