Fix compiler warning due to missing function prototype.
[svn.git] / tools / client-side / wcfind
blob3bd63cc9abd937981275baa93d39dfad59bc12cb
1 #!/bin/sh
3 # Copyright 2007 Max Bowsher
4 # Licensed under the terms Subversion ships under
6 # Runs the 'find' program, with arguments munged such that '.svn' or 'CVS'
7 # working copy administrative directories and their contents are ignored.
9 optspaths=
10 expropts=
11 exproptarg=
12 exprmain=
13 depth=
14 somethingseen=
15 phase=optspaths
16 print=-print
17 for option in "$@"; do
18 if [ "$phase" = "optspaths" ]; then
19 case $option in
20 -H|-L|-P) ;;
21 -*|"("*|")"*|,*|!*) phase=exprmain ;;
22 *) ;;
23 esac
25 if [ "$exproptarg" = "yes" ]; then
26 exproptarg=
27 phase=expropts
29 if [ "$phase" = "exprmain" ]; then
30 case $option in
31 -depth|-d) depth=yes ;;
32 -delete|-exec|-exec|-execdir|-execdir|-fls|-fprint|-fprint0 \
33 |-fprintf|-ok|-print|-okdir|-print0|-printf|-quit|-ls) print= ;;
34 esac
35 case $option in
36 -depth|-d|-noleaf|-mount|-xdev|-warn|-nowarn \
37 |-ignore_readdir_race|-noignore_readdir_race) phase=expropts ;;
38 -maxdepth|-mindepth|-regextype) phase=expropts; exproptarg=yes ;;
39 -follow|-daystart) ;;
40 *) somethingseen=yes
41 esac
43 eval "$phase=\"\$$phase \\\"$option\\\"\""
44 if [ "$phase" = "expropts" ]; then
45 phase=exprmain
47 done
49 if [ -z "$somethingseen" ]; then
50 exprmain="$exprmain -print"
51 print=
54 if [ "$depth" = "yes" ]; then
55 eval find $optspaths $expropts \
56 -regex \''.*/\.svn'\' -or -regex \''.*/\.svn/.*'\' \
57 -or -regex \''.*/CVS'\' -or -regex \''.*/CVS/.*'\' \
58 -or '\(' $exprmain '\)' $print
59 else
60 eval find $optspaths $expropts '\(' -name .svn -or -name CVS '\)' -prune \
61 -or '\(' $exprmain '\)' $print