Archive-Unzip-Burst
view release on metacpan or search on metacpan
unzip-6.0/new-cmdparser/unz6-newcmdparser-diffs.txt view on Meta::CPAN
+ * short and long option values (like -b filename or --temp-file filename
+ * or --temp-file=filename), optional and required values, option negation
+ * by trailing - (like -S- to not include hidden and system files in MSDOS),
+ * value lists (like -x a b c), argument permuting (returning all options
+ * and values before any non-option arguments), and argument files (where
+ * any non-option non-value argument in form @path gets substituted with
+ * the white space separated arguments in the text file at path). In this
+ * version argument file support has been removed to simplify development
+ * but may be added later.
+ *
+ * E. Gordon
+ */
+
+
+/* message output - char casts are needed to handle constants */
+#define oWARN(message) Info(slide, 0x401, ((char *)slide, (char *)message))
+
+
+
+/* Although the below provides some support for multibyte characters
+ the proper thing to do may be to use wide characters and support
+ Unicode. May get to it soon. Wide support would likely require
+ the ability to convert the command line to wide strings, which most
+ modern OS should support now. EG
+ */
+
+/* For now stay with multi-byte characters. May support wide characters
+ in Zip 3.1 and UnZip 6.1.
+ */
+
+/* multibyte character set support
+ Multibyte characters use typically two or more sequential bytes
+ to represent additional characters than can fit in a single byte
+ character set. The code used here is based on the ANSI mblen function. */
+#define MB_CLEN(ptr) CLEN(ptr)
+#define MB_NEXTCHAR(ptr) PREINCSTR(ptr)
+
+
+/* constants */
+
+/* function get_args_from_arg_file() can return this in depth parameter */
+#define ARG_FILE_ERR -1
+
+/* internal settings for optchar */
+#define SKIP_VALUE_ARG -1
+#define THIS_ARG_DONE -2
+#define START_VALUE_LIST -3
+#define IN_VALUE_LIST -4
+#define NON_OPTION_ARG -5
+#define STOP_VALUE_LIST -6
+/* 7/25/04 EG */
+#define READ_REST_ARGS_VERBATIM -7
+
+
+/* global veriables */
+
+int enable_permute = 1; /* yes - return options first */
+/* 7/25/04 EG */
+int doubledash_ends_options = 1; /* when -- what follows are not options */
+
+/* buffer for error messages (this sizing is a guess but must hold 2 paths) */
+#define OPTIONERR_BUF_SIZE (80+ 2*FILENAME_MAX)
+char optionerrbuf[OPTIONERR_BUF_SIZE + 1];
+
+/* error messages */
+static ZCONST char Far op_not_neg_err[] =
+ "option %s not negatable";
+static ZCONST char Far op_req_val_err[] =
+ "option %s requires a value";
+static ZCONST char Far op_no_allow_val_err[] =
+ "option %s does not allow a value";
+static ZCONST char Far sh_op_not_sup_err[] =
+ "short option '%c' not supported";
+static ZCONST char Far oco_req_val_err[] =
+ "option %s requires one character value";
+static ZCONST char Far oco_no_mbc_err[] =
+ "option %s does not support multibyte values";
+static ZCONST char Far num_req_val_err[] =
+ "option %s requires number value";
+static ZCONST char Far long_op_ambig_err[] =
+ "long option '%s' ambiguous";
+static ZCONST char Far long_op_not_sup_err[] =
+ "long option '%s' not supported";
+
+static ZCONST char Far no_arg_files_err[] = "argument files not enabled\n";
+
+
+/* below removed as only used for processing argument files */
+
+/* get_nextarg */
+/* get_args_from_string */
+/* get_args_from_arg_file */
+
+
+/* copy error, option name, and option description if any to buf */
+static int optionerr(options, buf, err, optind, islong)
+ struct option_struct *options;
+ char *buf;
+ ZCONST char Far *err;
+ int optind;
+ int islong;
+{
+ char optname[50];
+
+ if (options[optind].name && options[optind].name[0] != '\0') {
+ sprintf(optname, "'%s' (%s)",
+ LoadFarStringSmall2(islong ? options[optind].longopt
+ : options[optind].shortopt),
+ LoadFarStringSmall(options[optind].name));
+ } else {
+ sprintf(optname, "'%s'",
+ LoadFarStringSmall2(islong ? options[optind].longopt
+ : options[optind].shortopt));
+ }
+ sprintf(buf, LoadFarStringSmall(err), optname);
+ return 0;
+}
+
+
+/* copy_args
+ *
( run in 2.490 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )