summaryrefslogtreecommitdiffstats
path: root/usr.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 /usr.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 'usr.bin')
-rw-r--r--usr.bin/chflags/Makefile2
-rw-r--r--usr.bin/chflags/chflags.c3
-rw-r--r--usr.bin/find/Makefile2
-rw-r--r--usr.bin/find/function.c4
-rw-r--r--usr.bin/xinstall/Makefile2
-rw-r--r--usr.bin/xinstall/xinstall.c3
6 files changed, 3 insertions, 13 deletions
diff --git a/usr.bin/chflags/Makefile b/usr.bin/chflags/Makefile
index 4ba6a0a..30b6699 100644
--- a/usr.bin/chflags/Makefile
+++ b/usr.bin/chflags/Makefile
@@ -5,7 +5,5 @@ NOSHARED?=yes
PROG= chflags
CFLAGS+=-Wall
-DPADD= ${LIBUTIL}
-LDADD= -lutil
.include <bsd.prog.mk>
diff --git a/usr.bin/chflags/chflags.c b/usr.bin/chflags/chflags.c
index 2f4a96e..daeab4d 100644
--- a/usr.bin/chflags/chflags.c
+++ b/usr.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/usr.bin/find/Makefile b/usr.bin/find/Makefile
index a6e29a7..1d962b9 100644
--- a/usr.bin/find/Makefile
+++ b/usr.bin/find/Makefile
@@ -3,7 +3,5 @@
PROG= find
SRCS= find.c function.c ls.c main.c misc.c operator.c option.c
-DPADD= ${LIBUTIL}
-LDADD= -lutil
.include <bsd.prog.mk>
diff --git a/usr.bin/find/function.c b/usr.bin/find/function.c
index de7f8b1..7033bde 100644
--- a/usr.bin/find/function.c
+++ b/usr.bin/find/function.c
@@ -58,8 +58,6 @@ static char rcsid[] = "$FreeBSD$";
#include "find.h"
-int string_to_flags __P((char **, u_long *, u_long *));
-
#define COMPARE(a, b) { \
switch (plan->flags) { \
case F_EQUAL: \
@@ -994,7 +992,7 @@ c_flags(flags_str)
new->flags = F_ATLEAST;
flags_str++;
}
- if (string_to_flags(&flags_str, &flags, &notflags) == 1)
+ if (setflags(&flags_str, &flags, &notflags) == 1)
errx(1, "-flags: %s: illegal flags string", flags_str);
new->fl_flags = flags;
diff --git a/usr.bin/xinstall/Makefile b/usr.bin/xinstall/Makefile
index 8033180..2c5dc9f 100644
--- a/usr.bin/xinstall/Makefile
+++ b/usr.bin/xinstall/Makefile
@@ -3,8 +3,6 @@
PROG= xinstall
MAN1= install.1
-DPADD= ${LIBUTIL}
-LDADD= -lutil
install: maninstall
${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c
index 4665938..1db50f1 100644
--- a/usr.bin/xinstall/xinstall.c
+++ b/usr.bin/xinstall/xinstall.c
@@ -101,7 +101,6 @@ int compare __P((int, const char *, int, const char *,
const struct stat *, const struct stat *));
void install __P((char *, char *, u_long, u_int));
void install_dir __P((char *));
-u_long string_to_flags __P((char **, u_long *, u_long *));
void strip __P((char *));
void usage __P((void));
int trymmap __P((int));
@@ -152,7 +151,7 @@ main(argc, argv)
break;
case 'f':
flags = optarg;
- if (string_to_flags(&flags, &fset, NULL))
+ if (setflags(&flags, &fset, NULL))
errx(EX_USAGE, "%s: invalid flag", flags);
iflags |= SETFLAGS;
break;
OpenPOWER on IntegriCloud