12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802 |
- #if 0
- # define module_name VMS_ZIP_CMDLINE
- # define module_ident "02-006"
- #endif
- #if 0
- # if defined(__DECC) || defined(__GNUC__)
- # pragma module module_name module_ident
- # else
- # module module_name module_ident
- # endif
- #endif
- #define lib$establish LIB$ESTABLISH
- #define lib$get_foreign LIB$GET_FOREIGN
- #define lib$get_input LIB$GET_INPUT
- #define lib$sig_to_ret LIB$SIG_TO_RET
- #define ots$cvt_tu_l OTS$CVT_TU_L
- #define str$concat STR$CONCAT
- #define str$find_first_substring STR$FIND_FIRST_SUBSTRING
- #define str$free1_dx STR$FREE1_DX
- #include "zip.h"
- #ifndef TEST
- #include "crypt.h"
- #include "revision.h"
- #endif
- #include <ssdef.h>
- #include <descrip.h>
- #include <climsgdef.h>
- #include <clidef.h>
- #include <lib$routines.h>
- #include <ots$routines.h>
- #include <str$routines.h>
- #ifndef CLI$_COMMA
- globalvalue CLI$_COMMA;
- #endif
- #define init_dyndesc(dsc) {\
- dsc.dsc$w_length = 0;\
- dsc.dsc$b_dtype = DSC$K_DTYPE_T;\
- dsc.dsc$b_class = DSC$K_CLASS_D;\
- dsc.dsc$a_pointer = NULL;}
- #define ARGBSIZE_UNIT 256
- #define CHECK_BUFFER_ALLOCATION(buf, reserved, requested) { \
- if ((requested) > (reserved)) { \
- char *save_buf = (buf); \
- (reserved) += ARGBSIZE_UNIT; \
- if (((buf) = (char *) realloc((buf), (reserved))) == NULL) { \
- if (save_buf != NULL) free(save_buf); \
- return (SS$_INSFMEM); \
- } \
- } \
- }
- $DESCRIPTOR(cli_delete, "DELETE");
- $DESCRIPTOR(cli_freshen, "FRESHEN");
- $DESCRIPTOR(cli_move, "MOVE");
- $DESCRIPTOR(cli_update, "UPDATE");
- $DESCRIPTOR(cli_exclude, "EXCLUDE");
- $DESCRIPTOR(cli_include, "INCLUDE");
- $DESCRIPTOR(cli_exlist, "EXLIST");
- $DESCRIPTOR(cli_inlist, "INLIST");
- $DESCRIPTOR(cli_adjust, "ADJUST_OFFSETS");
- $DESCRIPTOR(cli_append, "APPEND");
- $DESCRIPTOR(cli_batch, "BATCH");
- $DESCRIPTOR(cli_before, "BEFORE");
- $DESCRIPTOR(cli_comments, "COMMENTS");
- $DESCRIPTOR(cli_comment_archive,"COMMENTS.ARCHIVE");
- $DESCRIPTOR(cli_comment_zipfile,"COMMENTS.ZIP_FILE");
- $DESCRIPTOR(cli_comment_files, "COMMENTS.FILES");
- $DESCRIPTOR(cli_compression, "COMPRESSION");
- $DESCRIPTOR(cli_compression_b, "COMPRESSION.BZIP2");
- $DESCRIPTOR(cli_compression_d, "COMPRESSION.DEFLATE");
- $DESCRIPTOR(cli_compression_s, "COMPRESSION.STORE");
- $DESCRIPTOR(cli_copy_entries, "COPY_ENTRIES");
- $DESCRIPTOR(cli_descriptors, "DESCRIPTORS");
- $DESCRIPTOR(cli_difference, "DIFFERENCE");
- $DESCRIPTOR(cli_dirnames, "DIRNAMES");
- $DESCRIPTOR(cli_display, "DISPLAY");
- $DESCRIPTOR(cli_display_bytes, "DISPLAY.BYTES");
- $DESCRIPTOR(cli_display_counts, "DISPLAY.COUNTS");
- $DESCRIPTOR(cli_display_dots, "DISPLAY.DOTS");
- $DESCRIPTOR(cli_display_globaldots, "DISPLAY.GLOBALDOTS");
- $DESCRIPTOR(cli_display_usize, "DISPLAY.USIZE");
- $DESCRIPTOR(cli_display_volume, "DISPLAY.VOLUME");
- $DESCRIPTOR(cli_dot_version, "DOT_VERSION");
- $DESCRIPTOR(cli_encrypt, "ENCRYPT");
- $DESCRIPTOR(cli_extra_fields, "EXTRA_FIELDS");
- $DESCRIPTOR(cli_extra_fields_normal, "EXTRA_FIELDS.NORMAL");
- $DESCRIPTOR(cli_extra_fields_keep, "EXTRA_FIELDS.KEEP_EXISTING");
- $DESCRIPTOR(cli_filesync, "FILESYNC");
- $DESCRIPTOR(cli_fix_archive, "FIX_ARCHIVE");
- $DESCRIPTOR(cli_fix_normal, "FIX_ARCHIVE.NORMAL");
- $DESCRIPTOR(cli_fix_full, "FIX_ARCHIVE.FULL");
- $DESCRIPTOR(cli_full_path, "FULL_PATH");
- $DESCRIPTOR(cli_grow, "GROW");
- $DESCRIPTOR(cli_help, "HELP");
- $DESCRIPTOR(cli_help_normal, "HELP.NORMAL");
- $DESCRIPTOR(cli_help_extended, "HELP.EXTENDED");
- $DESCRIPTOR(cli_junk, "JUNK");
- $DESCRIPTOR(cli_keep_version, "KEEP_VERSION");
- $DESCRIPTOR(cli_latest, "LATEST");
- $DESCRIPTOR(cli_level, "LEVEL");
- $DESCRIPTOR(cli_license, "LICENSE");
- $DESCRIPTOR(cli_log_file, "LOG_FILE");
- $DESCRIPTOR(cli_log_file_append, "LOG_FILE.APPEND");
- $DESCRIPTOR(cli_log_file_file, "LOG_FILE.FILE");
- $DESCRIPTOR(cli_log_file_info, "LOG_FILE.INFORMATIONAL");
- $DESCRIPTOR(cli_must_match, "MUST_MATCH");
- $DESCRIPTOR(cli_output, "OUTPUT");
- $DESCRIPTOR(cli_patt_case, "PATTERN_CASE");
- $DESCRIPTOR(cli_patt_case_blind, "PATTERN_CASE.BLIND");
- $DESCRIPTOR(cli_patt_case_sensitive, "PATTERN_CASE.SENSITIVE");
- $DESCRIPTOR(cli_pkzip, "PKZIP");
- $DESCRIPTOR(cli_pres_case, "PRESERVE_CASE");
- $DESCRIPTOR(cli_pres_case_no2, "PRESERVE_CASE.NOODS2");
- $DESCRIPTOR(cli_pres_case_no5, "PRESERVE_CASE.NOODS5");
- $DESCRIPTOR(cli_pres_case_ods2, "PRESERVE_CASE.ODS2");
- $DESCRIPTOR(cli_pres_case_ods5, "PRESERVE_CASE.ODS5");
- $DESCRIPTOR(cli_quiet, "QUIET");
- $DESCRIPTOR(cli_recurse, "RECURSE");
- $DESCRIPTOR(cli_recurse_path, "RECURSE.PATH");
- $DESCRIPTOR(cli_recurse_fnames, "RECURSE.FILENAMES");
- $DESCRIPTOR(cli_show, "SHOW");
- $DESCRIPTOR(cli_show_command, "SHOW.COMMAND");
- $DESCRIPTOR(cli_show_debug, "SHOW.DEBUG");
- $DESCRIPTOR(cli_show_files, "SHOW.FILES");
- $DESCRIPTOR(cli_show_options, "SHOW.OPTIONS");
- $DESCRIPTOR(cli_since, "SINCE");
- $DESCRIPTOR(cli_split, "SPLIT");
- $DESCRIPTOR(cli_split_bell, "SPLIT.BELL");
- $DESCRIPTOR(cli_split_pause, "SPLIT.PAUSE");
- $DESCRIPTOR(cli_split_size, "SPLIT.SIZE");
- $DESCRIPTOR(cli_split_verbose, "SPLIT.VERBOSE");
- $DESCRIPTOR(cli_store_types, "STORE_TYPES");
- $DESCRIPTOR(cli_sverbose, "SVERBOSE");
- $DESCRIPTOR(cli_symlinks, "SYMLINKS");
- $DESCRIPTOR(cli_temp_path, "TEMP_PATH");
- $DESCRIPTOR(cli_test, "TEST");
- $DESCRIPTOR(cli_test_unzip, "TEST.UNZIP");
- $DESCRIPTOR(cli_translate_eol, "TRANSLATE_EOL");
- $DESCRIPTOR(cli_transl_eol_lf, "TRANSLATE_EOL.LF");
- $DESCRIPTOR(cli_transl_eol_crlf,"TRANSLATE_EOL.CRLF");
- $DESCRIPTOR(cli_unsfx, "UNSFX");
- $DESCRIPTOR(cli_verbose, "VERBOSE");
- $DESCRIPTOR(cli_verbose_normal, "VERBOSE.NORMAL");
- $DESCRIPTOR(cli_verbose_more, "VERBOSE.MORE");
- $DESCRIPTOR(cli_verbose_debug, "VERBOSE.DEBUG");
- $DESCRIPTOR(cli_verbose_command,"VERBOSE.COMMAND");
- $DESCRIPTOR(cli_vms, "VMS");
- $DESCRIPTOR(cli_vms_all, "VMS.ALL");
- $DESCRIPTOR(cli_wildcard, "WILDCARD");
- $DESCRIPTOR(cli_wildcard_nospan,"WILDCARD.NOSPAN");
- $DESCRIPTOR(cli_yyz, "YYZ_ZIP");
- $DESCRIPTOR(cli_zip64, "ZIP64");
- $DESCRIPTOR(cli_zipfile, "ZIPFILE");
- $DESCRIPTOR(cli_infile, "INFILE");
- $DESCRIPTOR(zip_command, "zip ");
- static int show_VMSCLI_help;
- #if !defined(zip_clitable)
- # define zip_clitable ZIP_CLITABLE
- #endif
- #if defined(__DECC) || defined(__GNUC__)
- extern void *zip_clitable;
- #else
- globalref void *zip_clitable;
- #endif
- #ifndef __STARLET_LOADED
- #ifndef sys$bintim
- # define sys$bintim SYS$BINTIM
- #endif
- #ifndef sys$numtim
- # define sys$numtim SYS$NUMTIM
- #endif
- extern int sys$bintim ();
- extern int sys$numtim ();
- #endif
- #ifndef cli$dcl_parse
- # define cli$dcl_parse CLI$DCL_PARSE
- #endif
- #ifndef cli$present
- # define cli$present CLI$PRESENT
- #endif
- #ifndef cli$get_value
- # define cli$get_value CLI$GET_VALUE
- #endif
- extern unsigned long cli$dcl_parse ();
- extern unsigned long cli$present ();
- extern unsigned long cli$get_value ();
- unsigned long vms_zip_cmdline (int *, char ***);
- static unsigned long get_list (struct dsc$descriptor_s *,
- struct dsc$descriptor_d *, int,
- char **, unsigned long *, unsigned long *);
- static unsigned long get_time (struct dsc$descriptor_s *qual, char *timearg);
- static unsigned long check_cli (struct dsc$descriptor_s *);
- static int verbose_command = 0;
- #ifdef TEST
- char errbuf[ FNMAX+ 81];
- void ziperr( int c, char *h)
- {
- printf( "%d: %s\n", c, h);
- }
- int
- main(int argc, char **argv)
- {
- return (vms_zip_cmdline(&argc, &argv));
- }
- #endif
- unsigned long
- vms_zip_cmdline (int *argc_p, char ***argv_p)
- {
- register unsigned long status;
- char options[ 64];
- char *the_cmd_line;
- unsigned long cmdl_size;
- unsigned long cmdl_len;
- char *ptr;
- int x, len;
- int new_argc;
- char **new_argv;
- struct dsc$descriptor_d work_str;
- struct dsc$descriptor_d foreign_cmdline;
- init_dyndesc(work_str);
- init_dyndesc(foreign_cmdline);
-
- show_VMSCLI_help = TRUE;
- status = check_cli(&cli_yyz);
- if (!(status & 1)) {
- lib$get_foreign(&foreign_cmdline);
-
- if (foreign_cmdline.dsc$w_length == 0)
- return (SS$_NORMAL);
- if ((*(foreign_cmdline.dsc$a_pointer) == '-') ||
- ((foreign_cmdline.dsc$w_length > 1) &&
- (*(foreign_cmdline.dsc$a_pointer) == '"') &&
- (*(foreign_cmdline.dsc$a_pointer + 1) == '-'))) {
- show_VMSCLI_help = FALSE;
- return (SS$_NORMAL);
- }
- str$concat(&work_str, &zip_command, &foreign_cmdline);
- status = cli$dcl_parse(&work_str, &zip_clitable, lib$get_input,
- lib$get_input, 0);
- if (!(status & 1)) return (status);
- }
-
- if ((the_cmd_line = (char *) malloc(cmdl_size = ARGBSIZE_UNIT)) == NULL)
- return (SS$_INSFMEM);
- strcpy(the_cmd_line, "zip");
- cmdl_len = sizeof("zip");
-
- options[0] = '-';
- ptr = &options[1];
-
- status = cli$present(&cli_copy_entries);
- if (status & 1)
-
- *ptr++ = 'U';
-
- status = cli$present(&cli_delete);
- if (status & 1)
-
- *ptr++ = 'd';
-
- status = cli$present(&cli_freshen);
- if (status & 1)
-
- *ptr++ = 'f';
-
- status = cli$present(&cli_move);
- if (status & 1)
-
- *ptr++ = 'm';
-
- status = cli$present(&cli_update);
- if (status & 1)
-
- *ptr++ = 'u';
-
- status = cli$present(&cli_level);
- if (status & 1) {
-
- unsigned long binval;
- status = cli$get_value(&cli_level, &work_str);
- status = ots$cvt_tu_l(&work_str, &binval);
- if (!(status & 1) || (binval > 9)) {
- return (SS$_ABORT);
- }
- *ptr++ = binval + '0';
- }
-
- status = cli$present(&cli_adjust);
- if (status & 1)
-
- *ptr++ = 'A';
-
- status = cli$present(&cli_comments);
- if (status & 1)
- {
- int archive_or_zip_file = 0;
- if ((status = cli$present(&cli_comment_archive)) & 1)
-
- archive_or_zip_file = 1;
- if ((status = cli$present(&cli_comment_zipfile)) & 1)
-
- archive_or_zip_file = 1;
- if (archive_or_zip_file != 0)
-
- *ptr++ = 'z';
- if ((status = cli$present(&cli_comment_files)) & 1)
-
- *ptr++ = 'c';
- }
-
- #define OPT_C "-C"
- #define OPT_CN "-C-"
- #define OPT_C2 "-C2"
- #define OPT_C2N "-C2-"
- #define OPT_C5 "-C5"
- #define OPT_C5N "-C5-"
- status = cli$present( &cli_pres_case);
- if ((status & 1) || (status == CLI$_NEGATED))
- {
-
- char *opt;
- int ods2 = 0;
- int ods5 = 0;
- if (status == CLI$_NEGATED)
- {
- x = cmdl_len;
- cmdl_len += strlen( OPT_CN)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_CN);
- }
- else
- {
- if (cli$present( &cli_pres_case_no2) & 1)
- {
-
- ods2 = -1;
- }
- if (cli$present( &cli_pres_case_no5) & 1)
- {
-
- ods5 = -1;
- }
- if (cli$present( &cli_pres_case_ods2) & 1)
- {
-
- ods2 = 1;
- }
- if (cli$present( &cli_pres_case_ods5) & 1)
- {
-
- ods5 = 1;
- }
- if (ods2 == ods5)
- {
-
- if (ods2 < 0)
- opt = OPT_CN;
- else
- opt = OPT_C;
- x = cmdl_len;
- cmdl_len += strlen( opt)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], opt);
- }
- else
- {
- if (ods2 != 0)
- {
-
- if (ods2 < 0)
- opt = OPT_C2N;
- else
- opt = OPT_C2;
- x = cmdl_len;
- cmdl_len += strlen( opt)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], opt);
- }
- if (ods5 != 0)
- {
-
- if (ods5 < 0)
- opt = OPT_C5N;
- else
- opt = OPT_C5;
- x = cmdl_len;
- cmdl_len += strlen( opt)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], opt);
- }
- }
- }
- }
-
- #define OPT_IC "-ic"
- #define OPT_ICN "-ic-"
- status = cli$present( &cli_patt_case);
- if (status & 1)
- {
- if (cli$present( &cli_patt_case_blind) & 1)
- {
-
- x = cmdl_len;
- cmdl_len += strlen( OPT_IC)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_IC);
- }
- else if (cli$present( &cli_patt_case_sensitive) & 1)
- {
-
- x = cmdl_len;
- cmdl_len += strlen( OPT_ICN)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_ICN);
- }
- }
-
- #define OPT_FD "-fd"
- status = cli$present( &cli_descriptors);
- if (status & 1)
- {
-
- x = cmdl_len;
- cmdl_len += strlen( OPT_FD)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_FD);
- }
-
- #define OPT_DF "-DF"
- if ((status = cli$present( &cli_difference)) & 1)
- {
-
- x = cmdl_len;
- cmdl_len += strlen( OPT_DF)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_DF);
- }
-
- status = cli$present(&cli_dirnames);
- if (!(status & 1))
-
- *ptr++ = 'D';
-
- status = cli$present(&cli_encrypt);
- if (status & 1)
- if ((status = cli$get_value(&cli_encrypt, &work_str)) & 1) {
-
- x = cmdl_len;
- cmdl_len += work_str.dsc$w_length + 4;
- CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
- strcpy(&the_cmd_line[x], "-P");
- strncpy(&the_cmd_line[x+3], work_str.dsc$a_pointer,
- work_str.dsc$w_length);
- the_cmd_line[cmdl_len-1] = '\0';
- } else {
-
- *ptr++ = 'e';
- }
-
- status = cli$present(&cli_fix_archive);
- if (status & 1) {
- *ptr++ = 'F';
-
- if ((status = cli$present(&cli_fix_full)) & 1) {
-
- *ptr++ = 'F';
- }
- }
-
- #define OPT_FS "-FS"
- if ((status = cli$present( &cli_filesync)) & 1)
- {
-
- x = cmdl_len;
- cmdl_len += strlen( OPT_FS)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_FS);
- }
-
- status = cli$present(&cli_append);
- if (status & 1)
-
- *ptr++ = 'g';
- status = cli$present(&cli_grow);
- if (status & 1)
-
- *ptr++ = 'g';
-
- #define OPT_H2 "-h2"
- status = cli$present(&cli_help);
- if (status & 1)
- {
- status = cli$present( &cli_help_normal);
- if (status & 1)
- {
-
- *ptr++ = 'h';
- }
- status = cli$present( &cli_help_extended);
- if (status & 1)
- {
-
- x = cmdl_len;
- cmdl_len += strlen( OPT_H2)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_H2);
- }
- }
-
- status = cli$present(&cli_junk);
- if (status & 1)
-
- *ptr++ = 'j';
-
- status = cli$present(&cli_pkzip);
- if (status & 1)
-
- *ptr++ = 'k';
-
- status = cli$present(&cli_translate_eol);
- if (status & 1) {
-
- *ptr++ = 'l';
- if ((status = cli$present(&cli_transl_eol_crlf)) & 1) {
-
- *ptr++ = 'l';
- }
- }
-
- status = cli$present(&cli_license);
- if (status & 1)
-
- *ptr++ = 'L';
-
- status = cli$present(&cli_latest);
- if (status & 1)
-
- *ptr++ = 'o';
-
- status = cli$present(&cli_full_path);
- if (status == CLI$_PRESENT)
-
- *ptr++ = 'p';
- else if (status == CLI$_NEGATED)
-
- *ptr++ = 'j';
-
- status = cli$present(&cli_unsfx);
- if (status & 1)
-
- *ptr++ = 'J';
-
- status = cli$present(&cli_recurse);
- if (status & 1) {
- if ((status = cli$present(&cli_recurse_fnames)) & 1)
-
- *ptr++ = 'R';
- else
-
- *ptr++ = 'r';
- }
-
- status = cli$present(&cli_test);
- if (status & 1) {
-
- *ptr++ = 'T';
- }
-
- status = cli$present(&cli_verbose);
- if (status & 1) {
- int i;
- int verbo = 0;
-
- if ((status = cli$present(&cli_verbose_command)) & 1)
- {
-
- verbose_command = 1;
- }
-
- if ((status = cli$present(&cli_verbose_normal)) & 1)
-
- verbo = 1;
- if ((status = cli$present(&cli_verbose_more)) & 1)
-
- verbo = 2;
- if ((status = cli$present(&cli_verbose_debug)) & 1) {
-
- verbo = 3;
- }
- for (i = 0; i < verbo; i++)
- *ptr++ = 'v';
- }
-
- status = cli$present(&cli_quiet);
- if (status & 1)
-
- *ptr++ = 'q';
-
- status = cli$present(&cli_vms);
- if (status & 1) {
-
- *ptr++ = 'V';
- if ((status = cli$present(&cli_vms_all)) & 1) {
-
- *ptr++ = 'V';
- }
- }
-
- status = cli$present(&cli_keep_version);
- if (status & 1)
-
- *ptr++ = 'w';
-
- status = cli$present(&cli_symlinks);
- if (status & 1)
-
- *ptr++ = 'y';
-
- status = cli$present(&cli_batch);
- if (status & 1) {
-
- status = cli$get_value(&cli_batch, &work_str);
- if (status & 1) {
-
- work_str.dsc$a_pointer[work_str.dsc$w_length] = '\0';
- if ((stdin = freopen(work_str.dsc$a_pointer, "r", stdin)) == NULL)
- {
- sprintf(errbuf, "could not open list file: %s",
- work_str.dsc$a_pointer);
- ziperr(ZE_PARMS, errbuf);
- }
- }
- *ptr++ = '@';
- }
-
- len = ptr - &options[0];
- if (len > 1) {
- options[len] = '\0';
- x = cmdl_len;
- cmdl_len += len + 1;
- CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
- strcpy(&the_cmd_line[x], options);
- }
-
- status = cli$present(&cli_temp_path);
- if (status & 1) {
-
- status = cli$get_value(&cli_temp_path, &work_str);
- x = cmdl_len;
- cmdl_len += work_str.dsc$w_length + 4;
- CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
- strcpy(&the_cmd_line[x], "-b");
- strncpy(&the_cmd_line[x+3], work_str.dsc$a_pointer,
- work_str.dsc$w_length);
- the_cmd_line[cmdl_len-1] = '\0';
- }
- status = cli$present(&cli_output);
- if (status & 1) {
-
- status = cli$get_value(&cli_output, &work_str);
- x = cmdl_len;
- cmdl_len += work_str.dsc$w_length + 4;
- CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
- strcpy(&the_cmd_line[x], "-O");
- strncpy(&the_cmd_line[x+3], work_str.dsc$a_pointer,
- work_str.dsc$w_length);
- the_cmd_line[cmdl_len-1] = '\0';
- }
-
- #define OPT_DB "-db"
- #define OPT_DC "-dc"
- #define OPT_DD "-dd"
- #define OPT_DG "-dg"
- #define OPT_DS "-ds="
- #define OPT_DU "-du"
- #define OPT_DV "-dv"
- status = cli$present( &cli_display);
- if (status & 1)
- {
- if ((status = cli$present( &cli_display_bytes)) & 1)
- {
-
- x = cmdl_len;
- cmdl_len += strlen( OPT_DB)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_DB);
- }
- if ((status = cli$present( &cli_display_counts)) & 1)
- {
-
- x = cmdl_len;
- cmdl_len += strlen( OPT_DC)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_DC);
- }
- if ((status = cli$present( &cli_display_dots)) & 1)
- {
-
- status = cli$get_value( &cli_display_dots, &work_str);
- x = cmdl_len;
- cmdl_len += strlen( OPT_DD)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_DD);
-
- if (work_str.dsc$w_length > 0) {
- x = cmdl_len;
- cmdl_len += strlen( OPT_DS);
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_DS);
- x = cmdl_len;
- cmdl_len += work_str.dsc$w_length+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strncpy( &the_cmd_line[ x],
- work_str.dsc$a_pointer, work_str.dsc$w_length);
- }
- }
- if ((status = cli$present( &cli_display_globaldots)) & 1)
- {
-
- x = cmdl_len;
- cmdl_len += strlen( OPT_DG)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_DG);
- }
- if ((status = cli$present( &cli_display_usize)) & 1)
- {
-
- x = cmdl_len;
- cmdl_len += strlen( OPT_DU)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_DU);
- }
- if ((status = cli$present( &cli_display_volume)) & 1)
- {
-
- x = cmdl_len;
- cmdl_len += strlen( OPT_DV)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_DV);
- }
- }
-
- #define OPT_LA "-la"
- #define OPT_LF "-lf"
- #define OPT_LI "-li"
- status = cli$present( &cli_log_file);
- if (status & 1)
- {
-
- if ((status = cli$present( &cli_log_file_append)) & 1)
- {
-
- x = cmdl_len;
- cmdl_len += strlen( OPT_LA)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_LA);
- }
- status = cli$present(&cli_log_file_file);
- if (status & 1) {
-
- status = cli$get_value(&cli_log_file_file, &work_str);
- x = cmdl_len;
- cmdl_len += strlen( OPT_LF)+ 2+ work_str.dsc$w_length;
- CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
- strcpy(&the_cmd_line[x], OPT_LF);
- strncpy(&the_cmd_line[x+strlen( OPT_LF)+ 1], work_str.dsc$a_pointer,
- work_str.dsc$w_length);
- the_cmd_line[cmdl_len-1] = '\0';
- }
- if ((status = cli$present( &cli_log_file_info)) & 1)
- {
-
- x = cmdl_len;
- cmdl_len += strlen( OPT_LI)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_LI);
- }
- }
-
- #define OPT_S "-s"
- #define OPT_SB "-sb"
- #define OPT_SP "-sp"
- #define OPT_SV "-sv"
- status = cli$present( &cli_split);
- if (status & 1)
- {
- status = cli$present( &cli_split_bell);
- if (status & 1)
- {
-
- x = cmdl_len;
- cmdl_len += strlen( OPT_SB)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_SB);
- }
- status = cli$present( &cli_split_pause);
- if (status & 1)
- {
-
- x = cmdl_len;
- cmdl_len += strlen( OPT_SP)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_SP);
- }
- status = cli$present( &cli_split_size);
- if (status & 1)
- {
-
- status = cli$get_value( &cli_split_size, &work_str);
- x = cmdl_len;
- cmdl_len += strlen( OPT_S)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_S);
- x = cmdl_len;
- cmdl_len += work_str.dsc$w_length+ 1;
- strncpy( &the_cmd_line[ x],
- work_str.dsc$a_pointer, work_str.dsc$w_length);
- }
- status = cli$present( &cli_split_verbose);
- if (status & 1)
- {
-
- x = cmdl_len;
- cmdl_len += strlen( OPT_SV)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_SV);
- }
- }
-
- #define OPT_SC "-sc"
- #define OPT_SD "-sd"
- #define OPT_SF "-sf"
- #define OPT_SO "-so"
- status = cli$present( &cli_show);
- if (status & 1)
- {
-
- if ((status = cli$present( &cli_show_command)) & 1)
- {
-
- x = cmdl_len;
- cmdl_len += strlen( OPT_SC)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_SC);
- }
- if ((status = cli$present( &cli_show_debug)) & 1)
- {
-
- x = cmdl_len;
- cmdl_len += strlen( OPT_SD)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_SD);
- }
- if ((status = cli$present( &cli_show_files)) & 1)
- {
-
- x = cmdl_len;
- cmdl_len += strlen( OPT_SF)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_SF);
- }
- if ((status = cli$present( &cli_show_options)) & 1)
- {
-
- x = cmdl_len;
- cmdl_len += strlen( OPT_SO)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_SO);
- }
- }
-
- #define OPT_FZ "-fz"
- status = cli$present( &cli_zip64);
- if (status & 1)
- {
-
- x = cmdl_len;
- cmdl_len += strlen( OPT_FZ)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_FZ);
- }
-
- #define OPT_NW "-nw"
- #define OPT_W "-W"
- status = cli$present( &cli_wildcard);
- if (status & 1)
- {
- if ((status = cli$present( &cli_wildcard_nospan)) & 1)
- {
-
- x = cmdl_len;
- cmdl_len += strlen( OPT_W)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_W);
- }
- }
- else if (status == CLI$_NEGATED)
- {
-
- x = cmdl_len;
- cmdl_len += strlen( OPT_NW)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_NW);
- }
-
- #define OPT_MM "-MM"
- status = cli$present( &cli_must_match);
- if (status & 1)
- {
-
- x = cmdl_len;
- cmdl_len += strlen( OPT_MM)+ 1;
- CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_MM);
- }
-
- #define OPT_TT "-TT"
- status = cli$present(&cli_test);
- if (status & 1) {
-
- status = cli$present(&cli_test_unzip);
- if (status & 1) {
-
- status = cli$get_value(&cli_test_unzip, &work_str);
- x = cmdl_len;
- cmdl_len += strlen( OPT_TT)+ 2+ work_str.dsc$w_length;
- CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
- strcpy(&the_cmd_line[x], OPT_TT);
- strncpy(&the_cmd_line[x+strlen( OPT_TT)+ 1], work_str.dsc$a_pointer,
- work_str.dsc$w_length);
- the_cmd_line[cmdl_len-1] = '\0';
- }
- }
-
- #define OPT_ZB "-Zb"
- #define OPT_ZD "-Zd"
- #define OPT_ZS "-Zs"
- status = cli$present( &cli_compression);
- if (status & 1)
- {
- if ((status = cli$present( &cli_compression_b)) & 1)
- {
-
- x = cmdl_len;
- cmdl_len += strlen( OPT_ZB)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_ZB);
- }
- if ((status = cli$present( &cli_compression_d)) & 1)
- {
-
- x = cmdl_len;
- cmdl_len += strlen( OPT_ZD)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_ZD);
- }
- if ((status = cli$present( &cli_compression_s)) & 1)
- {
-
- x = cmdl_len;
- cmdl_len += strlen( OPT_ZS)+ 1;
- CHECK_BUFFER_ALLOCATION( the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_ZS);
- }
- }
-
- status = cli$present(&cli_since);
- if (status & 1) {
-
- char since_time[9];
- status = get_time(&cli_since, &since_time[0]);
- if (!(status & 1)) return (status);
-
- x = cmdl_len;
- cmdl_len += (3 + 9);
- CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
- strcpy(&the_cmd_line[x], "-t");
- strcpy(&the_cmd_line[x+3], since_time);
- }
-
- status = cli$present(&cli_before);
- if (status & 1) {
-
- char before_time[9];
- status = get_time(&cli_before, &before_time[0]);
- if (!(status & 1)) return (status);
-
- x = cmdl_len;
- cmdl_len += (4 + 9);
- CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
- strcpy(&the_cmd_line[x], "-tt");
- strcpy(&the_cmd_line[x+4], before_time);
- }
-
- status = cli$present(&cli_store_types);
- if (status & 1) {
-
- x = cmdl_len;
- cmdl_len += 3;
- CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
- strcpy(&the_cmd_line[x], "-n");
- status = get_list(&cli_store_types, &foreign_cmdline, ':',
- &the_cmd_line, &cmdl_size, &cmdl_len);
- if (!(status & 1)) return (status);
- }
-
- #define OPT_X "-X"
- #define OPT_XN "-X-"
- status = cli$present(&cli_extra_fields);
- if (status & 1) {
-
- if ((status = cli$present( &cli_extra_fields_keep)) & 1) {
-
- x = cmdl_len;
- cmdl_len += strlen( OPT_XN)+ 1;
- CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_XN);
- }
- }
- else if (status == CLI$_NEGATED) {
-
- x = cmdl_len;
- cmdl_len += strlen( OPT_X)+ 1;
- CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
- strcpy( &the_cmd_line[ x], OPT_X);
- }
-
- status = cli$present(&cli_zipfile);
-
- if (status & 1) {
- status = cli$get_value(&cli_zipfile, &work_str);
- x = cmdl_len;
- cmdl_len += work_str.dsc$w_length + 1;
- CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
- strncpy(&the_cmd_line[x], work_str.dsc$a_pointer,
- work_str.dsc$w_length);
- the_cmd_line[cmdl_len-1] = '\0';
- }
-
- status = cli$present(&cli_infile);
- if (status & 1) {
-
- status = get_list(&cli_infile, &foreign_cmdline, '\0',
- &the_cmd_line, &cmdl_size, &cmdl_len);
- if (!(status & 1)) return (status);
- }
-
- status = cli$present(&cli_exlist);
- if (status & 1) {
-
- status = cli$get_value(&cli_exlist, &work_str);
- x = cmdl_len;
- cmdl_len += work_str.dsc$w_length + 4;
- CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
- strncpy(&the_cmd_line[x], "-x@", 3);
- strncpy(&the_cmd_line[x+3], work_str.dsc$a_pointer,
- work_str.dsc$w_length);
- the_cmd_line[cmdl_len-1] = '\0';
- }
-
- status = cli$present(&cli_exclude);
- if (status & 1) {
-
- x = cmdl_len;
- cmdl_len += 3;
- CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
- strcpy(&the_cmd_line[x], "-x");
- status = get_list(&cli_exclude, &foreign_cmdline, '\0',
- &the_cmd_line, &cmdl_size, &cmdl_len);
- if (!(status & 1)) return (status);
- }
-
- status = cli$present(&cli_inlist);
- if (status & 1) {
-
- status = cli$get_value(&cli_inlist, &work_str);
- x = cmdl_len;
- cmdl_len += work_str.dsc$w_length + 4;
- CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
- strncpy(&the_cmd_line[x], "-i@", 3);
- strncpy(&the_cmd_line[x+3], work_str.dsc$a_pointer,
- work_str.dsc$w_length);
- the_cmd_line[cmdl_len-1] = '\0';
- }
-
- status = cli$present(&cli_include);
- if (status & 1) {
-
- x = cmdl_len;
- cmdl_len += 3;
- CHECK_BUFFER_ALLOCATION(the_cmd_line, cmdl_size, cmdl_len)
- strcpy(&the_cmd_line[x], "-i");
- status = get_list(&cli_exclude, &foreign_cmdline, '\0',
- &the_cmd_line, &cmdl_size, &cmdl_len);
- if (!(status & 1)) return (status);
- }
-
- if ((the_cmd_line = (char *) realloc(the_cmd_line, cmdl_len)) == NULL)
- return (SS$_INSFMEM);
-
- for (new_argc = 0, x = 0; x < cmdl_len; x++)
- if (the_cmd_line[x] == '\0')
- new_argc++;
-
- if ((new_argv = (char **) calloc(new_argc+1, sizeof(char *))) == NULL)
- return (SS$_INSFMEM);
-
- for (ptr = the_cmd_line, x = 0; x < new_argc; x++) {
- new_argv[x] = ptr;
- ptr += strlen(ptr) + 1;
- }
- new_argv[new_argc] = NULL;
- #if defined(TEST) || defined(DEBUG)
- printf("new_argc = %d\n", new_argc);
- for (x = 0; x < new_argc; x++)
- printf("new_argv[%d] = %s\n", x, new_argv[x]);
- #endif
-
- if (verbose_command != 0)
- {
- printf( " UNIX command line args (argc = %d):\n", new_argc);
- for (x = 0; x < new_argc; x++)
- printf( "%s\n", new_argv[ x]);
- printf( "\n");
- }
-
- *argc_p = new_argc;
- *argv_p = new_argv;
- return (SS$_NORMAL);
- }
- static unsigned long
- get_list (struct dsc$descriptor_s *qual, struct dsc$descriptor_d *rawtail,
- int delim, char **p_str, unsigned long *p_size, unsigned long *p_end)
- {
- register unsigned long status;
- struct dsc$descriptor_d work_str;
- init_dyndesc(work_str);
- status = cli$present(qual);
- if (status & 1) {
- unsigned long len, old_len;
- long ind, sind;
- int keep_case;
- char *src, *dst; int x;
-
- if (*p_str == NULL) {
- *p_size = ARGBSIZE_UNIT;
- if ((*p_str = (char *) malloc(*p_size)) == NULL)
- return (SS$_INSFMEM);
- len = 0;
- } else {
- len = *p_end;
- }
- while ((status = cli$get_value(qual, &work_str)) & 1) {
- old_len = len;
- len += work_str.dsc$w_length + 1;
- CHECK_BUFFER_ALLOCATION(*p_str, *p_size, len)
-
- keep_case = FALSE;
- str$find_first_substring(rawtail, &ind, &sind, &work_str);
- if ((ind > 1 && *(rawtail->dsc$a_pointer + ind - 2) == '"') ||
- (ind == 0))
- keep_case = TRUE;
-
- src = work_str.dsc$a_pointer;
- dst = *p_str+old_len;
- for (x = 0; x < work_str.dsc$w_length; x++) {
- if (!keep_case && ((*src >= 'A') && (*src <= 'Z')))
- *dst++ = *src++ + 32;
- else
- *dst++ = *src++;
- }
- if (status == CLI$_COMMA)
- (*p_str)[len-1] = (char)delim;
- else
- (*p_str)[len-1] = '\0';
- }
- *p_end = len;
- }
- return (SS$_NORMAL);
- }
- static unsigned long
- get_time (struct dsc$descriptor_s *qual, char *timearg)
- {
- register unsigned long status;
- struct dsc$descriptor_d time_str;
- struct quadword {
- long high;
- long low;
- } bintimbuf = {0,0};
- #ifdef __DECC
- #pragma member_alignment save
- #pragma nomember_alignment
- #endif
- struct tim {
- short year;
- short month;
- short day;
- short hour;
- short minute;
- short second;
- short hundred;
- } numtimbuf;
- #ifdef __DECC
- #pragma member_alignment restore
- #endif
- init_dyndesc(time_str);
- status = cli$get_value(qual, &time_str);
-
- if (time_str.dsc$w_length) {
- status = sys$bintim(&time_str, &bintimbuf);
- if (!(status & 1)) return (status);
- str$free1_dx(&time_str);
- }
-
- status = sys$numtim(&numtimbuf, (bintimbuf.low ? &bintimbuf : NULL));
-
- if (!(status & 1)) {
- *timearg = '\0';
- } else {
- sprintf(timearg, "%02d%02d%04d", numtimbuf.month,
- numtimbuf.day, numtimbuf.year);
- }
- return (status);
- }
- static unsigned long
- check_cli (struct dsc$descriptor_s *qual)
- {
- lib$establish(lib$sig_to_ret);
- return (cli$present(qual));
- }
- #ifndef TEST
- void VMSCLI_help(void)
- {
- extent i;
-
- static char *text[] = {
- "Zip %s (%s). Usage: (zip :== $ dev:[dir]zip_cli.exe)",
- "zip archive[.zip] [list] [/EXCL=(xlist)] /options /modifiers",
- " The default action is to add or replace archive entries from list, except",
- " those in xlist. The include file list may contain the special name \"-\" to",
- " compress standard input. If both archive and list are omitted, Zip",
- " compresses stdin to stdout.",
- " Type zip -h for Unix-style flags.",
- " Major options include:",
- " /COPY, /DELETE, /DIFFERENCE, /FILESYNC, /FRESHEN, /GROW, /MOVE, /UPDATE,",
- " /ADJUST_OFFSETS, /FIX_ARCHIVE[={NORMAL|FULL}], /TEST[=UNZIP=cmd], /UNSFX,",
- " Modifiers include:",
- " /BATCH[=list_file], /BEFORE=creation_time, /COMMENTS[={ARCHIVE|FILES}],",
- " /EXCLUDE=(file_list), /EXLIST=file, /INCLUDE=(file_list), /INLIST=file,",
- " /LATEST, /OUTPUT=out_archive, /SINCE=creation_time, /TEMP_PATH=directory,",
- " /LOG_FILE=(FILE=log_file[,APPEND][,INFORMATIONAL]), /MUST_MATCH,",
- " /PATTERN_CASE={BLIND|SENSITIVE}, /NORECURSE|/RECURSE[={PATH|FILENAMES}],",
- " /STORE_TYPES=(type_list),",
- #if CRYPT
- "\
- /QUIET, /VERBOSE[={MORE|DEBUG}], /[NO]DIRNAMES, /JUNK, /ENCRYPT[=\"pwd\"],\
- ",
- #else
- " /QUIET, /VERBOSE[={MORE|DEBUG}], /[NO]DIRNAMES, /JUNK,",
- #endif
- " /COMPRESSION = {BZIP2|DEFLATE|STORE}, /LEVEL=[0-9], /NOVMS|/VMS[=ALL],",
- " /STORE_TYPES=(type_list), /[NO]PRESERVE_CASE[=([NO]ODS{2|5}[,...])],",
- " /[NO]PKZIP, /[NO]KEEP_VERSION, /DOT_VERSION, /TRANSLATE_EOL[={LF|CRLF}],",
- " /DISPLAY=([BYTES][,COUNTS][,DOTS=mb_per_dot][,GLOBALDOTS][,USIZE]",
- " [,VOLUME]), /DESCRIPTORS, /[NO]EXTRA_FIELDS, /ZIP64,",
- #ifdef S_IFLNK
- " /SPLIT = (SIZE=ssize [,BELL] [,PAUSE] [,VERBOSE]), /SYMLINKS"
- #else
- " /SPLIT = (SIZE=ssize [,BELL] [,PAUSE] [,VERBOSE])"
- #endif
- };
- if (!show_VMSCLI_help) {
- help();
- return;
- }
- for (i = 0; i < sizeof(copyright)/sizeof(char *); i++)
- {
- printf(copyright[i], "zip");
- putchar('\n');
- }
- for (i = 0; i < sizeof(text)/sizeof(char *); i++)
- {
- printf(text[i], VERSION, REVDATE);
- putchar('\n');
- }
- }
- #endif
|