head 1.45; access; symbols SHTOOL_2_0_8:1.45 SHTOOL_2_0_7:1.43 SHTOOL_2_0_6:1.42 SHTOOL_2_0_5:1.42 SHTOOL_2_0_4:1.41 SHTOOL_2_0_3:1.39 SHTOOL_2_0_2:1.38 SHTOOL_2_0_1:1.37 SHTOOL_2_0_0:1.36 SHTOOL_2_0b3:1.36 SHTOOL_2_0b2:1.36 SHTOOL_2_0b1:1.36 SHTOOL_1_6:1.32.0.2 SHTOOL_1_6_2:1.32 SHTOOL_1_6_1:1.32 SHTOOL_1_6_0:1.31 SHTOOL_1_5:1.29.0.2 SHTOOL_1_5_4:1.29 SHTOOL_1_5_3:1.28 SHTOOL_1_5_2:1.28 SHTOOL_1_5_1:1.27 SHTOOL_1_5_0:1.24 SHTOOL_1_4_9:1.20 SHTOOL_1_4_8:1.19 SHTOOL_1_4_7:1.18 SHTOOL_1_4_6:1.17 SHTOOL_1_4_5:1.17 SHTOOL_1_4_4:1.17 SHTOOL_1_4_3:1.17 SHTOOL_1_4_2:1.17 SHTOOL_1_4_1:1.16 SHTOOL_1_4_0:1.16 SHTOOL_1_3_3:1.14 SHTOOL_1_3_2:1.13 SHTOOL_1_3_1:1.12 SHTOOL_1_3_0:1.12 SHTOOL_1_2_9:1.7 SHTOOL_1_2_8:1.6 SHTOOL_1_2_7:1.6 SHTOOL_1_2_6:1.6 SHTOOL_1_2_5:1.5 SHTOOL_1_2_4:1.4 SHTOOL_1_2_3:1.3 SHTOOL_1_2_2:1.2 SHTOOL_1_2_1:1.1.1.2 SHTOOL_1_2_0:1.1.1.2 SHTOOL_1_1_0:1.1.1.1 RSE:1.1.1; locks; strict; comment @# @; expand @o@; 1.45 date 2008.04.02.20.13.44; author rse; state Exp; branches; next 1.44; commitid eB5Wirx8MdMyDzXs; 1.44 date 2008.04.02.20.12.04; author rse; state Exp; branches; next 1.43; commitid xd2Jq3h5PA50DzXs; 1.43 date 2007.05.19.19.09.39; author rse; state Exp; branches; next 1.42; commitid OPUF1UBbllBTwzis; 1.42 date 2006.02.07.08.31.44; author rse; state Exp; branches; next 1.41; commitid xbV614cjL2C8ZCkr; 1.41 date 2006.02.04.09.43.25; author rse; state Exp; branches; next 1.40; commitid oWk7BmnyAitJtfkr; 1.40 date 2005.10.12.12.31.28; author rse; state Exp; branches; next 1.39; 1.39 date 2005.08.31.07.24.56; author rse; state Exp; branches; next 1.38; 1.38 date 2005.06.15.08.14.36; author rse; state Exp; branches; next 1.37; 1.37 date 2004.07.19.07.41.34; author rse; state Exp; branches; next 1.36; 1.36 date 2004.02.12.16.06.27; author rse; state Exp; branches; next 1.35; 1.35 date 2004.01.01.16.54.20; author rse; state Exp; branches; next 1.34; 1.34 date 2003.02.11.13.00.50; author rse; state Exp; branches; next 1.33; 1.33 date 2003.02.11.12.56.40; author rse; state Exp; branches; next 1.32; 1.32 date 2002.02.23.09.18.03; author rse; state Exp; branches; next 1.31; 1.31 date 2001.12.31.15.06.04; author rse; state Exp; branches; next 1.30; 1.30 date 2001.09.23.10.58.10; author rse; state Exp; branches; next 1.29; 1.29 date 2001.06.14.14.24.16; author rse; state Exp; branches; next 1.28; 1.28 date 2001.01.17.09.55.11; author rse; state Exp; branches; next 1.27; 1.27 date 2000.07.29.14.27.50; author rse; state Exp; branches; next 1.26; 1.26 date 2000.07.06.13.31.31; author rse; state Exp; branches; next 1.25; 1.25 date 2000.07.06.13.29.11; author rse; state Exp; branches; next 1.24; 1.24 date 2000.07.01.12.35.36; author rse; state Exp; branches; next 1.23; 1.23 date 2000.07.01.12.13.38; author rse; state Exp; branches; next 1.22; 1.22 date 2000.06.30.16.27.41; author rse; state Exp; branches; next 1.21; 1.21 date 2000.06.14.19.01.26; author rse; state Exp; branches; next 1.20; 1.20 date 2000.03.17.16.57.07; author rse; state Exp; branches; next 1.19; 1.19 date 2000.03.12.11.12.21; author rse; state Exp; branches; next 1.18; 1.18 date 99.12.24.15.11.23; author rse; state Exp; branches; next 1.17; 1.17 date 99.07.09.15.45.22; author rse; state Exp; branches; next 1.16; 1.16 date 99.07.02.06.09.31; author rse; state Exp; branches; next 1.15; 1.15 date 99.07.01.15.02.48; author rse; state Exp; branches; next 1.14; 1.14 date 99.06.29.17.37.34; author rse; state Exp; branches; next 1.13; 1.13 date 99.06.28.15.18.44; author rse; state Exp; branches; next 1.12; 1.12 date 99.06.17.15.43.19; author rse; state Exp; branches; next 1.11; 1.11 date 99.06.17.15.40.43; author rse; state Exp; branches; next 1.10; 1.10 date 99.06.17.15.10.55; author rse; state Exp; branches; next 1.9; 1.9 date 99.06.12.14.46.37; author rse; state Exp; branches; next 1.8; 1.8 date 99.06.12.14.08.50; author rse; state Exp; branches; next 1.7; 1.7 date 99.06.02.11.28.25; author rse; state Exp; branches; next 1.6; 1.6 date 99.05.13.11.29.59; author rse; state Exp; branches; next 1.5; 1.5 date 99.05.12.15.41.41; author rse; state Exp; branches; next 1.4; 1.4 date 99.05.11.09.03.25; author rse; state Exp; branches; next 1.3; 1.3 date 99.05.06.11.10.02; author rse; state Exp; branches; next 1.2; 1.2 date 99.05.05.12.15.52; author rse; state Exp; branches; next 1.1; 1.1 date 99.04.29.11.19.50; author rse; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 99.04.29.11.19.50; author rse; state Exp; branches; next 1.1.1.2; 1.1.1.2 date 99.04.29.11.20.00; author rse; state Exp; branches; next ; desc @@ 1.45 log @adjust copyright for year 2008 @ text @## ## version -- Maintain a version information file ## Copyright (c) 1994-2008 Ralf S. Engelschall ## ## This file is part of shtool and free software; you can redistribute ## it and/or modify it under the terms of the GNU General Public ## License as published by the Free Software Foundation; either version ## 2 of the License, or (at your option) any later version. ## ## This file is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, ## USA, or contact Ralf S. Engelschall . ## str_tool="version" str_usage="[-l|--language ] [-n|--name ] [-p|--prefix ] [-s|--set ] [-e|--edit] [-i|--increase ] [-d|--display ] " arg_spec="1=" opt_spec="l:n:p:s:i:e.d:" opt_alias="l:language,n:name,p:prefix,s:set,e:edit,i:increase,d:display" opt_l="txt" opt_n="unknown" opt_p="" opt_s="" opt_e="no" opt_i="" opt_d="short" . ./sh.common file="$1" # determine prefix and name name="$opt_n" prefix="$opt_p" # determine current version triple="$opt_s" if [ ".$triple" != . ]; then # use given triple if [ ".`echo $triple | grep '[0-9]*.[0-9]*[sabp.][0-9]*'`" = . ]; then echo "$msgprefix:Error: invalid argument to option \`-s': \`$opt_s'" 1>&2 shtool_exit 1 fi eval `echo $triple |\ sed -e 's%\([0-9]*\)\.\([0-9]*\)\([sabp.]\)\([0-9]*\).*%\ ver="\1";rev="\2";typ="\3";lev="\4"%'` tim=calc elif [ -r $file ]; then # determine triple from given file eval `grep 'Version [0-9]*.[0-9]*[sabp.][0-9]* ([0-9]*-[a-zA-Z]*-[0-9]*)' $file |\ sed -e 's%.*Version \([0-9]*\)\.\([0-9]*\)\([sabp.]\)\([0-9]*\) (\([0-9]*-[a-zA-Z]*-[0-9]*\)).*%\ ver="\1";rev="\2";typ="\3";lev="\4";tim="\5"%' -e 'q'` else # intialise to first version ver=0 rev=1 typ=. lev=0 tim=calc fi # determine new version in batch if [ ".$opt_i" != . ]; then case $opt_i in v ) ver=`expr $ver + 1` rev=0 lev=0 ;; r ) rev=`expr $rev + 1` lev=0 ;; l ) lev=`expr $lev + 1` ;; * ) echo "$msgprefix:Error: invalid argument to option \`-i': \`$opt_i'" 1>&2 shtool_exit 1 ;; esac tim=calc fi # determine new version interactively if [ ".$opt_e" = .yes ]; then echo "old version: ${ver}.${rev}${typ}${lev}" while [ 1 ]; do echo dummy | awk '{ printf("new version: "); }' read triple case $triple in [0-9]*.[0-9]*[sabp.][0-9]* ) ;; * ) echo "$msgprefix:Error: invalid version string entered: \`$triple'" 1>&2 continue ;; esac break done eval `echo $triple |\ sed -e 's%^\([0-9]*\)\.\([0-9]*\)\([sabp.]\)\([0-9]*\)$%\ ver="\1";rev="\2";typ="\3";lev="\4"%'` tim=calc fi # determine hexadecimal and libtool value of version case $typ in a ) typnum=0; levnum=$lev ;; b ) typnum=1; levnum=$lev ;; p | . ) typnum=2; levnum=$lev ;; s ) typnum=15; levnum=255 ;; # snapshots are special esac hex=`echo "$ver:$rev:$typnum:$levnum" |\ awk -F: '{ printf("0x%x%02x%1x%02x", $1, $2, $3, $4); }' |\ tr 'abcdef' 'ABCDEF'` ltv=`echo "$ver:$rev:$typnum:$levnum" |\ awk -F: '{ printf("%d:%d", $1*10 + $2, $3*10 + $4); }'` # determine date if [ ".$tim" = .calc ]; then day=`date '+%d'` month=`date '+%m'` year=`date '+%Y' 2>/dev/null` if [ ".$time_year" = . ]; then year=`date '+%y'` case $year in [5-9][0-9]) year="19$year" ;; [0-4][0-9]) year="20$year" ;; esac fi case $month in 1|01) month='Jan' ;; 2|02) month='Feb' ;; 3|03) month='Mar' ;; 4|04) month='Apr' ;; 5|05) month='May' ;; 6|06) month='Jun' ;; 7|07) month='Jul' ;; 8|08) month='Aug' ;; 9|09) month='Sep' ;; 10) month='Oct' ;; 11) month='Nov' ;; 12) month='Dec' ;; esac tim="${day}-${month}-${year}" fi # perform result actions mode=show if [ ".$opt_i" != . ]; then mode=edit elif [ ".$opt_e" = .yes ]; then mode=edit elif [ ".$opt_s" != . ]; then mode=edit fi if [ ".$mode" = .show ]; then # just display the current version case $opt_d in short ) echo "${ver}.${rev}${typ}${lev}" ;; long ) echo "${ver}.${rev}${typ}${lev} ($tim)" ;; libtool ) echo "${ltv}" ;; hex ) echo "${hex}" ;; * ) echo "$msgprefix:Error: invalid argument to option \`-d': \`$opt_d'" 1>&2 shtool_exit 1 ;; esac else # update the version file # pre-generate various strings triple="${ver}.${rev}${typ}${lev}" vHex="$hex" vShort="${triple}" vLong="${triple} (${tim})" vTeX="This is ${name}, Version ${triple} (${tim})" vGNU="${name} ${triple} (${tim})" vWeb="${name}/${triple}" vSCCS="@@(#)${name} ${triple} (${tim})" vRCS="\$Id: ${name} ${triple} (${tim}) \$" # determine string out of filename # (do NOT try to optimize this in any way because of portability) filestr=`util_upper "$file" | tr './%+' '____' | sed -e 's/-/_/g'` # generate uppercase prefix prefixupper=`util_upper "$prefix"` # create the version file according the the selected language echo "new version: ${vLong}" cp /dev/null $file case $opt_l in txt ) echo >>$file "" echo >>$file " ${file} -- Version Information for ${name} (syntax: Text)" echo >>$file " [automatically generated and maintained by GNU shtool]" echo >>$file "" echo >>$file " $vTeX" echo >>$file "" ;; c ) echo >>$file "/*" echo >>$file "** ${file} -- Version Information for ${name} (syntax: C/C++)" echo >>$file "** [automatically generated and maintained by GNU shtool]" echo >>$file "*/" echo >>$file "" echo >>$file "#ifdef _${filestr}_AS_HEADER_" echo >>$file "" echo >>$file "#ifndef _${filestr}_" echo >>$file "#define _${filestr}_" echo >>$file "" echo >>$file "#define ${prefixupper}VERSION ${vHex}" echo >>$file "" echo >>$file "typedef struct {" echo >>$file " const int v_hex;" echo >>$file " const char *v_short;" echo >>$file " const char *v_long;" echo >>$file " const char *v_tex;" echo >>$file " const char *v_gnu;" echo >>$file " const char *v_web;" echo >>$file " const char *v_sccs;" echo >>$file " const char *v_rcs;" echo >>$file "} ${prefix}version_t;" echo >>$file "" echo >>$file "extern ${prefix}version_t ${prefix}version;" echo >>$file "" echo >>$file "#endif /* _${filestr}_ */" echo >>$file "" echo >>$file "#else /* _${filestr}_AS_HEADER_ */" echo >>$file "" echo >>$file "#define _${filestr}_AS_HEADER_" echo >>$file "#include \"${file}\"" echo >>$file "#undef _${filestr}_AS_HEADER_" echo >>$file "" echo >>$file "${prefix}version_t ${prefix}version = {" echo >>$file " ${vHex}," echo >>$file " \"${vShort}\"," echo >>$file " \"${vLong}\"," echo >>$file " \"${vTeX}\"," echo >>$file " \"${vGNU}\"," echo >>$file " \"${vWeb}\"," echo >>$file " \"${vSCCS}\"," echo >>$file " \"${vRCS}\"" echo >>$file "};" echo >>$file "" echo >>$file "#endif /* _${filestr}_AS_HEADER_ */" echo >>$file "" ;; m4 ) echo >>$file "##" echo >>$file "## ${file} -- Version Information for ${name} (syntax: M4)" echo >>$file "## [automatically generated and maintained by GNU shtool]" echo >>$file "##" echo >>$file "" echo >>$file "m4_define([v_hex], [${vHex}])" echo >>$file "m4_define([v_short], [${vShort}])" echo >>$file "m4_define([v_long], [${vLong}])" echo >>$file "m4_define([v_tex], [${vTeX}])" echo >>$file "m4_define([v_gnu], [${vGNU}])" echo >>$file "m4_define([v_web], [${vWeb}])" echo >>$file "m4_define([v_sccs], [${vSCCS}])" echo >>$file "m4_define([v_rcs], [${vRCS}])" echo >>$file "" ;; perl ) echo >>$file "##" echo >>$file "## ${file} -- Version Information for ${name} (syntax: Perl)" echo >>$file "## [automatically generated and maintained by GNU shtool]" echo >>$file "##" echo >>$file "" echo >>$file "our \$${prefix}version = {" echo >>$file " 'v_hex' => ${vHex}," echo >>$file " 'v_short' => \"${vShort}\"," echo >>$file " 'v_long' => \"${vLong}\"," echo >>$file " 'v_tex' => \"${vTeX}\"," echo >>$file " 'v_gnu' => \"${vGNU}\"," echo >>$file " 'v_web' => \"${vWeb}\"," echo >>$file " 'v_sccs' => \"${vSCCS}\"," echo >>$file " 'v_rcs' => \"\\${vRCS}/\"" echo >>$file "};" echo >>$file "" echo >>$file "1;" echo >>$file "" ;; python ) echo >>$file "##" echo >>$file "## ${file} -- Version Information for ${name} (syntax: Python)" echo >>$file "## [automatically generated and maintained by GNU shtool]" echo >>$file "##" echo >>$file "" echo >>$file "class ${prefix}version:" echo >>$file " v_hex = ${vHex}" echo >>$file " v_short = \"${vShort}\"" echo >>$file " v_long = \"${vLong}\"" echo >>$file " v_tex = \"${vTeX}\"" echo >>$file " v_gnu = \"${vGNU}\"" echo >>$file " v_web = \"${vWeb}\"" echo >>$file " v_sccs = \"${vSCCS}\"" echo >>$file " v_rcs = \"${vRCS}\"" echo >>$file "" ;; * ) echo "$msgprefix:Error: invalid argument to option \`-l': \`$opt_l'" 1>&2 shtool_exit 1 ;; esac fi shtool_exit 0 ## ## manual page ## =pod =head1 NAME B - B maintain version information file =head1 SYNOPSIS B [B<-l>|B<--language> I] [B<-n>|B<--name> I] [B<-p>|B<--prefix> I] [B<-s>|B<--set> I] [B<-e>|B<--edit>] [B<-i>|B<--increase> I] [B<-d>|B<--display> I] I =head1 DESCRIPTION This command displays and maintains version information in I. The version is always described with a triple EI,I,IE and is represented by a string which always matches the regular expression "C<[0-9]+\.[0-9]+[sabp.][0-9]+>". The hexadecimal format for a version C is C where C and C directly correspond to C and C, C encodes the level type as C<9>, C<2>, C<1>, C<0> (representing C, C

