version 1.26, 2003/07/23 07:31:21 |
version 1.27, 2003/07/25 02:12:45 |
|
|
else |
else |
simple_backup_suffix = ORIGEXT; |
simple_backup_suffix = ORIGEXT; |
|
|
v = getenv("VERSION_CONTROL"); |
|
backup_type = get_version(v); /* OK to pass NULL. */ |
|
|
|
/* parse switches */ |
/* parse switches */ |
Argc = argc; |
Argc = argc; |
Argv = argv; |
Argv = argv; |
get_some_switches(); |
get_some_switches(); |
|
|
|
if (backup_type == none) { |
|
v = getenv("VERSION_CONTROL"); |
|
#ifdef notyet |
|
if (v != NULL) |
|
#endif |
|
backup_type = get_version(v); /* OK to pass NULL. */ |
|
} |
|
|
/* make sure we clean up /tmp in case of disaster */ |
/* make sure we clean up /tmp in case of disaster */ |
set_signals(0); |
set_signals(0); |
|
|
|
|
static void |
static void |
get_some_switches(void) |
get_some_switches(void) |
{ |
{ |
const char *options = "b:B:cCd:D:eEfF:lnNo:p::r:RstuvV:x:"; |
const char *options = "b::B:cCd:D:eEfF:lnNo:p::r:RstuvV:x:z:"; |
static struct option longopts[] = { |
static struct option longopts[] = { |
|
{"backup", no_argument, 0, 'b'}, |
{"batch", no_argument, 0, 't'}, |
{"batch", no_argument, 0, 't'}, |
{"check", no_argument, 0, 'C'}, |
{"check", no_argument, 0, 'C'}, |
{"context", no_argument, 0, 'c'}, |
{"context", no_argument, 0, 'c'}, |
|
|
{"reverse", no_argument, 0, 'R'}, |
{"reverse", no_argument, 0, 'R'}, |
{"silent", no_argument, 0, 's'}, |
{"silent", no_argument, 0, 's'}, |
{"strip", optional_argument, 0, 'p'}, |
{"strip", optional_argument, 0, 'p'}, |
{"suffix", required_argument, 0, 'b'}, |
{"suffix", required_argument, 0, 'z'}, |
{"unified", no_argument, 0, 'u'}, |
{"unified", no_argument, 0, 'u'}, |
{"version", no_argument, 0, 'v'}, |
{"version", no_argument, 0, 'v'}, |
{"version-control", required_argument, 0, 'V'}, |
{"version-control", required_argument, 0, 'V'}, |
|
|
while ((ch = getopt_long(Argc, Argv, options, longopts, NULL)) != -1) { |
while ((ch = getopt_long(Argc, Argv, options, longopts, NULL)) != -1) { |
switch (ch) { |
switch (ch) { |
case 'b': |
case 'b': |
|
#ifdef notyet |
|
if (backup_type == none) |
|
backup_type = numbered_existing; |
|
#endif |
|
if (optarg == NULL) |
|
break; |
|
if (verbose) |
|
say("Warning, the ``-b suffix'' option has been" |
|
" obsoleted by the -z option.\n"); |
|
/* FALLTHROUGH */ |
|
case 'z': |
|
/* must directly follow 'b' case for backwards compat */ |
simple_backup_suffix = savestr(optarg); |
simple_backup_suffix = savestr(optarg); |
break; |
break; |
case 'B': |
case 'B': |
|
|
usage(void) |
usage(void) |
{ |
{ |
fprintf(stderr, |
fprintf(stderr, |
"usage: patch [-cCeEflnNRstuv] [-b backup-ext] [-B backup-prefix] [-d directory]\n" |
"usage: patch [-bcCeEflnNRstuv] [-B backup-prefix] [-d directory] [-D symbol]\n" |
" [-D symbol] [-Fmax-fuzz] [-o out-file] [-p[strip-count]]\n" |
" [-Fmax-fuzz] [-o out-file] [-p[strip-count]] [-r rej-name]\n" |
" [-r rej-name] [-V {numbered,existing,simple}]\n" |
" [-V {numbered,existing,simple}] [-z backup-ext]\n" |
" [origfile [patchfile]]\n"); |
" [origfile [patchfile]]\n"); |
my_exit(1); |
my_exit(1); |
} |
} |