xref: /csrg-svn/usr.bin/find/oldsyntax.c (revision 45608)
141779Sbostic /*-
241779Sbostic  * Copyright (c) 1990 The Regents of the University of California.
341779Sbostic  * All rights reserved.
441779Sbostic  *
541779Sbostic  * %sccs.include.redist.c%
641779Sbostic  */
741779Sbostic 
841779Sbostic #ifndef lint
9*45608Sbostic static char sccsid[] = "@(#)oldsyntax.c	5.2 (Berkeley) 11/15/90";
1041779Sbostic #endif /* not lint */
1141779Sbostic 
1241779Sbostic #include <stdio.h>
1341779Sbostic 
1441779Sbostic /*
1541779Sbostic  * oldsyntax --
1641779Sbostic  *	move the path names to the beginning of the argv array, and return
1741779Sbostic  *	a pointer to them.  The old find syntax assumes all command arguments
1841779Sbostic  *	up to the first one beginning with a '-', '(' or '!' are pathnames.
1941779Sbostic  */
20*45608Sbostic void
oldsyntax(argvp)2141779Sbostic oldsyntax(argvp)
2241779Sbostic 	char ***argvp;
2341779Sbostic {
2441779Sbostic 	register char **argv;
2541779Sbostic 
2641779Sbostic 	/*
2741779Sbostic 	 * find first '-', '(' or '!' to delimit paths; if no paths, it's
2841779Sbostic 	 * an error.  Shift the array back one at the same time, creating
2941779Sbostic 	 * a separate array of pathnames.
3041779Sbostic 	 */
3141779Sbostic 	for (argv = *argvp + 1;; ++argv) {
3241779Sbostic 		argv[-1] = argv[0];
3341779Sbostic 		if (!*argv || **argv == '-' || **argv == '!' || **argv == '(')
3441779Sbostic 			break;
3541779Sbostic 	}
3641779Sbostic 
3741779Sbostic 	if (argv == *argvp + 1)
3841779Sbostic 		usage();
3941779Sbostic 
4041779Sbostic 	argv[-1] = NULL;
4141779Sbostic 	*argvp = argv;			/* move argv value */
4241779Sbostic }
43