#!/usr/bin/ksh # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # bos720 src/bos/usr/sbin/adump/adump.perl5 1.6 # # Licensed Materials - Property of IBM # # COPYRIGHT International Business Machines Corp. 1999,2002 # All Rights Reserved # # US Government Users Restricted Rights - Use, duplication or # disclosure restricted by GSA ADP Schedule Contract with IBM Corp. # # IBM_PROLOG_END_TAG # @(#)50 1.5 src/bos/usr/sbin/adump/adump.perl5, kdb, bos510 11/20/00 11:02:55 # # COMPONENT_NAME: kdb # # FUNCTIONS: adump command for AUTOMATED DUMP # # ORIGINS: 83 # # # (C) COPYRIGHT International Business Machines Corp. 1999 # All Rights Reserved # Licensed Materials - Property of IBM # US Government Users Restricted Rights - Use, duplication or # disclosure restricted by GSA ADP Schedule Contract with IBM Corp. # ################################################################# # # adump command # ################################################################# # # Start with ksh script code to test whether Perl is installed. If it # is installed, invoke it with the option that makes Perl search for the # #!/usr/bin/perl line before it begins executing. If it's not installed # issue an error message and exit. # if [ -x /usr/bin/perl ]; then exec /usr/bin/perl -x -S $0 $* else echo "This command requires perl.\nPlease install perl if you wish to run this command." exit 1 fi # # The Perl code starts here. # #!/usr/bin/perl -w -- ### Build a string with the arguments to apply the search pattern to $arg = join ' ',(@ARGV); ### Check the options or display usage $usage = "Usage:\tadump [-i] [-d DumpFile] [-k KdbUserCmd] [-u UnixFile] [-s ScriptFile]\n\n\t\t-i use of interactive mode\n\t\t With -s the specified script is executed before the command prompts.\n\t\t-d default is last dump on primary dump device\n\t\t-k default is /usr/sbin/kdb\n\t\t-u default is /unix\n\t\t-s default is /usr/lib/kdb/adump.pm\n"; `getopt d:k:s:u:i $arg 2>/dev/null`; if ($?) { print STDOUT $usage; exit 1}; ### Search the name of the script to be launched ### The pattern looks for the option -s followed by a file name - ### all UNIX qualified pathnames are supported - ( $myscript ) = $arg =~ /-s\s+([\.\/\w]+)/ ; $isinter = $arg =~ /-i\s*/ ; if ( $isinter ) { $myscript = '/usr/lib/kdb/inter.pm'; } else { ### A script name is specified OR the default script will be launched $myscript ||= '/usr/lib/kdb/adump.pm'; } ### Call the script exec "/usr/bin/perl -I/usr/lib/kdb -Minit $myscript $arg";