diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-06-26 07:27:33 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-06-26 07:27:33 +0000 |
commit | e985c54ca22a1b161106287b8b7494e393cc38eb (patch) | |
tree | 10f77c517e70b1721046e6d3831a594646dc86af /usr.bin/find | |
parent | 68cb2f01fcab44bb7692da6af113e76acb3cff3d (diff) |
bring protypes into scope. this requires some quirky handling, but in
the end everything is much clearer; ok tedu (itojun might like to see
how ifconfig looks after this)
Diffstat (limited to 'usr.bin/find')
-rw-r--r-- | usr.bin/find/extern.h | 80 | ||||
-rw-r--r-- | usr.bin/find/find.c | 12 | ||||
-rw-r--r-- | usr.bin/find/find.h | 14 | ||||
-rw-r--r-- | usr.bin/find/function.c | 157 | ||||
-rw-r--r-- | usr.bin/find/ls.c | 19 | ||||
-rw-r--r-- | usr.bin/find/misc.c | 29 | ||||
-rw-r--r-- | usr.bin/find/operator.c | 22 | ||||
-rw-r--r-- | usr.bin/find/option.c | 20 |
8 files changed, 179 insertions, 174 deletions
diff --git a/usr.bin/find/extern.h b/usr.bin/find/extern.h index 390e2a595a4..525a6058962 100644 --- a/usr.bin/find/extern.h +++ b/usr.bin/find/extern.h @@ -1,4 +1,4 @@ -/* * $OpenBSD: extern.h,v 1.13 2003/06/03 02:56:08 millert Exp $*/ +/* * $OpenBSD: extern.h,v 1.14 2003/06/26 07:27:29 deraadt Exp $*/ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. @@ -46,44 +46,44 @@ void printlong(char *, char *, struct stat *); int queryuser(char **); void show_path(int); -PLAN *c_amin(char *); -PLAN *c_anewer(char *); -PLAN *c_atime(char *); -PLAN *c_cmin(char *); -PLAN *c_cnewer(char *); -PLAN *c_ctime(char *); -PLAN *c_depth(void); -PLAN *c_empty(void); -PLAN *c_exec(char ***, int); -PLAN *c_execdir(char ***); -PLAN *c_flags(char *); -PLAN *c_follow(void); -PLAN *c_fstype(char *); -PLAN *c_group(char *); -PLAN *c_iname(char *); -PLAN *c_inum(char *); -PLAN *c_links(char *); -PLAN *c_ls(void); -PLAN *c_maxdepth(char *); -PLAN *c_mindepth(char *); -PLAN *c_mmin(char *); -PLAN *c_name(char *); -PLAN *c_newer(char *); -PLAN *c_nogroup(void); -PLAN *c_nouser(void); -PLAN *c_path(char *); -PLAN *c_perm(char *); -PLAN *c_print(void); -PLAN *c_print0(void); -PLAN *c_prune(void); -PLAN *c_size(char *); -PLAN *c_type(char *); -PLAN *c_user(char *); -PLAN *c_xdev(void); -PLAN *c_openparen(void); -PLAN *c_closeparen(void); -PLAN *c_mtime(char *); -PLAN *c_not(void); -PLAN *c_or(void); +PLAN *c_amin(char *, char ***, int); +PLAN *c_anewer(char *, char ***, int); +PLAN *c_atime(char *, char ***, int); +PLAN *c_cmin(char *, char ***, int); +PLAN *c_cnewer(char *, char ***, int); +PLAN *c_ctime(char *, char ***, int); +PLAN *c_depth(char *, char ***, int); +PLAN *c_empty(char *, char ***, int); +PLAN *c_exec(char *, char ***, int); +PLAN *c_execdir(char *, char ***, int); +PLAN *c_flags(char *, char ***, int); +PLAN *c_follow(char *, char ***, int); +PLAN *c_fstype(char *, char ***, int); +PLAN *c_group(char *, char ***, int); +PLAN *c_iname(char *, char ***, int); +PLAN *c_inum(char *, char ***, int); +PLAN *c_links(char *, char ***, int); +PLAN *c_ls(char *, char ***, int); +PLAN *c_maxdepth(char *, char ***, int); +PLAN *c_mindepth(char *, char ***, int); +PLAN *c_mmin(char *, char ***, int); +PLAN *c_name(char *, char ***, int); +PLAN *c_newer(char *, char ***, int); +PLAN *c_nogroup(char *, char ***, int); +PLAN *c_nouser(char *, char ***, int); +PLAN *c_path(char *, char ***, int); +PLAN *c_perm(char *, char ***, int); +PLAN *c_print(char *, char ***, int); +PLAN *c_print0(char *, char ***, int); +PLAN *c_prune(char *, char ***, int); +PLAN *c_size(char *, char ***, int); +PLAN *c_type(char *, char ***, int); +PLAN *c_user(char *, char ***, int); +PLAN *c_xdev(char *, char ***, int); +PLAN *c_openparen(char *, char ***, int); +PLAN *c_closeparen(char *, char ***, int); +PLAN *c_mtime(char *, char ***, int); +PLAN *c_not(char *, char ***, int); +PLAN *c_or(char *, char ***, int); extern int ftsoptions, isdeprecated, isdepth, isoutput, isxargs; diff --git a/usr.bin/find/find.c b/usr.bin/find/find.c index ba15fdd4a25..6c9cfdcf8f2 100644 --- a/usr.bin/find/find.c +++ b/usr.bin/find/find.c @@ -1,4 +1,4 @@ -/* $OpenBSD: find.c,v 1.9 2003/06/03 02:56:08 millert Exp $ */ +/* $OpenBSD: find.c,v 1.10 2003/06/26 07:27:29 deraadt Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -34,7 +34,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)find.c 8.1 (Berkeley) 6/6/93";*/ -static char rcsid[] = "$OpenBSD: find.c,v 1.9 2003/06/03 02:56:08 millert Exp $"; +static char rcsid[] = "$OpenBSD: find.c,v 1.10 2003/06/26 07:27:29 deraadt Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -95,16 +95,16 @@ find_formplan(argv) */ if (!isoutput) { if (plan == NULL) { - new = c_print(); + new = c_print(NULL, NULL, 0); tail = plan = new; } else { - new = c_openparen(); + new = c_openparen(NULL, NULL, 0); new->next = plan; plan = new; - new = c_closeparen(); + new = c_closeparen(NULL, NULL, 0); tail->next = new; tail = new; - new = c_print(); + new = c_print(NULL, NULL, 0); tail->next = new; tail = new; } diff --git a/usr.bin/find/find.h b/usr.bin/find/find.h index d97b2647e57..37af2a433e9 100644 --- a/usr.bin/find/find.h +++ b/usr.bin/find/find.h @@ -1,4 +1,4 @@ -/* * $OpenBSD: find.h,v 1.12 2003/06/03 02:56:08 millert Exp $*/ +/* * $OpenBSD: find.h,v 1.13 2003/06/26 07:27:29 deraadt Exp $*/ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -106,12 +106,12 @@ typedef struct _plandata { #define e_len p_un.ex._e_len typedef struct _option { - char *name; /* option name */ - enum ntype token; /* token type */ - PLAN *(*create)(); /* create function: DON'T PROTOTYPE! */ -#define O_NONE 0x01 /* no call required */ -#define O_ZERO 0x02 /* pass: nothing */ -#define O_ARGV 0x04 /* pass: argv, increment argv */ + char *name; /* option name */ + enum ntype token; /* token type */ + PLAN *(*create)(char *, char ***, int); /* create function */ +#define O_NONE 0x01 /* no call required */ +#define O_ZERO 0x02 /* pass: nothing */ +#define O_ARGV 0x04 /* pass: argv, increment argv */ #define O_ARGVP 0x08 /* pass: *argv, N_OK || N_EXEC || N_EXECDIR */ int flags; } OPTION; diff --git a/usr.bin/find/function.c b/usr.bin/find/function.c index b01a36a4480..569b8d0a763 100644 --- a/usr.bin/find/function.c +++ b/usr.bin/find/function.c @@ -1,4 +1,4 @@ -/* $OpenBSD: function.c,v 1.27 2003/06/10 22:20:46 deraadt Exp $ */ +/* $OpenBSD: function.c,v 1.28 2003/06/26 07:27:29 deraadt Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -34,7 +34,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)function.c 8.1 (Berkeley) 6/6/93";*/ -static char rcsid[] = "$OpenBSD: function.c,v 1.27 2003/06/10 22:20:46 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: function.c,v 1.28 2003/06/26 07:27:29 deraadt Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -59,6 +59,7 @@ static char rcsid[] = "$OpenBSD: function.c,v 1.27 2003/06/10 22:20:46 deraadt E #include <unistd.h> #include "find.h" +#include "extern.h" #define COMPARE(a, b) { \ switch (plan->flags) { \ @@ -74,6 +75,46 @@ static char rcsid[] = "$OpenBSD: function.c,v 1.27 2003/06/10 22:20:46 deraadt E } static PLAN *palloc(enum ntype, int (*)(PLAN *, FTSENT *)); +static long find_parsenum(PLAN *plan, char *option, char *vp, char *endch); +static PLAN *palloc(enum ntype t, int (*f)(PLAN *, FTSENT *)); + +int f_amin(PLAN *, FTSENT *); +int f_atime(PLAN *, FTSENT *); +int f_cmin(PLAN *, FTSENT *); +int f_ctime(PLAN *, FTSENT *); +int f_always_true(PLAN *, FTSENT *); +int f_empty(PLAN *, FTSENT *); +int f_exec(PLAN *, FTSENT *); +int f_execdir(PLAN *, FTSENT *); +int f_flags(PLAN *, FTSENT *); +int f_fstype(PLAN *, FTSENT *); +int f_group(PLAN *, FTSENT *); +int f_inum(PLAN *, FTSENT *); +int f_empty(PLAN *, FTSENT *); +int f_links(PLAN *, FTSENT *); +int f_ls(PLAN *, FTSENT *); +int f_maxdepth(PLAN *, FTSENT *); +int f_mindepth(PLAN *, FTSENT *); +int f_mtime(PLAN *, FTSENT *); +int f_mmin(PLAN *, FTSENT *); +int f_name(PLAN *, FTSENT *); +int f_iname(PLAN *, FTSENT *); +int f_newer(PLAN *, FTSENT *); +int f_anewer(PLAN *, FTSENT *); +int f_cnewer(PLAN *, FTSENT *); +int f_nogroup(PLAN *, FTSENT *); +int f_nouser(PLAN *, FTSENT *); +int f_path(PLAN *, FTSENT *); +int f_perm(PLAN *, FTSENT *); +int f_print(PLAN *, FTSENT *); +int f_print0(PLAN *, FTSENT *); +int f_prune(PLAN *, FTSENT *); +int f_size(PLAN *, FTSENT *); +int f_type(PLAN *, FTSENT *); +int f_user(PLAN *, FTSENT *); +int f_expr(PLAN *, FTSENT *); +int f_not(PLAN *, FTSENT *); +int f_or(PLAN *, FTSENT *); extern int dotfd; extern time_t now; @@ -150,8 +191,7 @@ f_amin(plan, entry) } PLAN * -c_amin(arg) - char *arg; +c_amin(char *arg, char ***ignored, int unused) { PLAN *new; @@ -180,8 +220,7 @@ f_atime(plan, entry) } PLAN * -c_atime(arg) - char *arg; +c_atime(char *arg, char ***ignored, int unused) { PLAN *new; @@ -211,8 +250,7 @@ f_cmin(plan, entry) } PLAN * -c_cmin(arg) - char *arg; +c_cmin(char *arg, char ***ignored, int unused) { PLAN *new; @@ -241,8 +279,7 @@ f_ctime(plan, entry) } PLAN * -c_ctime(arg) - char *arg; +c_ctime(char *arg, char ***ignored, int unused) { PLAN *new; @@ -270,7 +307,7 @@ f_always_true(plan, entry) } PLAN * -c_depth(void) +c_depth(char *ignore, char ***ignored, int unused) { isdepth = 1; @@ -312,7 +349,7 @@ f_empty(plan, entry) } PLAN * -c_empty(void) +c_empty(char *ignore, char ***ignored, int unused) { ftsoptions &= ~FTS_NOSTAT; @@ -377,9 +414,7 @@ f_exec(plan, entry) * strings, but also flags meaning that the string has to be massaged. */ PLAN * -c_exec(argvp, isok) - char ***argvp; - int isok; +c_exec(char *unused, char ***argvp, int isok) { PLAN *new; /* node returned */ int cnt; @@ -498,8 +533,7 @@ f_execdir(plan, entry) * strings, but also flags meaning that the string has to be massaged. */ PLAN * -c_execdir(argvp) - char ***argvp; +c_execdir(char *ignored, char ***argvp, int unused) { PLAN *new; /* node returned */ int cnt; @@ -567,8 +601,7 @@ f_flags(plan, entry) } PLAN * -c_flags(flags_str) - char *flags_str; +c_flags(char *flags_str, char ***ignored, int unused) { PLAN *new; u_int32_t flags, notflags; @@ -597,7 +630,7 @@ c_flags(flags_str) * basis. */ PLAN * -c_follow(void) +c_follow(char *ignore, char ***ignored, int unused) { ftsoptions &= ~FTS_PHYSICAL; ftsoptions |= FTS_LOGICAL; @@ -672,8 +705,7 @@ f_fstype(plan, entry) } PLAN * -c_fstype(arg) - char *arg; +c_fstype(char *arg, char ***ignored, int unused) { PLAN *new; @@ -718,8 +750,7 @@ f_group(plan, entry) } PLAN * -c_group(gname) - char *gname; +c_group(char *gname, char ***ignored, int unused) { PLAN *new; struct group *g; @@ -754,8 +785,7 @@ f_inum(plan, entry) } PLAN * -c_inum(arg) - char *arg; +c_inum(char *arg, char ***ignored, int unused) { PLAN *new; @@ -780,8 +810,7 @@ f_links(plan, entry) } PLAN * -c_links(arg) - char *arg; +c_links(char *arg, char ***ignored, int unused) { PLAN *new; @@ -807,7 +836,7 @@ f_ls(plan, entry) } PLAN * -c_ls(void) +c_ls(char *ignore, char ***ignored, int unused) { ftsoptions &= ~FTS_NOSTAT; isoutput = 1; @@ -833,8 +862,7 @@ f_maxdepth(plan, entry) } PLAN * -c_maxdepth(arg) - char *arg; +c_maxdepth(char *arg, char ***ignored, int unused) { PLAN *new; @@ -859,8 +887,7 @@ f_mindepth(plan, entry) } PLAN * -c_mindepth(arg) - char *arg; +c_mindepth(char *arg, char ***ignored, int unused) { PLAN *new; @@ -886,8 +913,7 @@ f_mtime(plan, entry) } PLAN * -c_mtime(arg) - char *arg; +c_mtime(char *arg, char ***ignored, int unused) { PLAN *new; @@ -917,8 +943,7 @@ f_mmin(plan, entry) } PLAN * -c_mmin(arg) - char *arg; +c_mmin(char *arg, char ***ignored, int unused) { PLAN *new; @@ -945,8 +970,7 @@ f_name(plan, entry) } PLAN * -c_name(pattern) - char *pattern; +c_name(char *pattern, char ***ignored, int unused) { PLAN *new; @@ -970,8 +994,7 @@ f_iname(plan, entry) } PLAN * -c_iname(pattern) - char *pattern; +c_iname(char *pattern, char ***ignored, int unused) { PLAN *new; @@ -999,8 +1022,7 @@ f_newer(plan, entry) } PLAN * -c_newer(filename) - char *filename; +c_newer(char *filename, char ***ignored, int unused) { PLAN *new; struct stat sb; @@ -1033,8 +1055,7 @@ f_anewer(plan, entry) } PLAN * -c_anewer(filename) - char *filename; +c_anewer(char *filename, char ***ignored, int unused) { PLAN *new; struct stat sb; @@ -1067,8 +1088,7 @@ f_cnewer(plan, entry) } PLAN * -c_cnewer(filename) - char *filename; +c_cnewer(char *filename, char ***ignored, int unused) { PLAN *new; struct stat sb; @@ -1097,7 +1117,7 @@ f_nogroup(plan, entry) } PLAN * -c_nogroup(void) +c_nogroup(char *ignore, char ***ignored, int unused) { ftsoptions &= ~FTS_NOSTAT; @@ -1119,7 +1139,7 @@ f_nouser(plan, entry) } PLAN * -c_nouser(void) +c_nouser(char *ignore, char ***ignored, int unused) { ftsoptions &= ~FTS_NOSTAT; @@ -1141,8 +1161,7 @@ f_path(plan, entry) } PLAN * -c_path(pattern) - char *pattern; +c_path(char *pattern, char ***ignored, int unused) { PLAN *new; @@ -1175,8 +1194,7 @@ f_perm(plan, entry) } PLAN * -c_perm(perm) - char *perm; +c_perm(char *perm, char ***ignored, int unused) { PLAN *new; mode_t *set; @@ -1225,7 +1243,7 @@ f_print0(plan, entry) } PLAN * -c_print(void) +c_print(char *ignore, char ***ignored, int unused) { isoutput = 1; @@ -1233,7 +1251,7 @@ c_print(void) } PLAN * -c_print0(void) +c_print0(char *ignore, char ***ignored, int unused) { isoutput = 1; @@ -1257,7 +1275,7 @@ f_prune(plan, entry) } PLAN * -c_prune(void) +c_prune(char *ignore, char ***ignored, int unused) { return (palloc(N_PRUNE, f_prune)); } @@ -1285,8 +1303,7 @@ f_size(plan, entry) } PLAN * -c_size(arg) - char *arg; +c_size(char *arg, char ***ignored, int unused) { PLAN *new; char endch; @@ -1317,8 +1334,7 @@ f_type(plan, entry) } PLAN * -c_type(typestring) - char *typestring; +c_type(char *typestring, char ***ignored, int unused) { PLAN *new; mode_t mask; @@ -1379,8 +1395,7 @@ f_user(plan, entry) } PLAN * -c_user(username) - char *username; +c_user(char *username, char ***ignored, int unused) { PLAN *new; struct passwd *p; @@ -1408,7 +1423,7 @@ c_user(username) * different device ID (st_dev, see stat() S5.6.2 [POSIX.1]) */ PLAN * -c_xdev(void) +c_xdev(char *ignore, char ***ignored, int unused) { ftsoptions |= FTS_XDEV; @@ -1439,15 +1454,15 @@ f_expr(plan, entry) * to a N_EXPR node containing the expression and the ')' node is discarded. */ PLAN * -c_openparen(void) +c_openparen(char *ignore, char ***ignored, int unused) { - return (palloc(N_OPENPAREN, (int (*)())-1)); + return (palloc(N_OPENPAREN, (int (*)(PLAN *, FTSENT *))-1)); } PLAN * -c_closeparen(void) +c_closeparen(char *ignore, char ***ignored, int unused) { - return (palloc(N_CLOSEPAREN, (int (*)())-1)); + return (palloc(N_CLOSEPAREN, (int (*)(PLAN *, FTSENT *))-1)); } /* @@ -1469,7 +1484,7 @@ f_not(plan, entry) } PLAN * -c_not(void) +c_not(char *ignore, char ***ignored, int unused) { return (palloc(N_NOT, f_not)); } @@ -1500,15 +1515,13 @@ f_or(plan, entry) } PLAN * -c_or(void) +c_or(char *ignore, char ***ignored, int unused) { return (palloc(N_OR, f_or)); } static PLAN * -palloc(t, f) - enum ntype t; - int (*f)(PLAN *, FTSENT *); +palloc(enum ntype t, int (*f)(PLAN *, FTSENT *)) { PLAN *new; diff --git a/usr.bin/find/ls.c b/usr.bin/find/ls.c index 1406c6cbc43..9ada82bd191 100644 --- a/usr.bin/find/ls.c +++ b/usr.bin/find/ls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ls.c,v 1.10 2003/06/03 02:56:08 millert Exp $ */ +/* $OpenBSD: ls.c,v 1.11 2003/06/26 07:27:29 deraadt Exp $ */ /* * Copyright (c) 1989, 1993 @@ -31,7 +31,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)ls.c 8.1 (Berkeley) 6/6/93";*/ -static char rcsid[] = "$OpenBSD: ls.c,v 1.10 2003/06/03 02:56:08 millert Exp $"; +static char rcsid[] = "$OpenBSD: ls.c,v 1.11 2003/06/26 07:27:29 deraadt Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -45,6 +45,8 @@ static char rcsid[] = "$OpenBSD: ls.c,v 1.10 2003/06/03 02:56:08 millert Exp $"; #include <tzfile.h> #include <unistd.h> #include <utmp.h> +#include <pwd.h> +#include <grp.h> /* Derived from the print routines in the ls(1) source code. */ @@ -54,12 +56,9 @@ static void printtime(time_t); #define NAME_WIDTH 8 void -printlong(name, accpath, sb) - char *name; /* filename to print */ - char *accpath; /* current valid path to filename */ - struct stat *sb; /* stat buffer */ +printlong(char *name, char *accpath, struct stat *sb) { - char modep[15], *user_from_uid(), *group_from_gid(); + char modep[15]; (void)printf("%6u %4lld ", sb->st_ino, (long long)sb->st_blocks); (void)strmode(sb->st_mode, modep); @@ -80,8 +79,7 @@ printlong(name, accpath, sb) } static void -printtime(ftime) - time_t ftime; +printtime(time_t ftime) { int i; char *longstring; @@ -103,8 +101,7 @@ printtime(ftime) } static void -printlink(name) - char *name; +printlink(char *name) { int lnklen; char path[MAXPATHLEN]; diff --git a/usr.bin/find/misc.c b/usr.bin/find/misc.c index db0fd3bb77b..ad343b56e18 100644 --- a/usr.bin/find/misc.c +++ b/usr.bin/find/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.8 2003/06/03 02:56:08 millert Exp $ */ +/* $OpenBSD: misc.c,v 1.9 2003/06/26 07:27:29 deraadt Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -34,11 +34,12 @@ #ifndef lint /*static char sccsid[] = "from: @(#)misc.c 8.1 (Berkeley) 6/6/93";*/ -static char rcsid[] = "$OpenBSD: misc.c,v 1.8 2003/06/03 02:56:08 millert Exp $"; +static char rcsid[] = "$OpenBSD: misc.c,v 1.9 2003/06/26 07:27:29 deraadt Exp $"; #endif /* not lint */ #include <sys/types.h> #include <sys/stat.h> +#include <sys/uio.h> #include <err.h> #include <errno.h> @@ -55,9 +56,7 @@ static char rcsid[] = "$OpenBSD: misc.c,v 1.8 2003/06/03 02:56:08 millert Exp $" * Replace occurrences of {} in s1 with s2 and return the result string. */ void -brace_subst(orig, store, path, len) - char *orig, **store, *path; - int len; +brace_subst(char *orig, char **store, char *path, int len) { int plen; char ch, *p; @@ -82,8 +81,7 @@ brace_subst(orig, store, path, len) * input. If the input is 'y' then 1 is returned. */ int -queryuser(argv) - char **argv; +queryuser(char **argv) { int ch, first, nl; @@ -116,8 +114,7 @@ queryuser(argv) * malloc with error checking. */ void * -emalloc(len) - u_int len; +emalloc(u_int len) { void *p; @@ -132,16 +129,20 @@ emalloc(len) */ /* ARGSUSED */ void -show_path(sig) - int sig; +show_path(int signo) { int save_errno = errno; extern FTSENT *entry; + struct iovec iov[3]; if (entry != NULL) { - write(STDERR_FILENO, "find path: ", 11); - write(STDERR_FILENO, entry->fts_path, entry->fts_pathlen); - write(STDERR_FILENO, "\n", 1); + iov[0].iov_base = "find path: "; + iov[0].iov_len = strlen(iov[0].iov_base); + iov[1].iov_base = entry->fts_path; + iov[1].iov_len = entry->fts_pathlen; + iov[2].iov_base = "\n"; + iov[2].iov_len = strlen(iov[2].iov_base); + writev(STDERR_FILENO, iov, 3); errno = save_errno; } } diff --git a/usr.bin/find/operator.c b/usr.bin/find/operator.c index 28fe6a57aae..2c977292c5d 100644 --- a/usr.bin/find/operator.c +++ b/usr.bin/find/operator.c @@ -1,4 +1,4 @@ -/* $OpenBSD: operator.c,v 1.7 2003/06/03 02:56:08 millert Exp $ */ +/* $OpenBSD: operator.c,v 1.8 2003/06/26 07:27:29 deraadt Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -34,7 +34,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)operator.c 8.1 (Berkeley) 6/6/93";*/ -static char rcsid[] = "$OpenBSD: operator.c,v 1.7 2003/06/03 02:56:08 millert Exp $"; +static char rcsid[] = "$OpenBSD: operator.c,v 1.8 2003/06/26 07:27:29 deraadt Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -45,14 +45,14 @@ static char rcsid[] = "$OpenBSD: operator.c,v 1.7 2003/06/03 02:56:08 millert Ex #include <stdio.h> #include "find.h" +#include "extern.h" /* * yanknode -- * destructively removes the top from the plan */ static PLAN * -yanknode(planp) - PLAN **planp; /* pointer to top of plan (modified) */ +yanknode(PLAN **planp) /* pointer to top of plan (modified) */ { PLAN *node; /* top node removed from the plan */ @@ -70,14 +70,13 @@ yanknode(planp) * simple node or a N_EXPR node containing a list of simple nodes. */ static PLAN * -yankexpr(planp) - PLAN **planp; /* pointer to top of plan (modified) */ +yankexpr(PLAN **planp) /* pointer to top of plan (modified) */ { PLAN *next; /* temp node holding subexpression results */ PLAN *node; /* pointer to returned node or expression */ PLAN *tail; /* pointer to tail of subplan */ PLAN *subplan; /* pointer to head of ( ) expression */ - int f_expr(); + extern int f_expr(PLAN *, FTSENT *); /* first pull the top node from the plan */ if ((node = yanknode(planp)) == NULL) @@ -125,8 +124,7 @@ yankexpr(planp) * replaces "parentheisized" plans in our search plan with "expr" nodes. */ PLAN * -paren_squish(plan) - PLAN *plan; /* plan with ( ) nodes */ +paren_squish(PLAN *plan) /* plan with ( ) nodes */ { PLAN *expr; /* pointer to next expression */ PLAN *tail; /* pointer to tail of result plan */ @@ -163,8 +161,7 @@ paren_squish(plan) * compresses "!" expressions in our search plan. */ PLAN * -not_squish(plan) - PLAN *plan; /* plan to process */ +not_squish(PLAN *plan) /* plan to process */ { PLAN *next; /* next node being processed */ PLAN *node; /* temporary node used in N_NOT processing */ @@ -223,8 +220,7 @@ not_squish(plan) * compresses -o expressions in our search plan. */ PLAN * -or_squish(plan) - PLAN *plan; /* plan with ors to be squished */ +or_squish(PLAN *plan) /* plan with ors to be squished */ { PLAN *next; /* next node being processed */ PLAN *tail; /* pointer to tail of result plan */ diff --git a/usr.bin/find/option.c b/usr.bin/find/option.c index 86580203e7a..d8f6a515a50 100644 --- a/usr.bin/find/option.c +++ b/usr.bin/find/option.c @@ -1,4 +1,4 @@ -/* $OpenBSD: option.c,v 1.15 2003/06/03 02:56:08 millert Exp $ */ +/* $OpenBSD: option.c,v 1.16 2003/06/26 07:27:29 deraadt Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -34,7 +34,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)option.c 8.1 (Berkeley) 6/6/93";*/ -static char rcsid[] = "$OpenBSD: option.c,v 1.15 2003/06/03 02:56:08 millert Exp $"; +static char rcsid[] = "$OpenBSD: option.c,v 1.16 2003/06/26 07:27:29 deraadt Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -47,6 +47,7 @@ static char rcsid[] = "$OpenBSD: option.c,v 1.15 2003/06/03 02:56:08 millert Exp #include <string.h> #include "find.h" +#include "extern.h" /* NB: the following table must be sorted lexically. */ static OPTION options[] = { @@ -105,8 +106,7 @@ static OPTION options[] = { * this switch stuff. */ PLAN * -find_create(argvp) - char ***argvp; +find_create(char ***argvp) { OPTION *p; PLAN *new; @@ -125,13 +125,13 @@ find_create(argvp) new = NULL; break; case O_ZERO: - new = (p->create)(); + new = (p->create)(NULL, NULL, 0); break; case O_ARGV: - new = (p->create)(*argv++); + new = (p->create)(*argv++, NULL, 0); break; case O_ARGVP: - new = (p->create)(&argv, p->token == N_OK); + new = (p->create)(NULL, &argv, p->token == N_OK); break; default: abort(); @@ -141,8 +141,7 @@ find_create(argvp) } OPTION * -option(name) - char *name; +option(char *name) { OPTION tmp; int typecompare(const void *, const void *); @@ -153,8 +152,7 @@ option(name) } int -typecompare(a, b) - const void *a, *b; +typecompare(const void *a, const void *b) { return (strcmp(((OPTION *)a)->name, ((OPTION *)b)->name)); } |