FreeCalypso > hg > tcs211-fcmodem
comparison g23m/system/busyb/tools/make_ver.pl @ 0:509db1a7b7b8
initial import: leo2moko-r1
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jun 2015 03:24:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:509db1a7b7b8 |
---|---|
1 $argcount = @ARGV; | |
2 if ($argcount < 2) | |
3 { | |
4 die "Usage: perl make_ver.pl [version_file] [filename]+ \n"; | |
5 } | |
6 | |
7 my $outfile=$ARGV[0]; | |
8 chomp $outfile; | |
9 my $directory=$ARGV[1]; | |
10 chomp $directory; | |
11 | |
12 # convert forslashes to backslashes | |
13 while ($outfile =~ s/\//\\/) {}; | |
14 while ($directory =~ s/\//\\/) {}; | |
15 | |
16 #open the version file | |
17 open(CFILE,">$outfile")||die "can't create c file for versionning\n"; | |
18 | |
19 # | |
20 # extract (last sub) directory name from file name and path | |
21 # | |
22 $directory =~ s|(.*)\\||; | |
23 $directory = $+; | |
24 $directory =~ s|.*\\||; | |
25 $directory=lc($directory); | |
26 | |
27 | |
28 if (system("cleartool -ver 2> NUL") == 0) | |
29 { | |
30 $view=`cleartool pwv -s`; | |
31 chomp $view; | |
32 } | |
33 else | |
34 { | |
35 $view="non_clearcase"; | |
36 chomp $view; | |
37 } | |
38 $user=$ENV{"USERNAME"}; | |
39 $view = substr($view.(' ' x 14), 0, 14); | |
40 $user = substr $user, 0, 4; | |
41 $time = time; | |
42 ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($time); | |
43 if($year >= 100) | |
44 { | |
45 $year -= 100; | |
46 } | |
47 $time=sprintf ("%02d:%02d:%02d %02d/%02d/%02d",$hour,$min,$sec,$mday,$mon+1,$year); | |
48 $version=$user." ".$view." ".$time; | |
49 print CFILE"static char* verstring_$directory = \"$directory $version\" ;\n"; | |
50 print CFILE"extern char* ${directory}_version(void){\n"; | |
51 print CFILE"return verstring_$directory ;}"; | |
52 close CFILE; |