sigset.c -> sigsetops.c, add sigsetops man page
[unix-history] / usr / src / usr.bin / find / main.c
CommitLineData
f74e42f0
KB
1/*-
2 * Copyright (c) 1990 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * %sccs.include.redist.c%
6 */
7
8#ifndef lint
1292488d 9static char sccsid[] = "@(#)main.c 5.2 (Berkeley) %G%";
f74e42f0
KB
10#endif /* not lint */
11
12#include <sys/types.h>
13#include <sys/stat.h>
14#include <stdio.h>
15#include <fts.h>
16#include "find.h"
17
18newsyntax(argc, argvp)
19 int argc;
20 char ***argvp;
21{
22 extern char *optarg;
1292488d 23 extern int depth, optind;
f74e42f0
KB
24 int ch;
25 char **argv, **cur;
26
27 cur = argv = *argvp;
28 while ((ch = getopt(argc, argv, "df:sx")) != EOF)
29 switch(ch) {
30 case 'd':
31 depth = 1;
32 break;
33 case 'f':
34 *cur++ = optarg;
35 break;
36 case 's':
37 ftsoptions &= ~FTS_PHYSICAL;
38 ftsoptions |= FTS_LOGICAL;
39 break;
40 case 'x':
f74e42f0 41 ftsoptions &= ~FTS_NOSTAT;
1292488d 42 ftsoptions |= FTS_XDEV;
f74e42f0
KB
43 break;
44 case '?':
45 default:
46 usage();
47 }
48
49 *argvp += optind;
50 if (cur == argv) {
51 if (!**argvp)
52 usage();
53 *cur++ = **argvp;
54 ++*argvp;
55 }
56 *cur = NULL;
57}