Typo
[s-roff.git] / gendef.sh
blob0db4fc1f0f13ddd9302d8e97386b01dfc016d211
1 #! /bin/sh
3 # Copyright (C) 1991, 2000
4 # Free Software Foundation, Inc.
5 #
6 # This file is part of groff.
7 #
8 # groff is free software; you can redistribute it and/or modify it under
9 # the terms of the GNU General Public License as published by the Free
10 # Software Foundation; either version 2, or (at your option) any later
11 # version.
13 # groff is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 # for more details.
18 # You should have received a copy of the GNU General Public License along
19 # with groff; see the file COPYING. If not, write to the Free Software
20 # Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA.
23 # gendef filename var=val var=val ...
25 # This script is used to generate src/include/defs.h.
27 file=$1
28 shift
30 defs="#define $1"
31 shift
32 for def
34 defs="$defs
35 #define $def"
36 done
38 # Use $TMPDIR if defined. Default to cwd, for non-Unix systems
39 # which don't have /tmp on each drive (we are going to remove
40 # the file before we exit anyway). Put the PID in the basename,
41 # since the extension can only hold 3 characters on MS-DOS.
42 t=${TMPDIR-.}/gro$$.tmp
44 sed -e 's/=/ /' >$t <<EOF
45 $defs
46 EOF
48 test -r $file && cmp -s $t $file || cp $t $file
50 rm -f $t
52 exit 0
54 # eof