Disable the short form of `--script'.

committer: mfx <mfx> 973827408 +0000
This commit is contained in:
Markus F.X.J. Oberhumer 2000-11-10 03:36:48 +00:00
parent 32dfec3cbc
commit 89284ea0b3
2 changed files with 19 additions and 20 deletions

View File

@ -61,7 +61,7 @@ void show_usage(void)
{ {
FILE *f = con_term; FILE *f = con_term;
con_fprintf(f,"Usage: %s [-123456788dlsthVL] [-qvfk] [-o file] %sfile..\n", progname, con_fprintf(f,"Usage: %s [-123456788dlthVL] [-qvfk] [-o file] %sfile..\n", progname,
#if defined(__DJGPP__) || defined(__EMX__) #if defined(__DJGPP__) || defined(__EMX__)
"[@]"); "[@]");
#else #else
@ -178,8 +178,8 @@ void show_help(int x)
con_fprintf(f,"Options for linux/i386\n"); con_fprintf(f,"Options for linux/i386\n");
fg = con_fg(f,fg); fg = con_fg(f,fg);
con_fprintf(f, con_fprintf(f,
" -s use /usr/local/lib/upx[bd] as decompressor\n" " --script use /usr/local/lib/upx/upx[bd] as decompressor\n"
" -s=path/upxX use path/upxX as decompressor\n" " --script=/path/upxX use path/upxX as decompressor\n"
"\n"); "\n");
} }
@ -261,7 +261,8 @@ void show_version(int x)
fprintf(f,"upx %s\n",UPX_VERSION_STRING); fprintf(f,"upx %s\n",UPX_VERSION_STRING);
#if defined(WITH_NRV) #if defined(WITH_NRV)
fprintf(f,"NRV data compression library %s\n", nrv_version_string()); fprintf(f,"NRV data compression library %s\n", nrv_version_string());
#elif defined(WITH_UCL) #endif
#if defined(WITH_UCL)
fprintf(f,"UCL data compression library %s\n", ucl_version_string()); fprintf(f,"UCL data compression library %s\n", ucl_version_string());
#endif #endif
fprintf(f,"Copyright (C) 1996,1997,1998,1999,2000 Markus Franz Xaver Johannes Oberhumer\n"); fprintf(f,"Copyright (C) 1996,1997,1998,1999,2000 Markus Franz Xaver Johannes Oberhumer\n");

View File

@ -304,7 +304,7 @@ static void set_script_name(const char *n, bool allow_m)
#if 1 #if 1
if (done_script_name > 0) if (done_script_name > 0)
{ {
fprintf(stderr,"%s: option `-script' more than once given\n",argv0); fprintf(stderr,"%s: option `--script' more than once given\n",argv0);
e_usage(); e_usage();
} }
#endif #endif
@ -313,12 +313,12 @@ static void set_script_name(const char *n, bool allow_m)
fprintf(stderr,"%s: missing script name\n",argv0); fprintf(stderr,"%s: missing script name\n",argv0);
e_usage(); e_usage();
} }
if (strlen(n) >= SCRIPT_MAX - 3) if (strlen(n) >= opt->unix.SCRIPT_MAX - 3)
{ {
fprintf(stderr,"%s: script name too long\n",argv0); fprintf(stderr,"%s: script name too long\n",argv0);
e_usage(); e_usage();
} }
opt->script_name = n; opt->unix.script_name = n;
done_script_name++; done_script_name++;
} }
@ -444,9 +444,6 @@ static int do_option(int optc, const char *arg)
case 'q': case 'q':
opt->verbose = (opt->verbose > 1 ? 1 : opt->verbose - 1); opt->verbose = (opt->verbose > 1 ? 1 : opt->verbose - 1);
break; break;
case 's':
set_script_name("/usr/local/lib/upxX", 1);
break;
case 't': case 't':
set_cmd(CMD_TEST); set_cmd(CMD_TEST);
break; break;
@ -513,9 +510,6 @@ static int do_option(int optc, const char *arg)
case 519: case 519:
opt->no_env = true; opt->no_env = true;
break; break;
case 520:
set_script_name(mfx_optarg,1);
break;
// compression settings // compression settings
case 525: case 525:
opt->small = 1; opt->small = 1;
@ -639,6 +633,11 @@ static int do_option(int optc, const char *arg)
case 660: case 660:
getoptvar(&opt->unix.blocksize, 8192u, ~0u); getoptvar(&opt->unix.blocksize, 8192u, ~0u);
break; break;
case 661:
opt->unix.script_name = "/usr/local/lib/upx/upxX";
if (mfx_optarg && mfx_optarg[0])
set_script_name(mfx_optarg,1);
break;
case '\0': case '\0':
return -1; return -1;
@ -680,7 +679,6 @@ static const struct mfx_option longopts[] =
{"no-progress", 0, 0, 516}, // no progress bar {"no-progress", 0, 0, 516}, // no progress bar
{"output", 0x21, 0, 'o'}, {"output", 0x21, 0, 'o'},
{"quiet", 0, 0, 'q'}, // quiet mode {"quiet", 0, 0, 'q'}, // quiet mode
{"script", 0x31, 0, 520}, // --script=
{"silent", 0, 0, 'q'}, // quiet mode {"silent", 0, 0, 'q'}, // quiet mode
{"stdout", 0x10, 0, 517}, // write output on standard output {"stdout", 0x10, 0, 517}, // write output on standard output
{"to-stdout", 0x10, 0, 517}, // write output on standard output {"to-stdout", 0x10, 0, 517}, // write output on standard output
@ -741,6 +739,7 @@ static const struct mfx_option longopts[] =
// dos/sys // dos/sys
// unix // unix
{"blocksize", 0x31, 0, 660}, // --blocksize= {"blocksize", 0x31, 0, 660}, // --blocksize=
{"script", 0x31, 0, 661}, // --script=
// watcom/le // watcom/le
{"le", 0, 0, 620}, // produce LE output {"le", 0, 0, 620}, // produce LE output
// win32/pe // win32/pe
@ -755,7 +754,7 @@ static const struct mfx_option longopts[] =
int optc, longind; int optc, longind;
char buf[256]; char buf[256];
prepare_shortopts(buf,"123456789hH?sV",longopts), prepare_shortopts(buf,"123456789hH?V",longopts),
mfx_optind = 0; mfx_optind = 0;
mfx_opterr = 1; mfx_opterr = 1;
while ((optc = mfx_getopt_long(argc, argv, buf, longopts, &longind)) >= 0) while ((optc = mfx_getopt_long(argc, argv, buf, longopts, &longind)) >= 0)
@ -1033,21 +1032,20 @@ int main(int argc, char *argv[])
fprintf(stderr,"ucl_init() failed - check your UCL installation !\n"); fprintf(stderr,"ucl_init() failed - check your UCL installation !\n");
if (UCL_VERSION != ucl_version()) if (UCL_VERSION != ucl_version())
fprintf(stderr,"library version conflict (%lx, %lx) - check your UCL installation !\n", fprintf(stderr,"library version conflict (%lx, %lx) - check your UCL installation !\n",
UCL_VERSION, (long) ucl_version()); (long) UCL_VERSION, (long) ucl_version());
e_exit(EXIT_INIT); e_exit(EXIT_INIT);
} }
#elif defined(WITH_NRV) #endif
#if defined(WITH_NRV)
if (nrv_init() != NRV_E_OK) if (nrv_init() != NRV_E_OK)
{ {
show_head(); show_head();
fprintf(stderr,"nrv_init() failed - check your NRV installation !\n"); fprintf(stderr,"nrv_init() failed - check your NRV installation !\n");
if (NRV_VERSION != nrv_version()) if (NRV_VERSION != nrv_version())
fprintf(stderr,"library version conflict (%lx, %lx) - check your NRV installation !\n", fprintf(stderr,"library version conflict (%lx, %lx) - check your NRV installation !\n",
NRV_VERSION, (long) nrv_version()); (long) NRV_VERSION, (long) nrv_version());
e_exit(EXIT_INIT); e_exit(EXIT_INIT);
} }
#else
#error
#endif #endif
//srand((int) time(NULL)); //srand((int) time(NULL));