X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/beb54af10082dc588132b2c0d32e050028b72c78..78ed81a334dab56aa7a876792a473d67d4359c25:/usr.bin/find/main.c diff --git a/usr.bin/find/main.c b/usr.bin/find/main.c index 114e8ef08b..073a5f030d 100644 --- a/usr.bin/find/main.c +++ b/usr.bin/find/main.c @@ -1,6 +1,6 @@ /*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,17 +32,20 @@ */ #ifndef lint -static char sccsid[] = "@(#)main.c 5.9 (Berkeley) 5/24/91"; +static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; #endif /* not lint */ #include #include + +#include +#include #include -#include #include -#include #include #include +#include + #include "find.h" time_t now; /* time find was run */ @@ -53,29 +56,32 @@ int isdepth; /* do directories on post-order visit */ int isoutput; /* user specified output operator */ int isxargs; /* don't permit xargs delimiting chars */ -static void usage(); +static void usage __P((void)); +int main(argc, argv) int argc; - char **argv; + char *argv[]; { register char **p, **start; - PLAN *find_formplan(); int ch; (void)time(&now); /* initialize the time-of-day */ p = start = argv; ftsoptions = FTS_NOSTAT|FTS_PHYSICAL; - while ((ch = getopt(argc, argv, "df:sXx")) != EOF) + while ((ch = getopt(argc, argv, "Hdf:hXx")) != EOF) switch(ch) { + case 'H': + ftsoptions |= FTS_COMFOLLOW; + break; case 'd': isdepth = 1; break; case 'f': *p++ = optarg; break; - case 's': + case 'h': ftsoptions &= ~FTS_PHYSICAL; ftsoptions |= FTS_LOGICAL; break; @@ -83,7 +89,6 @@ main(argc, argv) isxargs = 1; break; case 'x': - ftsoptions &= ~FTS_NOSTAT; ftsoptions |= FTS_XDEV; break; case '?': @@ -106,15 +111,25 @@ main(argc, argv) *p = NULL; if ((dotfd = open(".", O_RDONLY, 0)) < 0) - err(".: %s", strerror(errno)); + err(1, ".:"); find_execute(find_formplan(argv), start); + exit(0); } static void usage() { (void)fprintf(stderr, - "usage: find [-dsXx] [-f file] [file ...] expression\n"); + "usage: find [-HdhXx] [-f file] [file ...] expression\n"); exit(1); } + + + + + + + + +