Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:21:54

0001 #!/usr/bin/perl
0002 
0003 use Getopt::Std;
0004 
0005 our  $PreinitMacroDef = "preinit.mac";
0006 our  $InitMacroDef = "init.mac";
0007 our  $OverrideOpt = "";
0008 
0009 sub  PrintUsage
0010 {
0011     print "Usage: [-p preinit_macro] [-m init_macro] [-r suffix] [-y] job_id\n";
0012     print "\tThis program will create a job script for starting a new ";
0013     print "project\n\t\t<job_id>; the job script name will be prepended by ";
0014     print "'cexmc_'\n\t\tand appended by '_<suffix>' if '-r' is specified\n";
0015     print "\tDefault preinit_macro is '$PreinitMacroDef', default init_macro ";
0016     print "is '$InitMacroDef'\n";
0017     print "\tIf '-r' is specified then a project <job_id> will be read and a ";
0018     print "new\n\t\tproject <job_id>_<suffix> will be started; preinit_macro\n";
0019     print "\t\tin this case will be ignored\n";
0020     print "\tUse '-y' to override existing project\n";
0021 }
0022 
0023 sub VERSION_MESSAGE
0024 {
0025     PrintUsage;
0026     exit 0;
0027 }
0028 
0029 getopts( "m:p:r:y" );
0030 
0031 unless ( $ARGV[ 0 ] )
0032 {
0033     PrintUsage;
0034     exit 1;
0035 }
0036 
0037 $opt_p ||= $PreinitMacroDef;
0038 $opt_m ||= $InitMacroDef;
0039 $opt_r &&= "_$opt_r";
0040 $OverrideOpt = "-y" if $opt_y;
0041 
0042 open ( JOBFILE, "> cexmc_$ARGV[ 0 ]$opt_r.job" ) or die $!;
0043 print JOBFILE "#!/bin/sh\n";
0044 print JOBFILE "CEXMC_PROJECTS_DIR=" . $ENV{ 'CEXMC_PROJECTS_DIR' } . "\n";
0045 print JOBFILE "PATH=" . $ENV{ 'PATH' } . "\n";
0046 print JOBFILE "LD_LIBRARY_PATH=" . $ENV{ 'LD_LIBRARY_PATH' } . "\n";
0047 if ( $opt_r )
0048 {
0049     print JOBFILE "cexmc -m$opt_m $OverrideOpt -r$ARGV[ 0 ] ";
0050     print JOBFILE "-w$ARGV[ 0 ]$opt_r\n";
0051 }
0052 else
0053 {
0054     print JOBFILE "cexmc -p$opt_p -m$opt_m $OverrideOpt -w$ARGV[ 0 ]\n";
0055 }
0056 
0057 close ( JOBFILE ) or die $!;