File: gen-version

package info (click to toggle)
conserver 8.2.7-3.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,856 kB
  • sloc: ansic: 22,275; sh: 3,623; makefile: 285
file content (22 lines) | stat: -rwxr-xr-x 632 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh

set -e

# awk gets stdin from /dev/null 'cause when autoconf runs this via m4_esyscmd_s,
# stdin is closed and awk assumes there will always be an open stdin and you end
# up with a bogus message:
#
#   awk: i/o error occurred while closing /dev/stdin
#    input record number 20, file conserver/version.h
#    source line number 1
#
#
case "$1" in
    number)
	awk '$2=="VERSION_MAJOR"{maj=$NF} $2=="VERSION_MINOR"{min=$NF} $2=="VERSION_REV"{rev=$NF} END{print maj "." min "." rev}' conserver/version.h < /dev/null
	;;

    date)
	awk '$2=="VERSION_DATE"{print $NF}' conserver/version.h < /dev/null | tr -d '"'
	;;
esac