X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/cfbbfaf24c592b5247c976e310dcbf48a9173a7c..9dd52de3fb4cfab4a8536c531f9590a5d1f96253:/usr/src/usr.bin/find/find.c diff --git a/usr/src/usr.bin/find/find.c b/usr/src/usr.bin/find/find.c index bab9e65af2..36f0de64f1 100644 --- a/usr/src/usr.bin/find/find.c +++ b/usr/src/usr.bin/find/find.c @@ -15,7 +15,7 @@ char copyright[] = #endif /* not lint */ #ifndef lint -static char sccsid[] = "@(#)find.c 4.30 (Berkeley) %G%"; +static char sccsid[] = "@(#)find.c 4.33 (Berkeley) %G%"; #endif /* not lint */ #include @@ -51,16 +51,22 @@ main(argc, argv) ftsoptions = FTS_NOSTAT|FTS_PHYSICAL; /* - * if arguments start with an option, it's new syntax; otherwise, - * if has a "-option" anywhere it must be old syntax. + * if arguments start with an option, treat it like new syntax; + * otherwise, if has a "-option" anywhere (which isn't an argument + * to another command) treat it as old syntax. */ if (argv[1][0] != '-') - for (p = argv + 1; *p; ++p) + for (p = argv + 1; *p; ++p) { + if (!strcmp(*p, "exec") || !strcmp(*p, "ok")) { + while (p[1] && strcmp(*++p, ";")); + continue; + } if (**p == '-') { deprecated = 1; oldsyntax(&argv); break; } + } if (!deprecated) newsyntax(argc, &argv); @@ -98,7 +104,8 @@ find_formplan(argv) * plan->next pointer. */ for (plan = NULL; *argv;) { - new = find_create(&argv); + if (!(new = find_create(&argv))) + continue; if (plan == NULL) tail = plan = new; else { @@ -194,6 +201,7 @@ find_execute(plan, paths) case FTS_DP: if (!depth) continue; + break; case FTS_NS: if (!(ftsoptions & FTS_NOSTAT)) { (void)fprintf(stderr,