File: version.pl

package info (click to toggle)
mol 0.9.71.dfsg-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 7,612 kB
  • ctags: 12,442
  • sloc: ansic: 65,368; asm: 3,437; makefile: 793; sh: 710; yacc: 706; lex: 501; perl: 160; cpp: 121; pascal: 18
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";
}