summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorjoe <joe@FreeBSD.org>2000-01-27 21:17:01 +0000
committerjoe <joe@FreeBSD.org>2000-01-27 21:17:01 +0000
commitf1a9497df5db81a71987fa20f10c831030987e36 (patch)
treebcca8d67d721cd7e4ca8e7322d19df89912cfd26 /bin
parent30f3b614b3b18d86be7ff164b9aba2617637b9c6 (diff)
downloadFreeBSD-src-f1a9497df5db81a71987fa20f10c831030987e36.zip
FreeBSD-src-f1a9497df5db81a71987fa20f10c831030987e36.tar.gz
Historically file flags (schg, uschg, etc) have been converted from
string to u_long and back using two functions, flags_to_string and string_to_flags, which co-existed with 'ls'. As time has progressed more and more other tools have used these private functions to manipulate the file flags. Recently I moved these functions from /usr/src/bin/ls to libutil, but after some discussion with bde it's been decided that they really ought to go in libc. There are two already existing libc functions for manipulating file modes: setmode and getmode. In keeping with these flags_to_string has been renamed getflags and string_to_flags to setflags. The manual page could probably be improved upon ;)
Diffstat (limited to 'bin')
-rw-r--r--bin/chflags/Makefile2
-rw-r--r--bin/chflags/chflags.c3
-rw-r--r--bin/ls/Makefile2
-rw-r--r--bin/ls/ls.c3
-rw-r--r--bin/rm/Makefile2
-rw-r--r--bin/rm/rm.c4
6 files changed, 3 insertions, 13 deletions
diff --git a/bin/chflags/Makefile b/bin/chflags/Makefile
index 4ba6a0a..30b6699 100644
--- a/bin/chflags/Makefile
+++ b/bin/chflags/Makefile
@@ -5,7 +5,5 @@ NOSHARED?=yes
PROG= chflags
CFLAGS+=-Wall
-DPADD= ${LIBUTIL}
-LDADD= -lutil
.include <bsd.prog.mk>
diff --git a/bin/chflags/chflags.c b/bin/chflags/chflags.c
index 2f4a96e..daeab4d 100644
--- a/bin/chflags/chflags.c
+++ b/bin/chflags/chflags.c
@@ -56,7 +56,6 @@ static const char rcsid[] =
#include <string.h>
#include <unistd.h>
-u_long string_to_flags __P((char **, u_long *, u_long *));
void usage __P((void));
int
@@ -122,7 +121,7 @@ main(argc, argv)
set = val;
oct = 1;
} else {
- if (string_to_flags(&flags, &set, &clear))
+ if (setflags(&flags, &set, &clear))
errx(1, "invalid flag: %s", flags);
clear = ~clear;
oct = 0;
diff --git a/bin/ls/Makefile b/bin/ls/Makefile
index 2af0cd5..1ab70dc 100644
--- a/bin/ls/Makefile
+++ b/bin/ls/Makefile
@@ -4,7 +4,5 @@
PROG= ls
SRCS= cmp.c ls.c print.c util.c
-DPADD= ${LIBUTIL}
-LDADD= -lutil
.include <bsd.prog.mk>
diff --git a/bin/ls/ls.c b/bin/ls/ls.c
index 70b031e..5db9997 100644
--- a/bin/ls/ls.c
+++ b/bin/ls/ls.c
@@ -543,8 +543,7 @@ display(p, list)
if ((glen = strlen(group)) > maxgroup)
maxgroup = glen;
if (f_flags) {
- flags =
- flags_to_string(sp->st_flags, "-");
+ flags = getflags(sp->st_flags, "-");
if ((flen = strlen(flags)) > maxflags)
maxflags = flen;
} else
diff --git a/bin/rm/Makefile b/bin/rm/Makefile
index 5ef835e..7058fa0 100644
--- a/bin/rm/Makefile
+++ b/bin/rm/Makefile
@@ -2,8 +2,6 @@
# $FreeBSD$
PROG= rm
-DPADD= ${LIBUTIL}
-LDADD= -lutil
LINKS= ${BINDIR}/rm ${BINDIR}/unlink
MLINKS= rm.1 unlink.1
diff --git a/bin/rm/rm.c b/bin/rm/rm.c
index a4a3c96..4315f99 100644
--- a/bin/rm/rm.c
+++ b/bin/rm/rm.c
@@ -61,8 +61,6 @@ static const char rcsid[] =
#include <sysexits.h>
#include <unistd.h>
-extern char *flags_to_string __P((u_long, char *));
-
int dflag, eval, fflag, iflag, Pflag, vflag, Wflag, stdin_ok;
uid_t uid;
@@ -442,7 +440,7 @@ check(path, name, sp)
(!(sp->st_flags & (UF_APPEND|UF_IMMUTABLE)) || !uid)))
return (1);
strmode(sp->st_mode, modep);
- strcpy(flagsp, flags_to_string(sp->st_flags, NULL));
+ strcpy(flagsp, getflags(sp->st_flags, NULL));
if (*flagsp)
strcat(flagsp, " ");
(void)fprintf(stderr, "override %s%s%s/%s %sfor %s? ",
OpenPOWER on IntegriCloud