formatting
[s-roff.git] / gendef.sh
blob4853eef4757c02257155f7fdd5f1b9e5aec6812a
2 # gendef filename var=val var=val ...
4 # This script is used to generate src/include/defs.h
7 file=$1
8 shift
10 defs="#define $1"
11 shift
12 for def
14 defs="$defs
15 #define $def"
16 done
18 # Use $TMPDIR if defined. Default to cwd, for non-Unix systems
19 # which don't have /tmp on each drive (we are going to remove
20 # the file before we exit anyway). Put the PID in the basename,
21 # since the extension can only hold 3 characters on MS-DOS.
22 t=${TMPDIR-.}/gro$$.tmp
24 sed -e 's/=/ /' >$t <<EOF
25 $defs
26 EOF
28 test -r $file && cmp -s $t $file || cp $t $file
30 rm -f $t
32 exit 0
34 # eof