releasing/cbrtools/perl/EnvData.bat
author jjkang
Fri, 25 Jun 2010 19:56:45 +0800
changeset 604 b33dd54aaa52
parent 602 3145852acc89
permissions -rw-r--r--
add cpptoolsplat
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
602
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     1
@REM Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     2
@REM All rights reserved.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     3
@REM This component and the accompanying materials are made available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     4
@REM under the terms of the License "Eclipse Public License v1.0"
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     5
@REM which accompanies this distribution, and is available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     6
@REM at the URL "http://www.eclipse.org/legal/epl-v10.html".
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     7
@REM 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     8
@REM Initial Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     9
@REM Nokia Corporation - initial contribution.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    10
@REM 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    11
@REM Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    12
@REM 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    13
@REM Description:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    14
@REM 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    15
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    16
@rem = '--*-Perl-*--
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    17
@echo off
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    18
if "%OS%" == "Windows_NT" goto WinNT
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    19
perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    20
goto endofperl
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    21
:WinNT
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    22
perl -w -x -S "%0" %*
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    23
if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    24
if %errorlevel% == 9009 echo You do not have Perl in your PATH.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    25
if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    26
goto endofperl
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    27
@rem ';
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    28
#!perl -w
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    29
#line 15
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    30
$0 =~ s|\.bat||i;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    31
unless (-f $0) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    32
    $0 =~ s|.*[/\\]||;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    33
    for (".", split ';', $ENV{PATH}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    34
	$_ = "." if $_ eq "";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    35
	$0 = "$_/$0" , goto doit if -f "$_/$0";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    36
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    37
    die "`$0' not found.\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    38
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    39
doit: exec "perl", "-x", $0, @ARGV;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    40
die "Failed to exec `$0': $!";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    41
__END__
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    42
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    43
=head1 NAME
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    44
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    45
runperl.bat - "universal" batch file to run perl scripts
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    46
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    47
=head1 SYNOPSIS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    48
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    49
	C:\> copy runperl.bat foo.bat
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    50
	C:\> foo
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    51
	[..runs the perl script `foo'..]
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    52
	
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    53
	C:\> foo.bat
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    54
	[..runs the perl script `foo'..]
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    55
	
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    56
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    57
=head1 DESCRIPTION
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    58
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    59
This file can be copied to any file name ending in the ".bat" suffix.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    60
When executed on a DOS-like operating system, it will invoke the perl
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    61
script of the same name, but without the ".bat" suffix.  It will
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    62
look for the script in the same directory as itself, and then in
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    63
the current directory, and then search the directories in your PATH.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    64
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    65
It relies on the C<exec()> operator, so you will need to make sure
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    66
that works in your perl.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    67
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    68
This method of invoking perl scripts has some advantages over
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    69
batch-file wrappers like C<pl2bat.bat>:  it avoids duplication
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    70
of all the code; it ensures C<$0> contains the same name as the
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    71
executing file, without any egregious ".bat" suffix; it allows
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    72
you to separate your perl scripts from the wrapper used to
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    73
run them; since the wrapper is generic, you can use symbolic
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    74
links to simply link to C<runperl.bat>, if you are serving your
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    75
files on a filesystem that supports that.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    76
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    77
On the other hand, if the batch file is invoked with the ".bat"
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    78
suffix, it does an extra C<exec()>.  This may be a performance
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    79
issue.  You can avoid this by running it without specifying
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    80
the ".bat" suffix.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    81
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    82
Perl is invoked with the -x flag, so the script must contain
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    83
a C<#!perl> line.  Any flags found on that line will be honored.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    84
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    85
=head1 BUGS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    86
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    87
Perl is invoked with the -S flag, so it will search the PATH to find
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    88
the script.  This may have undesirable effects.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    89
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    90
=head1 SEE ALSO
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    91
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    92
perl, perlwin32, pl2bat.bat
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    93
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    94
=cut
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    95
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    96
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    97
__END__
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    98
:endofperl