"Fossies" - the Fresh Open Source Software Archive

Member "nss_ldap-265/vers_string" (6 Nov 2009, 3172 Bytes) of package /linux/privat/old/nss_ldap-265.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/usr/bin/perl
    2 #
    3 #ident $Id: vers_string,v 2.1 2009/11/06 10:26:22 lukeh Exp $
    4 #
    5 # Implementation of SGS vers_string which uses CVSVersionInfo.txt.
    6 
    7 require "cvslib.pl";
    8 
    9 $OUTFILE = (-f "version.h") ? "version.h" : "vers.c";
   10 $AUTHOR = `whoami`;
   11 $HEADER = '$Id: vers_string,v 2.1 2009/11/06 10:26:22 lukeh Exp $';
   12 
   13 if ($ENV{'PROGRAM'}) { $PROGRAM = $ENV{'PROGRAM'}; }
   14 
   15 chop($AUTHOR);
   16 chop($DATE=`date -u`);
   17 chop($CWD=`pwd`);
   18 
   19 ($PROJECT, $VERSION) = split(/\-/, &getCVSVersionInfo());
   20 
   21 if (!defined($PROJECT)) {
   22     $PROJECT = "Unknown";
   23     $PROGRAM = "Unknown";
   24 } else {
   25     $SEP = "-";
   26     if (!defined($PROGRAM)) {
   27         chop($PROGRAM=`basename $CWD`);
   28     }
   29 }
   30 
   31 if ($ARGV[0] eq "-f") {
   32     print $PROJECT, $SEP, $VERSION, "\n";
   33 } elsif ($ARGV[0] eq "-l") {
   34     print "static const char SGS_VERS[160] = \"";
   35     print '@(#)LIBRARY:', $PROGRAM, '  PROJECT:', $PROJECT, $SEP, $VERSION, '  DEVELOPER:', $AUTHOR,  '  BUILT:', $DATE;
   36     print "\";\n";
   37 } elsif ($ARGV[0] eq "-c") {
   38     print "const char SGS_VERS[160] = \"";
   39     print '@(#)PROGRAM:', $PROGRAM, '  PROJECT:', $PROJECT, $SEP, $VERSION, '  DEVELOPER:', $AUTHOR,  '  BUILT:', $DATE;
   40     print "\";\n";
   41     print "const char VERS_NUM[10] = \"$VERSION\";\n";
   42 } elsif ($ARGV[0] eq "-n") {
   43     print "$VERSION\n";
   44 } elsif ($ARGV[0] eq "-B") {
   45     print 'PROGRAM:', $PROGRAM, '  PROJECT:', $PROJECT, $SEP, $VERSION, '  DEVELOPER:', $AUTHOR,  '  BUILT:NO DATE SET (-B used)',"\n";
   46 } elsif ($ARGV[0] eq "-v") {
   47     unlink($OUTFILE);
   48     open(OUTFILE,">$OUTFILE");
   49     print OUTFILE "/* $OUTFILE built by $HEADER */\n";
   50     print OUTFILE "\n";
   51     if ($OUTFILE eq "version.h") {
   52         print OUTFILE "#define USE_SGS_VERS\n\n";
   53     }
   54     print OUTFILE "const char SGS_VERS[160] = \"";
   55     print OUTFILE '@(#)PROGRAM:', $PROGRAM, '  PROJECT:', $PROJECT, $SEP, $VERSION, '  DEVELOPER:', $AUTHOR,  '  BUILT:', $DATE;
   56     print OUTFILE "\";\n\n";
   57     print OUTFILE "const char VERS_NUM[10] = \"$VERSION\";\n\n";
   58     close(OUTFILE);
   59 } elsif ($ARGV[0] ne "") {
   60     print STDERR "$HEADER\n";
   61     print STDERR "Copyright (C) 1997-1998 Luke Howard <lukeh\@gday.net.au>";
   62     print STDERR "\n\n";
   63     print STDERR "Unknown command line option $ARGV[0].\n";
   64     print STDERR "Usage: vers_string [-f|-l|-c|-n|-B|-v]\n";
   65     print STDERR "\t-f: echo project-n to stdout\n";
   66     print STDERR "\t-l: echo static const char SGS_VERS to stdout\n";
   67     print STDERR "\t-c: echo const char VERS_NUM and SGS_VERS to stdout\n";
   68     print STDERR "\t-n: echo version number to stdout\n";
   69     print STDERR "\t-B: emulate vers_string -B (why?)\n";
   70     print STDERR "\t-v: generate $OUTFILE\n";
   71     print STDERR "\tother options same as vers_string\n";
   72     print STDERR "\n";
   73     print STDERR "\tTo attach a project name and version number to a CVS\n";
   74     print STDERR "\tmodule, use checkpoint\n";
   75     print STDERR "\tTo find out the current project version, type cvsver\n";
   76     print STDERR "\tTo create a new project, type cvsnew [project]\n";
   77     print STDERR "\tTo sync with an existing project, type cvssync\n";
   78     print STDERR "\tTo create a project distribution, type tarup\n";
   79     print STDERR "\tTo commit a project, type commit [message]\n";
   80 } else {
   81     print 'PROGRAM:', $PROGRAM, '  PROJECT:', $PROJECT, $SEP, $VERSION, '  DEVELOPER:', $AUTHOR,  '  BUILT:', $DATE;
   82     print "\n";
   83 }