chiark / gitweb /
Expunge revision histories in files.
[cfd] / mklinks.in
1 #! /bin/sh
2
3 # -*-sh-*-
4 #
5 # $Id: mklinks.in,v 1.4 1997/09/11 09:06:34 mdw Exp $
6 #
7 # Create links to the repository
8 #
9 # (c) 1997 Mark Wooding
10 #
11
12 #----- Licensing notice -----------------------------------------------------
13 #
14 # This file is part of the Common Files Distribution (`common').
15 #
16 # `Common' is free software; you can redistribute it and/or modify
17 # it under the terms of the GNU General Public License as published by
18 # the Free Software Foundation; either version 2 of the License, or
19 # (at your option) any later version.
20 #
21 # `Common' is distributed in the hope that it will be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24 # GNU General Public License for more details.
25 #
26 # You should have received a copy of the GNU General Public License
27 # along with `common'; if not, write to the Free Software Foundation,
28 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29
30 # --- Configuration variables ---
31
32 prefix=@prefix@
33 datadir=@datadir@/@PACKAGE@
34
35 # --- Parse command line arguments ---
36
37 while [ $# -gt 0 ]; do
38   case $1 in
39     -h | --h | --he | --hel | --help)
40       cat <<EOF
41 Usage: mklinks [FILE...]
42
43 The FILEs listed are themselves lists of filenames.  Makes each named file a
44 link to the corresponding file in the shared files repository.  With no
45 arguments, \`mklinks' reads \`.links' from the current directory.
46 EOF
47       exit 0
48       ;;
49     -v | --v | --ve | --ver | --vers | --versi | --versio | --version)
50       version=`echo '$Revision: 1.4 $' |
51         sed -n -e 's;^.*: \([0-9.]*\) *\\$;\1;p'`
52       echo "mklinks $version; Common Files Distribution version @VERSION@"
53       exit 0
54       ;;
55     --)
56       shift
57       break
58       ;;
59     -)
60       break
61       ;;
62     -*)
63       echo "mklinks: unknown option \`$1'" >&2
64       exit 1
65       ;;
66     *)
67       break
68       ;;
69   esac
70   shift
71 done  
72
73 # --- Main code ---
74 #
75 # This is really trivial.
76
77 [ $# = 0 ] && set .links
78 cat "$@" | while read name; do
79   base="`echo $name | sed -e 's;^.*/;;'`"
80   [ -r "$datadir/$base" ] && ln -sf "$datadir/$base" "$name"
81 done