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