bootstrap: remove dangling *.[ch] symlinks from lib
[pspp] / build-aux / vc-list-files
1 #!/bin/sh
2 # List version-controlled file names.
3
4 # Copyright (C) 2006-2008 Free Software Foundation, Inc.
5
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15
16 # You should have received a copy of the GNU General Public License
17 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
19
20 # List the specified version-controlled files.
21 # With no argument, list them all.  With a single DIRECTORY argument,
22 # list the version-controlled files in that directory.
23 # This script must be run solely from the top of a $srcdir build directory.
24
25 # If there's an argument, it must be a single, "."-relative directory name.
26 # cvsu is part of the cvsutils package: http://www.red-bean.com/cvsutils/
27
28 dir=
29 case $# in
30   0) ;;
31   1) dir=$1 ;;
32   *) echo "$0: too many arguments" 1>&2
33      echo "Usage: $0 [DIR]" 1>&2; exit 1;;
34 esac
35
36 test "x$dir" = x && dir=.
37
38 if test -d .git; then
39   exec git ls-files "$dir"
40 elif test -d .hg; then
41   exec hg locate "$dir/*"
42 elif test -d CVS; then
43   if test -x build-aux/cvsu; then
44     build-aux/cvsu --find --types=AFGM "$dir"
45   else
46     awk -F/ '{                          \
47         if (!$1 && $3 !~ /^-/) {        \
48           f=FILENAME;                   \
49           sub(/CVS\/Entries/, "", f);   \
50           print f $2;                   \
51         }}'                             \
52       $(find ${*-*} -name Entries -print) /dev/null;
53   fi
54 else
55   echo "$0: Failed to determine type of version control used in "`pwd` 1>&2
56   exit 1
57 fi