Back out revision 1.109 - it's NOT silly to parse the comment when

there's important information there.  Like, say, a _BETA extension.
This commit is contained in:
riz 2006-08-08 07:05:40 +00:00
parent cc3412025e
commit bbde6246b7
1 changed files with 15 additions and 8 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh
#
# $NetBSD: osrelease.sh,v 1.110 2005/12/11 12:20:30 christos Exp $
# $NetBSD: osrelease.sh,v 1.111 2006/08/08 07:05:40 riz Exp $
#
# Copyright (c) 1997 The NetBSD Foundation, Inc.
# All rights reserved.
@ -38,10 +38,17 @@
#
# We use the number specified in <sys/param.h>
${AWK:-awk} -v FLAG="$1" '
/^#define[ ]*__NetBSD_Version__/ {
major = ($3 / 100000000);
minor = ($3 / 1000000) % 100;
patch = ($3 / 100) % 100;
printf((FLAG == "-s") ? "%d%d%d\n" : "%d.%d.%d\n", major, minor, patch);
}' "$(dirname $0)"/../sys/param.h
AWK=${AWK:-awk}
GREP=${GREP:-grep}
PARAMH="`dirname $0`"/../sys/param.h
release=`$AWK '/^#define[ ]*__NetBSD_Version__/ { print $6 }' $PARAMH`
case $1 in
-s)
echo $release | sed -e 's,\.,,g'
;;
*)
echo $release
;;
esac