/C<.>, C, C in this order) and C is either directly corresponding to C or set to C<99> if level type is C. =head1 OPTIONS The following command line options are available. =over 4 =item B<-v>, B<--verbose> Print verbose information during processing. =item B<-l>, B<--language> I Choose format of version file I. I="C", ANSI C (I="c"), M4 (I="m4"), Perl (I="perl") or Python (I="python"). Default is C. =item B<-n>, B<--name> I Name the program the version is maintained for. Default is C. =item B<-p>, B<--prefix> I =item B<-s>, B<--set> I Set the version to I. =item B<-e>, B<--edit> Interactively enter a new version. =item B<-i>, B<--increase> I When option ``B<-i>'' is used, the current version in I is updated by increasing one element of the version where I can be one of the following: ``C'' for increasing the version by 1 (and resetting revision and level to 0), ``C'' for increasing the revision by 1 (and resetting level to 0) or ``C'' for increasing the level by 1. =item B<-d>, B<--display> I Control the display type: "C" for a short version display, "C" for a longer version display, "C" for a hexadecimal display of the version and "C" for a format suitable for use with GNU libtool. =back =head1 EXAMPLE # shell script shtool version -l c -n FooBar -p foobar -s 1.2b3 version.c # configure.in V=`shtool version -l c -d long version.c` echo "Configuring FooBar, Version $V" =head1 HISTORY The B B command was originally written by Ralf S. Engelschall Erse@@engelschall.comE in 1994 for B. It was later rewritten from scratch for inclusion into B. =head1 SEE ALSO shtool(1). =cut @ 1.44 log @remove trailing spaces @ text @d3 1 a3 1 ## Copyright (c) 1994-2007 Ralf S. Engelschall @ 1.43 log @Adjust copyright for year 2007. @ text @d371 1 a371 1 (I="c"), M4 (I="m4"), Perl (I="perl") or Python @ 1.42 log @Fix "shtool version" command which got broken after recent util_{lower,upper} usage. @ text @d3 1 a3 1 ## Copyright (c) 1994-2006 Ralf S. Engelschall @ 1.41 log @Adjust copyright for year 2006 @ text @d194 1 a194 1 filestr=`echo $file | util_upper | tr './%+' '____' | sed -e 's/-/_/g'` d197 1 a197 1 prefixupper=`echo $prefix | util_upper` @ 1.40 log @Use internal util_{lower,upper} functions in "shtool version". @ text @d3 1 a3 1 ## Copyright (c) 1994-2005 Ralf S. Engelschall @ 1.39 log @Fixed "shtool version -l perl" by replacing "my" with "our" to allow the generated file to be really useful when loaded with the Perl "require" directive. @ text @d194 1 a194 3 filestr=`echo $file |\ tr 'abcdefghijklmnopqrstuvwxyz./%+' \ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ____' | sed -e 's/-/_/g'` d197 1 a197 2 prefixupper=`echo $prefix |\ tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` @ 1.38 log @Adjust copyright for year 2005 @ text @d285 1 a285 1 echo >>$file "my \$${prefix}version = {" @ 1.37 log @- Added M4 language output to "shtool version". - Fixed AC_PROG_SHTOOL definition in shtool.m4. Submitted by: James Rowe @ text @d3 1 a3 1 ## Copyright (c) 1994-2004 Ralf S. Engelschall @ 1.36 log @Embedded the command documentation from shtool.pod into the individual sh.xxxx scripts and this way split the large shtool(1) manual page into individual manual pages shtool-xxxx(1). Submitted partly by: Thomas Lotterer @ text @d263 16 d374 2 a375 2 (I="c"), Perl (I="perl") or Python (I="python"). Default is C. @ 1.35 log @Bump copyright year for 2004 @ text @a3 1 ## Originally written for ePerl, rewritten from scratch for shtool d305 106 @ 1.34 log @Bump year in copyright messages to cover new year 2003. @ text @d3 1 a3 1 ## Copyright (c) 1994-2003 Ralf S. Engelschall @ 1.33 log @Fixed error exit in all commands by introducing an "shtool_exit" function (which correctly cleans up temporary files) and replacing all "exit" calls with "shtool_exit". THIS THE FIRST TIME INTRODUCED THE USAGE OF A SHELL FUNCTION TO THE SHTOOL CODE. This is known to break on _very_ anchient and broken Bourne-Shell implementations and is considered to be no longer a real problem in the year 2003. Especially there is no alternative way anyway. @ text @d3 1 a3 1 ## Copyright (c) 1994-2002 Ralf S. Engelschall @ 1.32 log @Port to POSIX 1003.1-2001 (SUSv3) standard: sh.echo, sh.version: "head -1" -> "sed -e 'q'" sh.path: "sort -u | tail -1" -> "sort -r -u | sed -e q" sh.subst: diff -u1 -> diff -U1 Submitted by: Paul Eggert @ text @d49 1 a49 1 exit 1 d82 1 a82 1 exit 1 d176 1 a176 1 exit 1 d302 1 a302 1 exit 1 @ 1.31 log @bump copyright years @ text @d58 2 a59 2 head -1 | sed -e 's%.*Version \([0-9]*\)\.\([0-9]*\)\([sabp.]\)\([0-9]*\) (\([0-9]*-[a-zA-Z]*-[0-9]*\)).*%\ ver="\1";rev="\2";typ="\3";lev="\4";tim="\5"%'` @ 1.30 log @*** empty log message *** @ text @d3 1 a3 1 ## Copyright (c) 1994-2001 Ralf S. Engelschall @ 1.29 log @*** empty log message *** @ text @d23 1 a23 1 str_usage="[-l] [-n] [-p] [-s] [-e] [-i] [-d] " d26 1 @ 1.28 log @*** empty log message *** @ text @d94 1 a94 1 [0-9]*.[0-9]*[sabp.][0-9]* ) d178 1 a178 1 else d201 1 a201 1 @ 1.27 log @*** empty log message *** @ text @d3 1 a3 1 ## Copyright (c) 1994-2000 Ralf S. Engelschall @ 1.26 log @*** empty log message *** @ text @d116 2 a117 1 awk -F: '{ printf("0x%X%02X%1X%02X", $1, $2, $3, $4); }'` @ 1.25 log @*** empty log message *** @ text @d292 1 a292 1 echo >>$file " v_tex = \"${vTex}\"" @ 1.24 log @*** empty log message *** @ text @d282 17 @ 1.23 log @*** empty log message *** @ text @d240 1 a240 1 echo >>$file "#endif _${filestr}_" @ 1.22 log @*** empty log message *** @ text @d4 1 a4 1 ## Originally written for ePerl d27 1 a27 1 opt_n="" d38 1 a38 1 # determine prefix from name and vice versa a40 6 if [ ".$prefix" = . -a ".$name" != . ]; then prefix="$name" fi if [ ".$name" = . -a ".$prefix" != . ]; then name="$prefix" fi d50 3 a52 6 V=`echo $triple |\ sed -e 's;\([0-9]*\)\.\([0-9]*\)\([sabp.]\)\([0-9]*\).*;\1:\2:\3:\4;'` ver=`echo $V | awk -F: '{ print $1 }'` rev=`echo $V | awk -F: '{ print $2 }'` typ=`echo $V | awk -F: '{ print $3 }'` lev=`echo $V | awk -F: '{ print $4 }'` d56 3 a58 7 V=`grep 'Version [0-9]*.[0-9]*[sabp.][0-9]* ([0-9]*-[a-zA-Z]*-[0-9]*)' $file |\ head -1 | sed -e 's;.*Version \([0-9]*\)\.\([0-9]*\)\([sabp.]\)\([0-9]*\) (\([0-9]*-[a-zA-Z]*-[0-9]*\)).*;\1:\2:\3:\4:\5;'` ver=`echo $V | awk -F: '{ print $1 }'` rev=`echo $V | awk -F: '{ print $2 }'` typ=`echo $V | awk -F: '{ print $3 }'` lev=`echo $V | awk -F: '{ print $4 }'` tim=`echo $V | awk -F: '{ print $5 }'` d93 7 a99 4 if [ ".`echo $triple | grep '[0-9]*.[0-9]*[sabp.][0-9]*'`" = . ]; then echo "$msgprefix:Error: invalid version entered: \`$triple'" 1>&2 continue fi d102 3 a104 6 V=`echo $triple |\ sed -e 's;\([0-9]*\)\.\([0-9]*\)\([sabp.]\)\([0-9]*\).*;\1:\2:\3:\4;'` ver=`echo $V | awk -F: '{ print $1 }'` rev=`echo $V | awk -F: '{ print $2 }'` typ=`echo $V | awk -F: '{ print $3 }'` lev=`echo $V | awk -F: '{ print $4 }'` d110 4 a113 4 a ) typnum=0; levnum=$lev ;; b ) typnum=1; levnum=$lev ;; p | . ) typnum=2; levnum=$lev ;; s ) typnum=9; levnum=99 ;; # snapshots are special d116 1 a116 1 awk -F: '{ printf("0x%d%02d%1d%02d", $1, $2, $3, $4); }'` d118 1 a118 1 awk -F: '{ printf("%d:%d", $1*10 + $2, $3*10 + $2); }'` d161 3 a166 3 short ) echo "${ver}.${rev}${typ}${lev}" ;; d189 1 a189 1 vRCS="\$Id: ${name} ${triple} ${tim} \$" d196 4 d225 1 a225 1 echo >>$file "#define ${prefix}VERSION ${vHex}" d263 4 a266 4 echo >>$file "/*" echo >>$file "** ${file} -- Version Information for ${name} (syntax: Perl)" echo >>$file "** [automatically generated and maintained by GNU shtool]" echo >>$file "*/" d268 1 a268 1 echo >>$file "my ${prefix}version = {" @ 1.21 log @*** empty log message *** @ text @d2 1 a2 1 ## version -- Generate and maintain a version information file d23 3 a25 3 str_usage="[-l] [-n] [-p] [-s] [-i] [-d] " arg_spec="1+" opt_spec="l:n:p:s:i:d:" d27 6 a32 6 opt_n="unknown" opt_p="unknown" opt_s="unknown" opt_i="P" opt_d="NO" gen_tmpfile=yes d36 1 a36 18 LANGUAGE="$opt_l" NAME="$opt_n" PREFIX="$opt_p" FULLVERSION="$opt_s" INCREASE="$opt_i" REPORT="$opt_d" FILE="$1" # determine language if [ ".$LANGUAGE" = .unknown ]; then case $FILE in *.txt ) LANGUAGE=txt ;; *.c ) LANGUAGE=c ;; *.pl | *.pm ) LANGUAGE=perl ;; *.py) LANGUAGE=python ;; * ) echo "$tool:Error: unknown language type" 1>&2; exit 1 ;; esac fi d39 4 a42 4 if [ ".$PREFIX" = . -o ".$PREFIX" = .unknown ]; then if [ ".$NAME" != . -a ".$NAME" != .unknown ]; then PREFIX="$NAME" fi d44 2 a45 4 if [ ".$NAME" = . -o ".$NAME" = .unknown ]; then if [ ".$PREFIX" != . -a ".$PREFIX" != .unknown ]; then NAME="$PREFIX" fi d48 7 a54 53 # determine version date=unknown version=0 revision=0 bplevel=0 if [ ".$FULLVERSION" = .unknown ]; then if [ -r "$FILE" ]; then # grep out current information id=`grep 'Version [0-9]*.[0-9]*[.abps][0-9]* ([0-9]*-[a-zA-Z]*-[0-9]*)' $FILE | \ head -1 | \ sed -e 's%.*Version \([0-9]*\)\.\([0-9]*\)\([.abps]\)\([0-9]*\) (\([0-9]*-[a-zA-Z]*-[0-9]*\)).*%\1:\2:\3:\4:\5%'` version=`echo $id | awk -F: '{ print $1 }'` revision=`echo $id | awk -F: '{ print $2 }'` bptype=`echo $id | awk -F: '{ print $3 }'` bplevel=`echo $id | awk -F: '{ print $4 }'` date=`echo $id | awk -F: '{ print $5 }'` if [ .$REPORT = .NO ]; then case $INCREASE in b ) bplevel=`expr $bplevel + 1` bptype=b ;; a ) bplevel=`expr $bplevel + 1` bptype=a ;; s ) bplevel=`expr $bplevel + 1` bptype=s ;; P ) bplevel=`expr $bplevel + 1` bptype=. ;; p ) bplevel=`expr $bplevel + 1` bptype=p ;; r ) revision=`expr $revision + 1` bptype=. bplevel=0 ;; v ) version=`expr $version + 1` revision=0 bptype=. bplevel=0 ;; esac date=calc fi FULLVERSION="$version.$revision$bptype$bplevel" else # intialise to first version version=0 revision=5 bptype=b bplevel=0 date=calc d56 16 d73 6 a78 7 # take given version V=`echo $FULLVERSION | sed -e 's%\([0-9]*\)\.\([0-9]*\)\([.abps]\)\([0-9]*\).*%\1:\2:\3:\4%'` version=`echo $V | awk -F: '{ print $1 }'` revision=`echo $V | awk -F: '{ print $2 }'` bptype=`echo $V | awk -F: '{ print $3 }'` bplevel=`echo $V | awk -F: '{ print $4 }'` date=calc d81 39 a119 14 # determine hex value of version case $FULLVERSION in *.*a* ) HEX=`echo "$FULLVERSION" | sed -e 's/a.*//' | awk -F. '{ printf("%d%02d", $1, $2); }' && echo "$FULLVERSION" | sed -e 's/.*a//' | awk '{ printf("0%02d", $1); }'` ;; *.*b* ) HEX=`echo "$FULLVERSION" | sed -e 's/b.*//' | awk -F. '{ printf("%d%02d", $1, $2); }' && echo "$FULLVERSION" | sed -e 's/.*b//' | awk '{ printf("1%02d", $1); }'` ;; *.*.* ) HEX=`echo "$FULLVERSION" | awk -F. '{ printf("%d%02d2%02d", $1, $2, $3); }'` ;; esac d121 6 a126 11 # determine libtool version case $FULLVERSION in *.*a* ) LTV=`echo "$FULLVERSION" | sed -e 's/a.*//' | awk -F. '{ printf("%d:0", $1*10+$2); }'` ;; *.*b* ) LTV=`echo "$FULLVERSION" | sed -e 's/b.*//' | awk -F. '{ printf("%d:0", $1*10+$2); }'` ;; *.*.* ) LTV=`echo "$FULLVERSION" | awk -F. '{ printf("%d:%d", $1*10+$2, $3); }'` ;; d128 4 a131 6 # determine string out of filename # (don't try to optimize this in any way - portability!) FILESTR=`echo "$FILE" |\ tr 'abcdefghijklmnopqrstuvwxyz./%+' \ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ____' | sed -e 's/-/_/g'` d134 1 a134 1 if [ ".$date" = .calc ]; then d159 1 a159 1 date="${day}-${month}-${year}" d162 12 a173 2 if [ .$REPORT != .NO ]; then case $REPORT in d175 1 a175 1 echo "$version.$revision$bptype$bplevel ($date)" d178 1 a178 1 echo "$version.$revision$bptype$bplevel" d181 1 a181 1 echo "$LTV" d184 109 a292 1 echo "0x$HEX" a294 2 rm -f $tmpfile >/dev/null 2>&1 exit 0 a295 104 # create the version file according the the selected language echo "new version: $version.$revision$bptype$bplevel ($date)" case $LANGUAGE in txt ) cat >$tmpfile <<'EOT' This is @@NAME@@, Version @@VERSION@@.@@REVISION@@@@BPTYPE@@@@BPLEVEL@@ (@@DAY@@-@@MONTH@@-@@YEAR@@) EOT ;; c ) cat >$tmpfile <<'EOT' /* ** @@FILE@@ -- Version Information ** [automatically generated and maintained by GNU shtool] */ #ifdef _AS_HEADER #ifndef _@@FILESTR@@ #define _@@FILESTR@@ #define @@PREFIX@@_VERSION 0x@@HEX@@ extern const int @@PREFIX@@_Version; extern const char @@PREFIX@@_VersionStr[]; extern const char @@PREFIX@@_Hello[]; extern const char @@PREFIX@@_GNUVersion[]; extern const char @@PREFIX@@_WhatID[]; extern const char @@PREFIX@@_RCSIdentID[]; extern const char @@PREFIX@@_WebID[]; extern const char @@PREFIX@@_PlainID[]; #endif /* _@@FILESTR@@ */ #else const int @@PREFIX@@_Version = 0x@@HEX@@; const char @@PREFIX@@_VersionStr[] = "@@VERSION@@.@@REVISION@@@@BPTYPE@@@@BPLEVEL@@ (@@DAY@@-@@MONTH@@-@@YEAR@@)"; const char @@PREFIX@@_Hello[] = "This is @@NAME@@, Version @@VERSION@@.@@REVISION@@@@BPTYPE@@@@BPLEVEL@@ (@@DAY@@-@@MONTH@@-@@YEAR@@)"; const char @@PREFIX@@_GNUVersion[] = "@@NAME@@ Version @@VERSION@@.@@REVISION@@@@BPTYPE@@@@BPLEVEL@@"; const char @@PREFIX@@_WhatID[] = "@@(#)@@NAME@@ Version @@VERSION@@.@@REVISION@@@@BPTYPE@@@@BPLEVEL@@ (@@DAY@@-@@MONTH@@-@@YEAR@@)"; const char @@PREFIX@@_RCSIdentID[] = "$Id: @@NAME@@ @@VERSION@@.@@REVISION@@@@BPTYPE@@@@BPLEVEL@@ @@DAY@@-@@MONTH@@-@@YEAR@@ $"; const char @@PREFIX@@_WebID[] = "@@NAME@@/@@VERSION@@.@@REVISION@@@@BPTYPE@@@@BPLEVEL@@"; const char @@PREFIX@@_PlainID[] = "@@VERSION@@.@@REVISION@@@@BPTYPE@@@@BPLEVEL@@"; #endif EOT ;; perl ) cat >$tmpfile <<'EOT' ## ## @@FILE@@ -- Version Information ## [automatically generated and maintained by GNU shtool] ## $@@PREFIX@@_Version = 0x@@HEX@@; $@@PREFIX@@_VersionStr = "@@VERSION@@.@@REVISION@@@@BPTYPE@@@@BPLEVEL@@ (@@DAY@@-@@MONTH@@-@@YEAR@@)"; $@@PREFIX@@_Hello = "This is @@NAME@@, Version @@VERSION@@.@@REVISION@@@@BPTYPE@@@@BPLEVEL@@ (@@DAY@@-@@MONTH@@-@@YEAR@@)"; $@@PREFIX@@_GNUVersion = "@@NAME@@ Version @@VERSION@@.@@REVISION@@@@BPTYPE@@@@BPLEVEL@@"; $@@PREFIX@@_WhatID = "@@(#)@@NAME@@ Version @@VERSION@@.@@REVISION@@@@BPTYPE@@@@BPLEVEL@@ (@@DAY@@-@@MONTH@@-@@YEAR@@)"; $@@PREFIX@@_RCSIdentID = "\$Id: @@NAME@@ @@VERSION@@.@@REVISION@@@@BPTYPE@@@@BPLEVEL@@ @@DAY@@-@@MONTH@@-@@YEAR@@ $/"; $@@PREFIX@@_WebID = "@@NAME@@/@@VERSION@@.@@REVISION@@@@BPTYPE@@@@BPLEVEL@@"; $@@PREFIX@@_PlainID = "@@VERSION@@.@@REVISION@@@@BPTYPE@@@@BPLEVEL@@"; 1; EOT ;; python ) cat >$tmpfile <<'EOT' ## ## @@FILE@@ -- Version Information ## [automatically generated and maintained by GNU shtool] ## @@PREFIX@@_Version = 0x@@HEX@@ @@PREFIX@@_VersionStr = "@@VERSION@@.@@REVISION@@@@BPTYPE@@@@BPLEVEL@@ (@@DAY@@-@@MONTH@@-@@YEAR@@)" @@PREFIX@@_Hello = "This is @@NAME@@, Version @@VERSION@@.@@REVISION@@@@BPTYPE@@@@BPLEVEL@@ (@@DAY@@-@@MONTH@@-@@YEAR@@)" @@PREFIX@@_GNUVersion = "@@NAME@@ Version @@VERSION@@.@@REVISION@@@@BPTYPE@@@@BPLEVEL@@" @@PREFIX@@_WhatID = "@@(#)@@NAME@@ Version @@VERSION@@.@@REVISION@@@@BPTYPE@@@@BPLEVEL@@ (@@DAY@@-@@MONTH@@-@@YEAR@@)" @@PREFIX@@_RCSIdentID = "$Id: @@NAME@@ @@VERSION@@.@@REVISION@@@@BPTYPE@@@@BPLEVEL@@ @@DAY@@-@@MONTH@@-@@YEAR@@ $" @@PREFIX@@_WebID = "@@NAME@@/@@VERSION@@.@@REVISION@@@@BPTYPE@@@@BPLEVEL@@" @@PREFIX@@_PlainID = "@@VERSION@@.@@REVISION@@@@BPTYPE@@@@BPLEVEL@@" EOT ;; esac # now create the version file rm -f $FILE >/dev/null 2>&1 sed \ -e "s|@@FILE@@|$FILE|g" \ -e "s|@@FILESTR@@|$FILESTR|g" \ -e "s|@@PREFIX@@|$PREFIX|g" \ -e "s|@@NAME@@|$NAME|g" \ -e "s|@@HEX@@|$HEX|g" \ -e "s|@@VERSION@@|$version|g" \ -e "s|@@REVISION@@|$revision|g" \ -e "s|@@BPTYPE@@|$bptype|g" \ -e "s|@@BPLEVEL@@|$bplevel|g" \ -e "s|@@YEAR@@|$year|g" \ -e "s|@@MONTH@@|$month|g" \ -e "s|@@DAY@@|$day|g" <$tmpfile >$FILE rm -f $tmpfile >/dev/null 2>&1 exit 0 @ 1.20 log @*** empty log message *** @ text @d47 4 a50 3 *.txt ) LANGUAGE=txt ;; *.c ) LANGUAGE=c ;; *.pl | *.pm ) LANGUAGE=perl ;; d277 18 @ 1.19 log @*** empty log message *** @ text @d226 1 a226 1 ** [automatically generated and maintained by shtool] d263 1 a263 1 ## [automatically generated and maintained by shtool] @ 1.18 log @*** empty log message *** @ text @d3 1 a3 1 ## Copyright (c) 1994-1999 Ralf S. Engelschall @ 1.17 log @*** empty log message *** @ text @d25 1 a25 1 opt_spec="l:!n:!p:!s:!i:!d:!" @ 1.16 log @*** empty log message *** @ text @a0 1 #!/bin/sh @ 1.15 log @*** empty log message *** @ text @d101 1 d106 1 @ 1.14 log @*** empty log message *** @ text @d211 1 a211 1 # create the version file according the the selected language @ 1.13 log @*** empty log message *** @ text @d211 1 a211 1 # create the version file according the the selected language @ 1.12 log @*** empty log message *** @ text @d35 1 a35 1 . sh.common @ 1.11 log @*** empty log message *** @ text @d217 1 a217 1 This is @@NAME@@ Version @@VERSION@@.@@REVISION@@@@BPTYPE@@@@BPLEVEL@@ (@@DAY@@-@@MONTH@@-@@YEAR@@) @ 1.10 log @*** empty log message *** @ text @d247 1 a247 1 const char @@PREFIX@@_Hello[] = "This is @@NAME@@ Version @@VERSION@@.@@REVISION@@@@BPTYPE@@@@BPLEVEL@@ (@@DAY@@-@@MONTH@@-@@YEAR@@)"; d267 1 a267 1 $@@PREFIX@@_Hello = "This is @@NAME@@ Version @@VERSION@@.@@REVISION@@@@BPTYPE@@@@BPLEVEL@@ (@@DAY@@-@@MONTH@@-@@YEAR@@)"; @ 1.9 log @*** empty log message *** @ text @d165 5 a169 5 day="`date '+%d' | awk '{ printf("%s", $1); }'`" month="`date '+%m' | awk '{ printf("%s", $1); }'`" year="`date '+%Y' 2>/dev/null | awk '{ printf("%s", $1); }'`" if test ".$time_year" = .; then year="`date '+%y' | awk '{ printf("%s", $1); }'`" @ 1.8 log @*** empty log message *** @ text @d7 15 @ 1.7 log @*** empty log message *** @ text @d5 1 a5 1 ## Usage: version [-l ] [-n ] [-p ] [-s ] [-i ] [-d ] d8 21 a28 38 LANGUAGE=txt NAME=unknown PREFIX=unknown FULLVERSION=unknown REPORT=NO INCREASE=P USAGE=NO FILE="" while [ ".$1" != . ]; do case $1 in -l) LANGUAGE=$2; shift; shift; continue ;; -n) NAME=$2; shift; shift; continue ;; -p) PREFIX=$2; shift; shift; continue ;; -s) FULLVERSION=$2; shift; shift; continue ;; -i) INCREASE=$2; shift; shift; continue ;; -d) REPORT=$2; shift; shift; continue ;; -h) USAGE=YES; shift; continue ;; *) break; esac done if [ $# -ne 1 ]; then USAGE=YES else FILE=$1 fi if [ ".$USAGE" = .YES ]; then echo "$0:Usage: version [options] file" echo "Options are:" echo "-l set language to one of 'txt', 'c' or 'perl'" echo "-n set program name" echo "-p set symbol prefix" echo "-s .[.pb]

