Added xmltok_impl.c and xmltok_ns.c to source files.
[mirror-ossqm-expat.git] / conftools / get-version.sh
bloba70e0fb47a84d4b2183c035042467873b65979ca
1 #!/bin/sh
3 # USAGE: get-version.sh path/to/expat.h
5 # This script will print Expat's version number on stdout. For example:
7 # $ ./conftools/get-version.sh ./lib/expat.h
8 # 1.95.3
9 # $
12 if test $# = 0; then
13 echo "ERROR: pathname for expat.h was not provided."
14 echo ""
15 echo "USAGE: $0 path/to/expat.h"
16 exit 1
18 if test $# != 1; then
19 echo "ERROR: too many arguments were provided."
20 echo ""
21 echo "USAGE: $0 path/to/expat.h"
22 exit 1
25 hdr="$1"
26 if test ! -r "$hdr"; then
27 echo "ERROR: '$hdr' does not exist, or is not readable."
28 exit 1
31 MAJOR_VERSION="`sed -n -e '/MAJOR_VERSION/s/[^0-9]*//gp' $hdr`"
32 MINOR_VERSION="`sed -n -e '/MINOR_VERSION/s/[^0-9]*//gp' $hdr`"
33 MICRO_VERSION="`sed -n -e '/MICRO_VERSION/s/[^0-9]*//gp' $hdr`"
35 # Determine how to tell echo not to print the trailing \n. This is
36 # similar to Autoconf's @ECHO_C@ and @ECHO_N@; however, we don't
37 # generate this file via autoconf (in fact, get-version.sh is used
38 # to *create* ./configure), so we just do something similar inline.
39 case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
40 *c*,-n*) ECHO_N= ECHO_C='
41 ' ;;
42 *c*,* ) ECHO_N=-n ECHO_C= ;;
43 *) ECHO_N= ECHO_C='\c' ;;
44 esac
46 echo $ECHO_N "$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$ECHO_C"