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 9 static char sccsid[] = "@(#)main.c 5.2 (Berkeley) 05/22/90"; 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 18 newsyntax(argc, argvp) 19 int argc; 20 char ***argvp; 21 { 22 extern char *optarg; 23 extern int depth, optind; 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': 41 ftsoptions &= ~FTS_NOSTAT; 42 ftsoptions |= FTS_XDEV; 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 } 58