xref: /original-bsd/usr.sbin/amd/config/newvers.sh (revision 703f6d5d)
1#!/bin/sh -
2#
3# Copyright (c) 1989 Jan-Simon Pendry
4# Copyright (c) 1989 Imperial College of Science, Technology & Medicine
5# Copyright (c) 1989 The Regents of the University of California.
6# All Rights Reserved.
7#
8# This code is derived from software contributed to Berkeley by
9# Jan-Simon Pendry at Imperial College, London.
10#
11# %sccs.include.redist.sh%
12#
13#	@(#)newvers.sh	5.4 (Berkeley) 05/12/91
14#
15# $Id: newvers.sh,v 5.2.1.4 91/05/07 22:20:29 jsp Alpha $
16#
17PATH=/usr/ucb:/bin:/usr/bin:$PATH
18if [ $# -ne 3 ]; then echo "Usage: newvers program arch os" >&2; exit 1; fi
19version="version.$1"
20if [ ! -r $version ]; then echo 0 > $version; chmod 444 $version; fi
21v=`cat $version`
22u=${USER-${LOGNAME-root}}
23h=`hostname`
24#h=`expr "$h" : '\([^.]*\)'`
25t=`date`
26if [ ! -s "$d../config/RELEASE"  -o ! -s "$d../text/COPYRIGHT" ]; then
27	echo ERROR: config file missing >&2
28	exit 1
29fi
30rm -f vers.$1.c
31(
32cat << %%
33char copyright[] = "\\
34%%
35sed 's/$/\\n\\/' $d../text/COPYRIGHT
36cat << %%
37";
38char version[] = "\\
39%%
40cat << %%
41$1 \\
42%%
43sed \
44	-e 's/\$//g' \
45	-e 's/[A-Z][a-z]*://g' \
46	-e 's/  */ /g' \
47	-e 's/^ //' \
48	-e 's/$/\\/' \
49	$d../config/RELEASE
50cat << %%
51 #${v}: ${t}\\n\\
52Built by ${u}@${h} for \\
53%%
54case "$2" in
55[aeiou]*) echo "an \\" ;;
56*) echo "a \\";;
57esac
58echo "$2 running $3\";"
59) > vers.$1.c
60rm -f $version
61expr ${v} + 1 > $version
62chmod 444 $version
63