#!/usr/bin/perl

#######################################################
#
# Script name: jpatchapply
#
# Author: Alex Arkhipov
#
# Description: This script scans jar patch directory
#  and prints list of all jar files from that 
#  directory
# 
# Note: To be patchable each application has to 
# follow the next rule. In the starting command
# each java application has to have output of the 
# jpatchapply script as a first classpath
# parameter. 
# For example in perl:
# java -classpath jpatchapply.other_class_paths java_class_name
#
# INPUT: none
#
# Date: January 2006
#
#######################################################

use lib "/opt/nortel/base/lib";

use warnings;

use patchutil::patches_target;  # common data

my $ext="jar";
my $jar_patch_dir = "$PATCHDIR/$ext/";
my $filelist="";
my $file;

if(!opendir(Dir, $jar_patch_dir))
{
  exit(0);
}
  
while ($file = readdir(Dir))
{
  # find all jar patches
  if(($file =~ /\.jar$/i))
  {
    $filelist.="$jar_patch_dir$file:";
  }
} # while ($file = readdir(Dir))

closedir(Dir);

print("$filelist");

exit 0;

