mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-02 12:20:51 +00:00
1) Remove -Wall from Makefile.
2) WARNs fixes (rename option to lookup_option to avoid shadowing, rename argv to argv1 to avoid shadowing, const stuff, prototypes, __unused). 3) Remove "register"s.
This commit is contained in:
parent
2081ddd6d9
commit
e98080b1e6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=91400
@ -1,7 +1,6 @@
|
||||
# @(#)Makefile 8.1 (Berkeley) 6/6/93
|
||||
# $FreeBSD$
|
||||
|
||||
CFLAGS+= -Wall
|
||||
PROG= find
|
||||
SRCS= find.c function.c ls.c main.c misc.c operator.c option.c getdate.y
|
||||
CLEANFILES+= getdate.c y.tab.h
|
||||
|
@ -46,7 +46,7 @@ PLAN *paren_squish __P((PLAN *));
|
||||
struct stat;
|
||||
void printlong __P((char *, char *, struct stat *));
|
||||
int queryuser __P((char **));
|
||||
OPTION *option __P((char *));
|
||||
OPTION *lookup_option __P((const char *));
|
||||
|
||||
creat_f c_Xmin;
|
||||
creat_f c_Xtime;
|
||||
|
@ -117,23 +117,23 @@ find_formplan(argv)
|
||||
*/
|
||||
if (!isoutput) {
|
||||
OPTION *p;
|
||||
char **argv = 0;
|
||||
char **argv1 = 0;
|
||||
|
||||
if (plan == NULL) {
|
||||
p = option("-print");
|
||||
new = (p->create)(p, &argv);
|
||||
p = lookup_option("-print");
|
||||
new = (p->create)(p, &argv1);
|
||||
tail = plan = new;
|
||||
} else {
|
||||
p = option("(");
|
||||
new = (p->create)(p, &argv);
|
||||
p = lookup_option("(");
|
||||
new = (p->create)(p, &argv1);
|
||||
new->next = plan;
|
||||
plan = new;
|
||||
p = option(")");
|
||||
new = (p->create)(p, &argv);
|
||||
p = lookup_option(")");
|
||||
new = (p->create)(p, &argv1);
|
||||
tail->next = new;
|
||||
tail = new;
|
||||
p = option("-print");
|
||||
new = (p->create)(p, &argv);
|
||||
p = lookup_option("-print");
|
||||
new = (p->create)(p, &argv1);
|
||||
tail->next = new;
|
||||
tail = new;
|
||||
}
|
||||
@ -180,7 +180,7 @@ find_execute(plan, paths)
|
||||
PLAN *plan; /* search plan */
|
||||
char **paths; /* array of pathnames to traverse */
|
||||
{
|
||||
register FTSENT *entry;
|
||||
FTSENT *entry;
|
||||
PLAN *p;
|
||||
int rval;
|
||||
|
||||
|
@ -119,7 +119,7 @@ typedef struct _plandata {
|
||||
#define e_len p_un.ex._e_len
|
||||
|
||||
typedef struct _option {
|
||||
char *name; /* option name */
|
||||
const char *name; /* option name */
|
||||
creat_f *create; /* create function */
|
||||
exec_f *execute; /* execute function */
|
||||
int flags;
|
||||
|
@ -65,7 +65,11 @@ static const char rcsid[] =
|
||||
|
||||
#include "find.h"
|
||||
|
||||
time_t get_date __P((char *date, struct timeb *now));
|
||||
static PLAN *palloc __P((OPTION *));
|
||||
static long long find_parsenum __P((PLAN *, const char *, char *, char *));
|
||||
static long long find_parsetime __P((PLAN *, const char *, char *));
|
||||
static char *nextarg __P((OPTION *, char ***));
|
||||
time_t get_date __P((char *, struct timeb *));
|
||||
|
||||
#define COMPARE(a, b) do { \
|
||||
switch (plan->flags & F_ELG_MASK) { \
|
||||
@ -101,7 +105,8 @@ palloc(option)
|
||||
static long long
|
||||
find_parsenum(plan, option, vp, endch)
|
||||
PLAN *plan;
|
||||
char *option, *vp, *endch;
|
||||
const char *option;
|
||||
char *vp, *endch;
|
||||
{
|
||||
long long value;
|
||||
char *endchar, *str; /* Pointer to character ending conversion. */
|
||||
@ -144,7 +149,8 @@ find_parsenum(plan, option, vp, endch)
|
||||
static long long
|
||||
find_parsetime(plan, option, vp)
|
||||
PLAN *plan;
|
||||
char *option, *vp;
|
||||
const char *option;
|
||||
char *vp;
|
||||
{
|
||||
long long secs, value;
|
||||
char *str, *unit; /* Pointer to character ending conversion. */
|
||||
@ -372,7 +378,7 @@ c_mXXdepth(option, argvp)
|
||||
*/
|
||||
int
|
||||
f_delete(plan, entry)
|
||||
PLAN *plan;
|
||||
PLAN *plan __unused;
|
||||
FTSENT *entry;
|
||||
{
|
||||
/* ignore these from fts */
|
||||
@ -415,7 +421,7 @@ f_delete(plan, entry)
|
||||
PLAN *
|
||||
c_delete(option, argvp)
|
||||
OPTION *option;
|
||||
char ***argvp;
|
||||
char ***argvp __unused;
|
||||
{
|
||||
|
||||
ftsoptions &= ~FTS_NOSTAT; /* no optimise */
|
||||
@ -437,8 +443,8 @@ c_delete(option, argvp)
|
||||
*/
|
||||
int
|
||||
f_always_true(plan, entry)
|
||||
PLAN *plan;
|
||||
FTSENT *entry;
|
||||
PLAN *plan __unused;
|
||||
FTSENT *entry __unused;
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@ -446,7 +452,7 @@ f_always_true(plan, entry)
|
||||
PLAN *
|
||||
c_depth(option, argvp)
|
||||
OPTION *option;
|
||||
char ***argvp;
|
||||
char ***argvp __unused;
|
||||
{
|
||||
isdepth = 1;
|
||||
|
||||
@ -460,7 +466,7 @@ c_depth(option, argvp)
|
||||
*/
|
||||
int
|
||||
f_empty(plan, entry)
|
||||
PLAN *plan;
|
||||
PLAN *plan __unused;
|
||||
FTSENT *entry;
|
||||
{
|
||||
if (S_ISREG(entry->fts_statp->st_mode) &&
|
||||
@ -491,7 +497,7 @@ f_empty(plan, entry)
|
||||
PLAN *
|
||||
c_empty(option, argvp)
|
||||
OPTION *option;
|
||||
char ***argvp;
|
||||
char ***argvp __unused;
|
||||
{
|
||||
ftsoptions &= ~FTS_NOSTAT;
|
||||
|
||||
@ -515,11 +521,11 @@ c_empty(option, argvp)
|
||||
*/
|
||||
int
|
||||
f_exec(plan, entry)
|
||||
register PLAN *plan;
|
||||
PLAN *plan;
|
||||
FTSENT *entry;
|
||||
{
|
||||
extern int dotfd;
|
||||
register int cnt;
|
||||
int cnt;
|
||||
pid_t pid;
|
||||
int status;
|
||||
char *file;
|
||||
@ -574,8 +580,8 @@ c_exec(option, argvp)
|
||||
char ***argvp;
|
||||
{
|
||||
PLAN *new; /* node returned */
|
||||
register int cnt;
|
||||
register char **argv, **ap, *p;
|
||||
int cnt;
|
||||
char **argv, **ap, *p;
|
||||
|
||||
/* XXX - was in c_execdir, but seems unnecessary!?
|
||||
ftsoptions &= ~FTS_NOSTAT;
|
||||
@ -679,7 +685,7 @@ c_flags(option, argvp)
|
||||
PLAN *
|
||||
c_follow(option, argvp)
|
||||
OPTION *option;
|
||||
char ***argvp;
|
||||
char ***argvp __unused;
|
||||
{
|
||||
ftsoptions &= ~FTS_PHYSICAL;
|
||||
ftsoptions |= FTS_LOGICAL;
|
||||
@ -761,7 +767,7 @@ c_fstype(option, argvp)
|
||||
char ***argvp;
|
||||
{
|
||||
char *fsname;
|
||||
register PLAN *new;
|
||||
PLAN *new;
|
||||
struct vfsconf vfc;
|
||||
|
||||
fsname = nextarg(option, argvp);
|
||||
@ -911,7 +917,7 @@ c_links(option, argvp)
|
||||
*/
|
||||
int
|
||||
f_ls(plan, entry)
|
||||
PLAN *plan;
|
||||
PLAN *plan __unused;
|
||||
FTSENT *entry;
|
||||
{
|
||||
printlong(entry->fts_path, entry->fts_accpath, entry->fts_statp);
|
||||
@ -921,7 +927,7 @@ f_ls(plan, entry)
|
||||
PLAN *
|
||||
c_ls(option, argvp)
|
||||
OPTION *option;
|
||||
char ***argvp;
|
||||
char ***argvp __unused;
|
||||
{
|
||||
ftsoptions &= ~FTS_NOSTAT;
|
||||
isoutput = 1;
|
||||
@ -1017,7 +1023,7 @@ c_newer(option, argvp)
|
||||
*/
|
||||
int
|
||||
f_nogroup(plan, entry)
|
||||
PLAN *plan;
|
||||
PLAN *plan __unused;
|
||||
FTSENT *entry;
|
||||
{
|
||||
return group_from_gid(entry->fts_statp->st_gid, 1) == NULL;
|
||||
@ -1026,7 +1032,7 @@ f_nogroup(plan, entry)
|
||||
PLAN *
|
||||
c_nogroup(option, argvp)
|
||||
OPTION *option;
|
||||
char ***argvp;
|
||||
char ***argvp __unused;
|
||||
{
|
||||
ftsoptions &= ~FTS_NOSTAT;
|
||||
|
||||
@ -1041,7 +1047,7 @@ c_nogroup(option, argvp)
|
||||
*/
|
||||
int
|
||||
f_nouser(plan, entry)
|
||||
PLAN *plan;
|
||||
PLAN *plan __unused;
|
||||
FTSENT *entry;
|
||||
{
|
||||
return user_from_uid(entry->fts_statp->st_uid, 1) == NULL;
|
||||
@ -1050,7 +1056,7 @@ f_nouser(plan, entry)
|
||||
PLAN *
|
||||
c_nouser(option, argvp)
|
||||
OPTION *option;
|
||||
char ***argvp;
|
||||
char ***argvp __unused;
|
||||
{
|
||||
ftsoptions &= ~FTS_NOSTAT;
|
||||
|
||||
@ -1137,7 +1143,7 @@ c_perm(option, argvp)
|
||||
*/
|
||||
int
|
||||
f_print(plan, entry)
|
||||
PLAN *plan;
|
||||
PLAN *plan __unused;
|
||||
FTSENT *entry;
|
||||
{
|
||||
(void)puts(entry->fts_path);
|
||||
@ -1147,7 +1153,7 @@ f_print(plan, entry)
|
||||
PLAN *
|
||||
c_print(option, argvp)
|
||||
OPTION *option;
|
||||
char ***argvp;
|
||||
char ***argvp __unused;
|
||||
{
|
||||
isoutput = 1;
|
||||
|
||||
@ -1162,7 +1168,7 @@ c_print(option, argvp)
|
||||
*/
|
||||
int
|
||||
f_print0(plan, entry)
|
||||
PLAN *plan;
|
||||
PLAN *plan __unused;
|
||||
FTSENT *entry;
|
||||
{
|
||||
fputs(entry->fts_path, stdout);
|
||||
@ -1179,7 +1185,7 @@ f_print0(plan, entry)
|
||||
*/
|
||||
int
|
||||
f_prune(plan, entry)
|
||||
PLAN *plan;
|
||||
PLAN *plan __unused;
|
||||
FTSENT *entry;
|
||||
{
|
||||
extern FTS *tree;
|
||||
@ -1267,7 +1273,7 @@ c_regex(option, argvp)
|
||||
PLAN *
|
||||
c_simple(option, argvp)
|
||||
OPTION *option;
|
||||
char ***argvp;
|
||||
char ***argvp __unused;
|
||||
{
|
||||
return palloc(option);
|
||||
}
|
||||
@ -1428,7 +1434,7 @@ c_user(option, argvp)
|
||||
PLAN *
|
||||
c_xdev(option, argvp)
|
||||
OPTION *option;
|
||||
char ***argvp;
|
||||
char ***argvp __unused;
|
||||
{
|
||||
ftsoptions |= FTS_XDEV;
|
||||
|
||||
@ -1445,8 +1451,8 @@ f_expr(plan, entry)
|
||||
PLAN *plan;
|
||||
FTSENT *entry;
|
||||
{
|
||||
register PLAN *p;
|
||||
register int state = 0;
|
||||
PLAN *p;
|
||||
int state = 0;
|
||||
|
||||
for (p = plan->p_data[0];
|
||||
p && (state = (p->execute)(p, entry)); p = p->next);
|
||||
@ -1462,16 +1468,16 @@ f_expr(plan, entry)
|
||||
|
||||
int
|
||||
f_openparen(plan, entry)
|
||||
PLAN *plan;
|
||||
FTSENT *entry;
|
||||
PLAN *plan __unused;
|
||||
FTSENT *entry __unused;
|
||||
{
|
||||
abort();
|
||||
}
|
||||
|
||||
int
|
||||
f_closeparen(plan, entry)
|
||||
PLAN *plan;
|
||||
FTSENT *entry;
|
||||
PLAN *plan __unused;
|
||||
FTSENT *entry __unused;
|
||||
{
|
||||
abort();
|
||||
}
|
||||
@ -1484,8 +1490,8 @@ f_closeparen(plan, entry)
|
||||
*/
|
||||
PLAN *
|
||||
c_and(option, argvp)
|
||||
OPTION *option;
|
||||
char ***argvp;
|
||||
OPTION *option __unused;
|
||||
char ***argvp __unused;
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@ -1500,8 +1506,8 @@ f_not(plan, entry)
|
||||
PLAN *plan;
|
||||
FTSENT *entry;
|
||||
{
|
||||
register PLAN *p;
|
||||
register int state = 0;
|
||||
PLAN *p;
|
||||
int state = 0;
|
||||
|
||||
for (p = plan->p_data[0];
|
||||
p && (state = (p->execute)(p, entry)); p = p->next);
|
||||
@ -1521,8 +1527,8 @@ f_or(plan, entry)
|
||||
PLAN *plan;
|
||||
FTSENT *entry;
|
||||
{
|
||||
register PLAN *p;
|
||||
register int state = 0;
|
||||
PLAN *p;
|
||||
int state = 0;
|
||||
|
||||
for (p = plan->p_data[0];
|
||||
p && (state = (p->execute)(p, entry)); p = p->next);
|
||||
|
@ -83,7 +83,7 @@ main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
register char **p, **start;
|
||||
char **p, **start;
|
||||
int Hflag, Lflag, ch;
|
||||
|
||||
(void)setlocale(LC_ALL, "");
|
||||
|
@ -64,8 +64,8 @@ brace_subst(orig, store, path, len)
|
||||
char *orig, **store, *path;
|
||||
int len;
|
||||
{
|
||||
register int plen;
|
||||
register char ch, *p;
|
||||
int plen;
|
||||
char ch, *p;
|
||||
|
||||
plen = strlen(path);
|
||||
for (p = *store; (ch = *orig) != '\0'; ++orig)
|
||||
@ -88,7 +88,7 @@ brace_subst(orig, store, path, len)
|
||||
*/
|
||||
int
|
||||
queryuser(argv)
|
||||
register char **argv;
|
||||
char **argv;
|
||||
{
|
||||
int ch, first, nl;
|
||||
|
||||
|
@ -51,6 +51,9 @@ static const char rcsid[] =
|
||||
|
||||
#include "find.h"
|
||||
|
||||
static PLAN *yanknode __P((PLAN **));
|
||||
static PLAN *yankexpr __P((PLAN **));
|
||||
|
||||
/*
|
||||
* yanknode --
|
||||
* destructively removes the top from the plan
|
||||
@ -78,7 +81,7 @@ static PLAN *
|
||||
yankexpr(planp)
|
||||
PLAN **planp; /* pointer to top of plan (modified) */
|
||||
{
|
||||
register PLAN *next; /* temp node holding subexpression results */
|
||||
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 */
|
||||
@ -131,8 +134,8 @@ PLAN *
|
||||
paren_squish(plan)
|
||||
PLAN *plan; /* plan with ( ) nodes */
|
||||
{
|
||||
register PLAN *expr; /* pointer to next expression */
|
||||
register PLAN *tail; /* pointer to tail of result plan */
|
||||
PLAN *expr; /* pointer to next expression */
|
||||
PLAN *tail; /* pointer to tail of result plan */
|
||||
PLAN *result; /* pointer to head of result plan */
|
||||
|
||||
result = tail = NULL;
|
||||
@ -169,9 +172,9 @@ PLAN *
|
||||
not_squish(plan)
|
||||
PLAN *plan; /* plan to process */
|
||||
{
|
||||
register PLAN *next; /* next node being processed */
|
||||
register PLAN *node; /* temporary node used in f_not processing */
|
||||
register PLAN *tail; /* pointer to tail of result plan */
|
||||
PLAN *next; /* next node being processed */
|
||||
PLAN *node; /* temporary node used in f_not processing */
|
||||
PLAN *tail; /* pointer to tail of result plan */
|
||||
PLAN *result; /* pointer to head of result plan */
|
||||
|
||||
tail = result = NULL;
|
||||
@ -233,8 +236,8 @@ PLAN *
|
||||
or_squish(plan)
|
||||
PLAN *plan; /* plan with ors to be squished */
|
||||
{
|
||||
register PLAN *next; /* next node being processed */
|
||||
register PLAN *tail; /* pointer to tail of result plan */
|
||||
PLAN *next; /* next node being processed */
|
||||
PLAN *tail; /* pointer to tail of result plan */
|
||||
PLAN *result; /* pointer to head of result plan */
|
||||
|
||||
tail = result = next = NULL;
|
||||
|
@ -54,6 +54,8 @@ static const char rcsid[] =
|
||||
|
||||
#include "find.h"
|
||||
|
||||
int typecompare __P((const void *, const void *));
|
||||
|
||||
/* NB: the following table must be sorted lexically. */
|
||||
static OPTION const options[] = {
|
||||
{ "!", c_simple, f_not, 0 },
|
||||
@ -137,13 +139,13 @@ PLAN *
|
||||
find_create(argvp)
|
||||
char ***argvp;
|
||||
{
|
||||
register OPTION *p;
|
||||
OPTION *p;
|
||||
PLAN *new;
|
||||
char **argv;
|
||||
|
||||
argv = *argvp;
|
||||
|
||||
if ((p = option(*argv)) == NULL)
|
||||
if ((p = lookup_option(*argv)) == NULL)
|
||||
errx(1, "%s: unknown option", *argv);
|
||||
++argv;
|
||||
|
||||
@ -153,11 +155,10 @@ find_create(argvp)
|
||||
}
|
||||
|
||||
OPTION *
|
||||
option(name)
|
||||
char *name;
|
||||
lookup_option(name)
|
||||
const char *name;
|
||||
{
|
||||
OPTION tmp;
|
||||
int typecompare __P((const void *, const void *));
|
||||
|
||||
tmp.name = name;
|
||||
return ((OPTION *)bsearch(&tmp, options,
|
||||
@ -168,5 +169,5 @@ int
|
||||
typecompare(a, b)
|
||||
const void *a, *b;
|
||||
{
|
||||
return (strcmp(((OPTION *)a)->name, ((OPTION *)b)->name));
|
||||
return (strcmp(((const OPTION *)a)->name, ((const OPTION *)b)->name));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user