set version string" echo "-i v|r|P|p|b|a|s increase version, revision or {alpha,batch,patch,snap} level" echo "-d short|long|libtool|hex display current version only" echo "-h print this page" exit 0 fi d36 1 a36 1 * ) echo "$0:Error: Unknown language type" 1>&2; exit 1 ;; d156 2 a157 2 9[0-9]*) year="19$year" ;; *) year="20$year" ;; d192 1 a197 10 tmpdir="/tmp" if [ ".$TMPDIR" != . ]; then tmpdir="$TMPDIR" else if [ ".$TEMPDIR" != . ]; then tmpdir="$TEMPDIR" fi fi tmpfile="$tmpdir/shtool.version.tmp.$$" rm -f $tmpfile >/dev/null 2>&1 @ 1.6 log @*** empty log message *** @ text @d160 4 a163 1 FILESTR=`echo "$FILE" | tr 'abcdefghijklmnopqrstuvwxyz./%+-' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_____'` @ 1.5 log @*** empty log message *** @ text @d232 2 a233 1 ** @@FILE@@ -- Version File (automatically generated and maintained by shtool) d236 1 a236 1 #ifdef AS_HEADER d238 2 a239 2 #ifndef @@FILESTR@@ #define @@FILESTR@@ d249 1 a249 1 #endif d269 2 a270 1 ## @@FILE@@ -- Version File (automatically generated and maintained by shtool) @ 1.4 log @*** empty log message *** @ text @d71 3 d211 9 a219 1 tmpfile="/tmp/version.tmp.$$" @ 1.3 log @*** empty log message *** @ text @d265 1 a265 1 $@@PREFIX@@_RCSIdentID = "\$Id: @@NAME@@ @@VERSION@@.@@REVISION@@@@BPTYPE@@@@BPLEVEL@@ @@DAY@@-@@MONTH@@-@@YEAR@@ \$"; @ 1.2 log @*** empty log message *** @ text @d157 1 a157 1 FILESTR=`echo "$FILE" | tr '[a-z./%+\-]' '[A-Z______]'` @ 1.1 log @Initial revision @ text @d1 1 a1 1 #!/bin/sh - d5 1 a5 1 ## Usage: version [-l ] [-n ] [-p ] [-v ] [-i ] [-d ] d21 1 a21 1 -v) FULLVERSION=$2; shift; shift; continue ;; d40 1 a40 1 echo "-v .[.pb]

set version string" d221 1 a221 1 ** @@FILE@@ -- Version File (automatically generated and maintained by VERSION) d257 1 a257 1 ## @@FILE@@ -- Version File (automatically generated and maintained by VERSION) @ 1.1.1.1 log @Import of shtool 1.1.0 @ text @@ 1.1.1.2 log @Import of shtool 1.2.0 @ text @d221 1 a221 1 ** @@FILE@@ -- Version File (automatically generated and maintained by shtool) d257 1 a257 1 ## @@FILE@@ -- Version File (automatically generated and maintained by shtool) @