home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 June
/
SIMTEL_0692.cdr
/
msdos
/
zoo
/
stuff2.arc
/
PARSEOPT.PCH
< prev
next >
Wrap
Text File
|
1989-03-21
|
4KB
|
176 lines
Patches to upgrade from Stuff 1.0 to Stuff 1.1
(see "readme.too" for details).
*** ../parseopt.c Fri Oct 21 19:01:18 1988
--- parseopt.c Mon Oct 24 13:22:26 1988
***************
*** 23,28
request_rec options[MAX_OPTS];
int last_opt = -1;
static void badopt (char *option);
static int insufargs(void);
--- 23,29 -----
request_rec options[MAX_OPTS];
int last_opt = -1;
+ static void muchopts(void);
static void badopt (char *option);
static void badnegopt (char *option);
static int insufargs(void);
***************
*** 24,29
int last_opt = -1;
static void badopt (char *option);
static int insufargs(void);
void parseopt (char **argv, int *i, int argc)
--- 25,31 -----
int last_opt = -1;
static void muchopts(void);
static void badopt (char *option);
+ static void badnegopt (char *option);
static int insufargs(void);
void parseopt (char **argv, int *i, int argc)
***************
*** 28,34
void parseopt (char **argv, int *i, int argc)
{
! static char *lastoption = "err";
char *option;
request_rec *optr;
--- 30,36 -----
void parseopt (char **argv, int *i, int argc)
{
! static char *lastoption = ",";
char *option;
request_rec *optr;
***************
*** 42,47
if (STRCMP (option,==,"!")) {
++(*i);
/* move to next option */
parseopt (argv, i, argc); /* get next opt
ion */
options[last_opt].negate = 1; /* .. negate it */
return;
--- 44,51 -----
if (STRCMP (option,==,"!")) {
++(*i);
/* move to next option */
+ if (STRCMP(argv[*i],==,OPT_RESPONSE))
+ badnegopt(argv[*i]);
parseopt (argv, i, argc); /* get next opt
ion */
options[last_opt].negate = 1; /* .. negate it */
return;
***************
*** 47,53
return;
}
! last_opt++;
options[last_opt].negate = 0;
optr = &options[last_opt];
--- 51,59 -----
return;
}
! if (++last_opt >= MAX_OPTS)
! muchopts();
!
options[last_opt].negate = 0;
optr = &options[last_opt];
***************
*** 76,81
optr->info.mtime_info.value = filetime(argv[NEXT_ARG(*i,argc)])
;
} else if (STRCMP(option,==,OPT_MODIFIED)) {
optr->choice = MODIFIED;
} else
badopt (option);
--- 82,90 -----
optr->info.mtime_info.value = filetime(argv[NEXT_ARG(*i,argc)])
;
} else if (STRCMP(option,==,OPT_MODIFIED)) {
optr->choice = MODIFIED;
+ } else if (STRCMP(option,==,OPT_RESPONSE)) {
+ last_opt--;
+ do_response(argv[NEXT_ARG(*i,argc)]);
} else
badopt (option);
***************
*** 81,86
lastoption = option;
}
void badopt (char *option)
{
#ifdef UNBUF_IO
--- 90,106 -----
lastoption = option;
}
+
+ void muchopts ()
+ {
+ #ifdef UNBUF_IO
+ errmsg ("stuff: FATAL: Too much options.\n");
+ #else
+ fprintf (stderr, "stuff: FATAL: Too much options.\n");
+ #endif
+ exit(1);
+ }
+
void badopt (char *option)
{
#ifdef UNBUF_IO
***************
*** 89,94
errmsg ("] is invalid\n");
#else
fprintf (stderr, "stuff: FATAL: option [%s] is invalid\n", option);
#endif
exit(1);
}
--- 109,126 -----
errmsg ("] is invalid\n");
#else
fprintf (stderr, "stuff: FATAL: option [%s] is invalid\n", option);
+ #endif
+ exit(1);
+ }
+
+ void badnegopt (char *option)
+ {
+ #ifdef UNBUF_IO
+ errmsg ("stuff: FATAL: option [! ");
+ errmsg (option);
+ errmsg ("] is invalid\n");
+ #else
+ fprintf (stderr, "stuff: FATAL: option [! %s] is invalid\n", option);
#endif
exit(1);
}