PageRenderTime 6ms CodeModel.GetById 2ms app.highlight 1ms RepoModel.GetById 2ms app.codeStats 0ms

/contrib/groff/gendef.sh

https://bitbucket.org/freebsd/freebsd-head/
Shell | 34 lines | 15 code | 8 blank | 11 comment | 3 complexity | 553ee23ed0d4971179895ad453a81050 MD5 | raw file
 1#
 2# gendef filename var=val var=val ...
 3#
 4# This script is used to generate src/include/defs.h
 5#
 6
 7file=$1
 8shift
 9
10defs="#define $1"
11shift
12for def
13do
14	defs="$defs
15#define $def"
16done
17
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.
22t=${TMPDIR-.}/gro$$.tmp
23
24sed -e 's/=/ /' >$t <<EOF
25$defs
26EOF
27
28test -r $file && cmp -s $t $file || cp $t $file
29
30rm -f $t
31
32exit 0
33
34# eof