📄 cmdline.c
字号:
*ptr++ = binval + '0'; } /* ** Adjust offsets of zip archive entries. */ status = cli$present(&cli_adjust); if (status & 1) *ptr++ = 'A'; /* ** Add comments? */ status = cli$present(&cli_comments); if (status & 1) {/* while ((status = cli$get_value(&cli_comments, &work_str)) & 1) { if (strncmp(work_str.dsc$a_pointer,"ZIP",3) == 0) *ptr++ = 'z'; if (strncmp(work_str.dsc$a_pointer,"FIL",3) == 0) *ptr++ = 'c'; } */ if ((status = cli$present(&cli_comment_zipfile)) & 1) *ptr++ = 'z'; if ((status = cli$present(&cli_comment_files)) & 1) *ptr++ = 'c'; } /* ** Do not add/modify directory entries. */ status = cli$present(&cli_dirnames); if (!(status & 1)) *ptr++ = 'D'; /* ** Encrypt? */ 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'; } /* ** Fix the zip archive structure. */ status = cli$present(&cli_fix_archive); if (status & 1) { *ptr++ = 'F'; if ((status = cli$present(&cli_fix_full)) & 1) { *ptr++ = 'F'; } } /* ** Append (allow growing of existing zip file). */ status = cli$present(&cli_append); if (status & 1) *ptr++ = 'g'; /* ** Show the help. */ status = cli$present(&cli_help); if (status & 1) *ptr++ = 'h'; /* ** Junk path names (directory specs). */ status = cli$present(&cli_junk); if (status & 1) *ptr++ = 'j'; /* ** Simulate zip file made by PKZIP. */ status = cli$present(&cli_pkzip); if (status & 1) *ptr++ = 'k'; /* ** Translate end-of-line. */ status = cli$present(&cli_translate_eol); if (status & 1) { *ptr++ = 'l'; if ((status = cli$present(&cli_transl_eol_crlf)) & 1) { *ptr++ = 'l'; } } /* ** Show the software license. */ status = cli$present(&cli_license); if (status & 1) *ptr++ = 'L'; /* ** Set zip file time to time of latest file in it. */ status = cli$present(&cli_latest); if (status & 1) *ptr++ = 'o'; /* ** Store full path (default). */ status = cli$present(&cli_full_path); if (status == CLI$_PRESENT) *ptr++ = 'p'; else if (status == CLI$_NEGATED) *ptr++ = 'j'; /* ** Junk Zipfile prefix (SFX stub etc.). */ status = cli$present(&cli_unsfx); if (status & 1) *ptr++ = 'J'; /* ** Recurse through subdirectories. */ status = cli$present(&cli_recurse); if (status & 1) { if ((status = cli$present(&cli_recurse_fnames)) & 1) *ptr++ = 'R'; else *ptr++ = 'r'; } /* ** Be verbose. */ status = cli$present(&cli_verbose); if (status & 1) { int i; int verbo = 0; /* /VERBOSE */ if ((status = cli$present(&cli_verbose_command)) & 1) { /* /VERBOSE = COMMAND */ verbose_command = 1; } /* Note that any or all of the following options may be specified, and the maximum one is used. */ if ((status = cli$present(&cli_verbose_normal)) & 1) /* /VERBOSE [ = NORMAL ] */ verbo = 1; if ((status = cli$present(&cli_verbose_more)) & 1) /* /VERBOSE = MORE */ verbo = 2; if ((status = cli$present(&cli_verbose_debug)) & 1) { /* /VERBOSE = DEBUG */ verbo = 3; } for (i = 0; i < verbo; i++) *ptr++ = 'v'; } /* ** Quiet mode. ** (Quiet mode is processed after verbose, because a "-v" modifier ** resets "noisy" to 1.) */ status = cli$present(&cli_quiet); if (status & 1) *ptr++ = 'q'; /* ** Suppress creation of any extra field. */ status = cli$present(&cli_extra_fields); if (!(status & 1)) *ptr++ = 'X'; /* ** Save the VMS file attributes (and all allocated blocks?). */ status = cli$present(&cli_vms); if (status & 1) { /* /VMS */ *ptr++ = 'V'; if ((status = cli$present(&cli_vms_all)) & 1) { /* /VMS = ALL */ *ptr++ = 'V'; } } /* ** Keep the VMS version number as part of the file name when stored. */ status = cli$present(&cli_keep_version); if (status & 1) *ptr++ = 'w'; /* ** `Batch' processing: read filenames to archive from stdin ** or the specified file. */ 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++ = '@'; } /* ** Now copy the final options string to the_cmd_line. */ 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); } /* ** ** OK. We've done all the regular options, so check for -b (temporary ** file path), -t (exclude before time), -n (special suffixes), zipfile, ** files to zip, and exclude list. ** */ 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'; } /* ** Demand that all input files exist (and wildcards match something). */#define OPT_MM "-MM" /* Input file specs must exist. */ 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); } /* ** Handle "-t mmddyyyy". */ 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); /* ** Now let's add the option "-t mmddyyyy" to the new command line. */ 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); } /* ** Handle "-tt mmddyyyy". */ 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); /* ** Now let's add the option "-tt mmddyyyy" to the new command line. */ 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); } /* ** Handle "-n suffix:suffix:...". (File types to store only.) */ 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); } /* ** Now get the specified zip file name. */ 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'; } /* ** Run through the list of input files. */ 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); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -