- /* Parse any options */
- while (**argv == '-') {
- int stopit=FALSE;
- while (*++(*argv) && stopit==FALSE) switch (**argv) {
- case 'f':
- if (strcmp(*argv, "follow")==0) {
- argc--;
- argv++;
- dereferenceFlag=TRUE;
- }
- break;
- case 'n':
- if (strcmp(*argv, "name")==0) {
- if (argc-- > 1) {
- pattern=*(++argv);
- stopit=-TRUE;
- } else {
- fprintf(stderr, "Usage: %s\n", find_usage);
- exit( FALSE);
- }
- }
- break;
- case '-':
- /* Ignore all long options */
- break;
- default:
- fprintf(stderr, "Usage: %s\n", find_usage);
- exit( FALSE);
+ if (argc > 0 && **argv != '-') {
+ directory = *argv;
+ argc--;
+ argv++;
+ }
+
+ /* Parse any options */
+ while (argc > 0 && **argv == '-') {
+ int stopit = FALSE;
+
+ while (*++(*argv) && stopit == FALSE)
+ switch (**argv) {
+ case 'f':
+ if (strcmp(*argv, "follow") == 0) {
+ argc--;
+ argv++;
+ dereferenceFlag = TRUE;
+ }
+ break;
+ case 'n':
+ if (strcmp(*argv, "name") == 0) {
+ if (argc-- > 1) {
+ pattern = *(++argv);
+ stopit = TRUE;
+ } else {
+ usage(find_usage);
+ }
+ }
+ break;
+ case '-':
+ /* Ignore all long options */
+ break;
+ default:
+ usage(find_usage);
+ }
+ if (argc-- > 1)
+ argv++;
+ if (**argv != '-')
+ break;
+ else
+ break;
+ }
+
+ if (recursiveAction(directory, TRUE, FALSE, FALSE,
+ fileAction, fileAction, NULL) == FALSE) {
+ exit(FALSE);