Commit | Line | Data |
---|---|---|
c9e9f9fb 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 | |
9 | static char sccsid[] = "@(#)oldsyntax.c 5.1 (Berkeley) %G%"; | |
10 | #endif /* not lint */ | |
11 | ||
12 | #include <stdio.h> | |
13 | ||
14 | /* | |
15 | * oldsyntax -- | |
16 | * move the path names to the beginning of the argv array, and return | |
17 | * a pointer to them. The old find syntax assumes all command arguments | |
18 | * up to the first one beginning with a '-', '(' or '!' are pathnames. | |
19 | */ | |
20 | char ** | |
21 | oldsyntax(argvp) | |
22 | char ***argvp; | |
23 | { | |
24 | register char **argv; | |
25 | ||
26 | /* | |
27 | * find first '-', '(' or '!' to delimit paths; if no paths, it's | |
28 | * an error. Shift the array back one at the same time, creating | |
29 | * a separate array of pathnames. | |
30 | */ | |
31 | for (argv = *argvp + 1;; ++argv) { | |
32 | argv[-1] = argv[0]; | |
33 | if (!*argv || **argv == '-' || **argv == '!' || **argv == '(') | |
34 | break; | |
35 | } | |
36 | ||
37 | if (argv == *argvp + 1) | |
38 | usage(); | |
39 | ||
40 | argv[-1] = NULL; | |
41 | *argvp = argv; /* move argv value */ | |
42 | } |