Merge branch 'master' of ssh://opencfd@repo.or.cz/srv/git/OpenFOAM-1.6.x
[OpenFOAM-1.6.x.git] / bin / finddep
blob0d16d4e335291982c28a8dcc986536ece4dd2844
1 #!/bin/sh
2 #------------------------------------------------------------------------------
3 # ========= |
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / O peration |
6 # \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 # \\/ M anipulation |
8 #-------------------------------------------------------------------------------
9 # License
10 # This file is part of OpenFOAM.
12 # OpenFOAM is free software; you can redistribute it and/or modify it
13 # under the terms of the GNU General Public License as published by the
14 # Free Software Foundation; either version 2 of the License, or (at your
15 # option) any later version.
17 # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
18 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 # for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with OpenFOAM; if not, write to the Free Software Foundation,
24 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 # Script
27 # finddep
29 # Description
30 # find all .dep files referring to any of <file1> ... <fileN>
32 #------------------------------------------------------------------------------
33 usage() {
34 while [ "$#" -ge 1 ]; do echo "$1"; shift; done
35 cat<<USAGE
37 usage: ${0##*/} <file1> ... <fileN>
39 * find all .dep files referring to any of <file1> ... <fileN>
41 USAGE
42 exit 1
46 # parse options
47 while [ "$#" -gt 0 ]
49 case "$1" in
50 -h | -help)
51 usage
53 -*)
54 usage "unknown option: '$*'"
57 break
59 esac
60 done
62 [ "$#" -gt 0 ] || usage
65 find . -name '*.dep' -print | \
66 while read src
68 for file in $@
70 grep -l "$file" $src && break
71 done
72 done
74 #------------------------------------------------------------------------------