⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 newvers

📁 smtp客户端工具源代码。
💻
字号:
#!/bin/sh -####   NEWVERS -- setup new program version file##   Copyright (c) 1994-1997 Ralf S. Engelschall, <rse@engelschall.com>####   NOTICE: This intentionally written in Bourne-Shell instead##           of my preferred language Perl because this is also##           used as a version display tool in "./configire" steps...##VERSION="2.2.2"   DATE="02-06-1997"#   print version information lineprint_version () {    echo "This is NEWVERS, Version $VERSION ($DATE)"}#   give general help informationprint_help () {    cat <<'EOT'NEWVERS -- generate/maintain a version information fileCopyright (c) 1994-1997 Ralf S. Engelschall, <rse@engelschall.com>NEWVERS will create and update a version information file,which can be setup in either plain text or the C or Perl language.Examples:    $ newvers -m txt  -p TestProg version.txt    $ newvers -m c    -p TestProg version.c    $ newvers -m perl -p TestProg version.plEOT}#   give usage informationprint_usage () {    cat <<'EOT'Usage: newvers [options] versionfile    Options are:        -l<lang>          set language to one of "txt", "c" or "perl"         -p<progname>      set program name        -r<v>.<r>[.pb]<p> set release version string        -i{v|r|P|p|b|a|s} increase version, revision or {alpha,batch,patch,snap}level        -d                display current version only        -D                display current version only (incl. date)        -V                print NEWVERS version        -h                print help pageEOT}#   process the argument lineLANGUAGE=unknownPROGNAME="-UNKNOWN-"VERSION=unknownREPORT=NOREPORTFULL=NOINCREASE=P#   fallback if "getopt" is not available on systemgetopt=getopteval "$getopt" >/dev/null 2>&1if [ $? -ne 0 ]; then    rm -f /tmp/getopt.c >/dev/null 2>&1    cat >/tmp/getopt.c <<EOT#include <stdio.h>main(argc, argv)int argc;char *argv[];{    extern int optind;    extern char *optarg;    int c;    int status = 0;    optind = 2; /* Past the program name and the option letters. */    while ((c = getopt(argc, argv, argv[1])) != EOF)        switch (c) {        case '?':            status = 1; /* getopt routine gave message */            break;        default:            if (optarg != NULL)                printf(" -%c %s", c, optarg);            else                printf(" -%c", c);            break;        }    printf(" --");    for (; optind < argc; optind++)        printf(" %s", argv[optind]);    printf("\n");    exit(status);}EOT        cc -o /tmp/getopt /tmp/getopt.c    getopt=/tmp/getoptfiset -- `$getopt l:p:r:i:dDVh $*`if [ $? != 0 ]; then    print_usage    exit 2firm -f /tmp/getopt >/dev/null 2>&1for opt in $*; do    case $opt in        -l)  LANGUAGE=$2;      shift; shift  ;;        -p)  PROGNAME=$2;      shift; shift  ;;        -r)  VERSION=$2;       shift; shift  ;;        -i)  INCREASE=$2;      shift; shift  ;;        -d)  REPORT=YES;              shift ;;        -D)  REPORT=YES; REPORTFULL=YES; shift ;;        -V)  print_version;           exit 0 ;;          -h)  print_help; print_usage; exit 0 ;;          --)                    shift; break  ;;    esacdonecase $# in    1) VERSIONFILE=$1 ;;    *) print_usage; exit 1 ;;esac#   determine languageif [ "$LANGUAGE" = "unknown" ]; then    case $VERSIONFILE in        *.txt )       LANGUAGE=txt  ;;        *.c )         LANGUAGE=c    ;;        *.pl | *.pm ) LANGUAGE=perl ;;        * )           echo "Unkown language type"; exit 1 ;;    esacfi#   determine versionif [ "$VERSION" = "unknown" ]; then    if [ -r "$VERSIONFILE" ]; then        #   grep out current information        id=`grep 'Version [0-9]*.[0-9]*[.abps][0-9]* ([0-9]*-[0-9]*-[0-9]*)' $VERSIONFILE | \            head -1 | \            sed -e 's%.*Version \([0-9]*\)\.\([0-9]*\)\([.abps]\)\([0-9]*\) (\([0-9]*-[0-9]*-[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`                    bplevel=0                    ;;                v )                    version=`expr $version + 1`                    revision=0                    bplevel=0                    ;;            esac            date=`date '+%d-%m-19%y'`        fi    else        #   intialise to first version        version=0        revision=5        bptype=b        bplevel=0        date=`date '+%d-%m-19%y'`    fielse    #   take given version    VERSION=`echo $VERSION | sed -e 's%\([0-9]*\)\.\([0-9]*\)\([.abps]\)\([0-9]*\).*%\1:\2:\3:\4%'`    version=`echo $VERSION | awk -F: '{ print $1 }'`    revision=`echo $VERSION | awk -F: '{ print $2 }'`    bptype=`echo $VERSION | awk -F: '{ print $3 }'`    bplevel=`echo $VERSION | awk -F: '{ print $4 }'`    date=`date '+%d-%m-19%y'`fiif [ $REPORT = YES ]; then    if [ $REPORTFULL = YES ]; then        echo "$version.$revision$bptype$bplevel ($date)"    else        echo "$version.$revision$bptype$bplevel"    fi    exit 0;else    echo "new version: $version.$revision$bptype$bplevel ($date)"fi#   create date stringyear=`date '+19%y'`month=`date '+%m'`day=`date '+%d'`#   create the version file according the the selected language  tmpfile="/tmp/newvers.tmp.$$"rm -f $tmpfilecase $LANGUAGE in    txt )        cat >$tmpfile <<'EOF'  This is @PROGNAME@ Version @VERSION@.@REVISION@@BPTYPE@@BPLEVEL@ (@DAY@-@MONTH@-@YEAR@)EOF        ;;    c )        cat >$tmpfile <<'EOF'/* !! This file was automatically generated by NEWVERS !! *//* for logfiles, etc. */char @PROGNAME@_Version[] =    "@VERSION@.@REVISION@@BPTYPE@@BPLEVEL@ (@DAY@-@MONTH@-@YEAR@)";/* interactive 'hello' string to identify us to the user */char @PROGNAME@_Hello[] =     "This is @PROGNAME@ Version @VERSION@.@REVISION@@BPTYPE@@BPLEVEL@ (@DAY@-@MONTH@-@YEAR@)";/* a GNU --version output */char @PROGNAME@_GNUVersion[] =    "@PROGNAME@ Version @VERSION@.@REVISION@@BPTYPE@@BPLEVEL@";/* a UNIX what(1) id string */char @PROGNAME@_WhatID[] =    "@(#)@PROGNAME@ Version @VERSION@.@REVISION@@BPTYPE@@BPLEVEL@ (@DAY@-@MONTH@-@YEAR@)";/* a RCS ident(1) id string */char @PROGNAME@_RCSIdentID[] =    "$Id: @PROGNAME@ @VERSION@.@REVISION@@BPTYPE@@BPLEVEL@ @DAY@-@MONTH@-@YEAR@ $";/* a WWW id string */char @PROGNAME@_WebID[] =    "@PROGNAME@/@VERSION@.@REVISION@@BPTYPE@@BPLEVEL@";/* a plain id string */char @PROGNAME@_PlainID[] =    "@VERSION@.@REVISION@@BPTYPE@@BPLEVEL@";EOF        ;;    perl )        cat >$tmpfile <<'EOF'# !! This file was automatically generated by NEWVERS !!package Vers;# for logfiles, etc.$@PROGNAME@_Version =    "@VERSION@.@REVISION@@BPTYPE@@BPLEVEL@ (@DAY@-@MONTH@-@YEAR@)";# interactive 'hello' string to identify us to the user$@PROGNAME@_Hello =     "This is @PROGNAME@ Version @VERSION@.@REVISION@@BPTYPE@@BPLEVEL@ (@DAY@-@MONTH@-@YEAR@)";# a GNU --version output$@PROGNAME@_GNUVersion =    "@PROGNAME@ Version @VERSION@.@REVISION@@BPTYPE@@BPLEVEL@";# a UNIX what(1) id string$@PROGNAME@_WhatID =    "@(#)@PROGNAME@ Version @VERSION@.@REVISION@@BPTYPE@@BPLEVEL@ (@DAY@-@MONTH@-@YEAR@)";# a RCS ident(1) id string$@PROGNAME@_RCSIdentID =    "\$Id: @PROGNAME@ @VERSION@.@REVISION@@BPTYPE@@BPLEVEL@ @DAY@-@MONTH@-@YEAR@ \$";# a WWW id string$@PROGNAME@_WebID =    "@PROGNAME@/@VERSION@.@REVISION@@BPTYPE@@BPLEVEL@";# a plain id string$@PROGNAME@_PlainID =    "@VERSION@.@REVISION@@BPTYPE@@BPLEVEL@";1;EOF        ;;    * ) print_usage; exit 1        ;;esacrm -f $VERSIONFILE#   now create the version filesed \-e "s|@PROGNAME@|$PROGNAME|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 >$VERSIONFILErm -f $tmpfile##EOF##

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -