minor (shell) KNF
This commit is contained in:
parent
c63d030651
commit
9741933ec5
@ -1,16 +1,19 @@
|
||||
# $NetBSD: mknative.common,v 1.1 2003/11/27 00:58:26 mrg Exp $
|
||||
# $NetBSD: mknative.common,v 1.2 2004/12/11 01:37:36 lukem Exp $
|
||||
#
|
||||
# from: NetBSD: mknative,v 1.12 2003/03/05 06:17:17 mrg Exp
|
||||
#
|
||||
# shell-fragment common to all "mknative" scripts
|
||||
|
||||
bomb () {
|
||||
echo >&1 "ABORT: $*"
|
||||
bomb()
|
||||
{
|
||||
echo >&2 "ABORT: $*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# usage: getvars MAKEFILE VARNAME [VARNAME...]
|
||||
getvars () {
|
||||
#
|
||||
getvars()
|
||||
{
|
||||
_mf="$1"; shift
|
||||
$MAKE -f - _x_ <<EOF || bomb "getvars $_mf $* failed"
|
||||
_x_:
|
||||
@ -22,7 +25,9 @@ EOF
|
||||
}
|
||||
|
||||
# usage: write_c FILENAME
|
||||
write_c () {
|
||||
#
|
||||
write_c()
|
||||
{
|
||||
echo '/* This file is automatically generated. DO NOT EDIT! */' >$_TOP/$1.tmp || \
|
||||
bomb "cannot create $1"
|
||||
grep '$''NetBSD' $0 | sed 's,[#$],,g;s,.*,/* Generated from: & */,' >>$_TOP/$1.tmp
|
||||
@ -31,7 +36,9 @@ write_c () {
|
||||
}
|
||||
|
||||
# usage: write_mk FILENAME
|
||||
write_mk () {
|
||||
#
|
||||
write_mk()
|
||||
{
|
||||
echo '# This file is automatically generated. DO NOT EDIT!' >$_TOP/$1.tmp || \
|
||||
bomb "cannot create $1"
|
||||
grep '$''NetBSD' $0 | sed 's,[#$],,g;s,.*,# Generated from: &,' >>$_TOP/$1.tmp
|
||||
@ -39,17 +46,19 @@ write_mk () {
|
||||
writefile $1
|
||||
}
|
||||
|
||||
writefile () {
|
||||
writefile()
|
||||
{
|
||||
sed -e 's,netbsd\(elf\)*1[0-9\.]*\(_\)*[A-Z]*,netbsd\1,' \
|
||||
-e 's,^/\* #undef HAVE_MMAP \*/$,#define HAVE_MMAP 1,' >>$_TOP/$1.tmp
|
||||
-e 's,^/\* #undef HAVE_MMAP \*/$,#define HAVE_MMAP 1,' \
|
||||
>>$_TOP/$1.tmp
|
||||
|
||||
# Compare new file, sans "generated from" comments and RCS Id, to
|
||||
# old file. If they match, don't change anything.
|
||||
# Compare new file, sans "generated from" comments and RCS Id,
|
||||
# to old file. If they match, don't change anything.
|
||||
rm -f $_TMPDIR/.1 $_TMPDIR/.2
|
||||
grep -v 'Generated from:' $_TOP/$1 >$_TMPDIR/.1 2>/dev/null
|
||||
grep -v 'Generated from:' $_TOP/$1.tmp >$_TMPDIR/.2
|
||||
|
||||
# will not overwrite a file that has the same content
|
||||
# will not overwrite a file that has the same content
|
||||
if cmp $_TMPDIR/.1 $_TMPDIR/.2 >/dev/null 2>&1; then
|
||||
rm -f $_TOP/$1.tmp
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user