#!/usr/bin/perl
# begin_generated_IBM_copyright_prolog                             
#                                                                  
# This is an automatically generated copyright prolog.             
# After initializing,  DO NOT MODIFY OR MOVE                       
# **************************************************************** 
# Licensed Materials - Property of IBM                             
# 5724-Y95                                                         
# (C) Copyright IBM Corp.  2014, 2014    All Rights Reserved.      
# US Government Users Restricted Rights - Use, duplication or      
# disclosure restricted by GSA ADP Schedule Contract with          
# IBM Corp.                                                        
#                                                                  
# end_generated_IBM_copyright_prolog                               
use strict;
use warnings;
use FindBin;
use lib "${FindBin::Bin}";
use lib "${FindBin::Bin}/../system/impl/bin";
use SPL::Helper;
use SPL::Msg; # load message constants

sub escape($);

my $binDir = ${FindBin::Bin};
my $java = $binDir . "/../java/bin/java";
my $splAppInfoJar = $binDir . "/../system/impl/lib/com.ibm.streams.spl-app-info.jar";
my $classPath = "-classpath $splAppInfoJar";

my $options = "";
while (scalar @ARGV > 0) {
    my $arg = shift;
    $arg = escape($arg);
    $options .= " $arg";
}

my $cmd = "$java $classPath com.ibm.streams.splappinfo.core.Main $options";
my $rc = system($cmd);
$rc = $rc >> 8;
exit($rc);

sub escape($)
{
    my ($str) = @_;
    $str =~ s/(['"])/\\$1/g;
    return $str;
}
