forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathctutils.pl
More file actions
47 lines (42 loc) · 934 Bytes
/
ctutils.pl
File metadata and controls
47 lines (42 loc) · 934 Bytes
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# evaluate the given parameter to expand shell variables
sub CTUShellEval {
local( *CTUSEFILE ) ;
open( CTUSEFILE, "echo $_[0] |" ) ;
local( $CTUSEret ) = <CTUSEFILE> ;
close( CTUSEFILE ) ;
$CTUSEret =~ s/\n$// ;
$CTUSEret ;
}
# if debug is on, print the argument
sub CTUDebug {
if ( $ctdebug ) {
print STDERR $_[0] ;
}
}
use Cwd ;
# get current directory
sub CTUCurrDir {
local( $pwd ) = getcwd() ;
if ( $pwd =~ /^\/vobs/ ) {
local( *VFILE ) ;
open( VFILE, "cleartool pwv -short |" ) ;
local( $view ) = <VFILE> ;
close( VFILE ) ;
$view =~ s/\n$// ;
$pwd = "/view/" . $view . $pwd ;
}
$pwd ;
}
# turn a shell return code into a success/fail flag
sub CTURetCode {
local( $ret ) ;
if ( $_[0] == 0 ) {
$ret = 1 ;
} else {
$ret = 0 ;
}
$ret ;
}
$ctdebug = $ENV{"CTATTACH_DEBUG"} ;
$ctvspec_path = '/usr/local/etc' unless $ctvspec_path = $ENV{'CTVSPEC_PATH'};
1;