File: version.pl

package info (click to toggle)
mol 0.9.61-6
  • links: PTS
  • area: contrib
  • in suites: woody
  • size: 6,140 kB
  • ctags: 8,491
  • sloc: ansic: 50,560; asm: 2,826; sh: 458; makefile: 373; perl: 165; lex: 135; yacc: 131
file content (25 lines) | stat: -rwxr-xr-x 542 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
23
24
25
#!/usr/bin/perl -w
#
# A simple perl script to extract the version number
# from include/version.

#$a=`cat include/version.h`;
#$c=`cat patchlevel.h`;

$a = `cat $ARGV[0]`;
if( $#ARGV == 1 ) {
    $c = `cat $ARGV[1]`;
}

@A = $a =~ /#define[\t ][\t ]*MAJOR_VERSION[\t ][\t ]*(\w*)/g;
@B = $a =~ /#define[\t ][\t ]*MINOR_VERSION[\t ][\t ]*(\w*)/g;
if( $#ARGV == 1 ) {
    @C = $c =~ /#define[\t ][\t ]*PATCH_LEVEL[\t ][\t ]*(\w*)/g;
}

if( $#ARGV == 1 ) {
    print $A[0].".".$B[0].".".$C[0]."\n";
} else {
    print $A[0].".".$B[0]."\n";
}