home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.freefriends.org
/
ftp.freefriends.org.tar
/
ftp.freefriends.org
/
arnold
/
Source
/
mush.rstevens.tar.gz
/
mush.tar
/
Patch.solaris.bsdi
< prev
next >
Wrap
Text File
|
1994-07-09
|
22KB
|
810 lines
*** execute.c Tue Mar 31 16:03:47 1992
--- ../mush-7.2.5/execute.c Sun Jun 12 16:44:12 1994
***************
*** 1,7 ****
/* execute.c (c) copyright 10/28/86 (Dan Heller) */
#include "mush.h"
! #if defined(BSD) || defined(IRIX4)
#include <sys/wait.h>
#else
#ifndef SYSV
--- 1,7 ----
/* execute.c (c) copyright 10/28/86 (Dan Heller) */
#include "mush.h"
! #if defined(BSD) || defined(IRIX4) || defined(POSIX)
#include <sys/wait.h>
#else
#ifndef SYSV
***************
*** 88,98 ****
execute(argv)
char **argv;
{
! #ifdef SYSV
int status;
#else
union wait status;
! #endif /* SYSV */
#ifdef SIGCONT
SIGRET (*oldstop)(), (*oldcont)();
#endif /* SIGCONT */
--- 88,98 ----
execute(argv)
char **argv;
{
! #if defined(SYSV) || defined(POSIX) || defined (BSD44)
int status;
#else
union wait status;
! #endif /* SYSV || POSIX || BSD44 */
#ifdef SIGCONT
SIGRET (*oldstop)(), (*oldcont)();
#endif /* SIGCONT */
***************
*** 142,154 ****
SIGRET
sigchldcatcher()
{
! #ifdef SYSV
int status;
#else
union wait status;
! #endif /* SYSV */
int pid;
#if defined(BSD) || defined(IRIX4)
while ((pid = wait3(&status, WNOHANG, (struct rusage *)0)) > 0) {
Debug("%d died...\n", pid);
--- 142,161 ----
SIGRET
sigchldcatcher()
{
! #if defined(SYSV) || defined(POSIX) || defined(BSD44)
int status;
#else
union wait status;
! #endif /* SYSV || POSIX || BSD44 */
int pid;
+ #ifdef POSIX /* this could probably be done smarter */
+ while ((pid = waitpid(-1,&status, WNOHANG)) > 0) {
+ Debug("%d died...\n", pid);
+ if (pid == exec_pid)
+ break;
+ }
+ #else
#if defined(BSD) || defined(IRIX4)
while ((pid = wait3(&status, WNOHANG, (struct rusage *)0)) > 0) {
Debug("%d died...\n", pid);
***************
*** 164,169 ****
--- 171,177 ----
Debug("%d died...\n", pid);
#endif /* SYSV */
#endif /* BSD || IRIX4 */
+ #endif /* POSIX */
if (pid == exec_pid && pid > 0) {
exec_pid = 0;
longjmp(execjbuf, 1);
*** glob.c Thu May 3 14:40:15 1990
--- ../mush-7.2.5/glob.c Mon Jun 13 10:15:41 1994
***************
*** 340,345 ****
--- 340,436 ----
}
/*
+ * Match a pattern set {s1,s2,...} followed by any other pattern.
+ * Pattern sets and other patterns may nest arbitrarily.
+ *
+ * If "mat" is not a null pointer, a vector of possible expansions
+ * is generated and placed in *mat; otherwise, the expansions are
+ * matched against str and a truth value is returned ("/" is NOT
+ * treated as a directory separator in this case). NOTE: The vector
+ * of expansions may still contain nested pattern sets, which must
+ * be expanded separately. See sxp().
+ *
+ * Currently allows at most 256 alternatives per set. Enough? :-)
+ */
+ static
+ sglob(str, pato, mat)
+ char *str, *pato, ***mat;
+ {
+ char *p, *newpat[256], *oldpat[256], buf[MAXPATHLEN], *b = buf;
+ int copy = 1, nest = 0, i = 0, ret = 0;
+ char *pat,*pat2;
+
+ if (!pato || !str)
+ return FALSE;
+ pat2 = savestr(pato);
+ if (!pat2)
+ return FALSE;
+ pat = pat2;
+ while (*pat) {
+ if (copy)
+ if (*pat != '{') /*}*/ {
+ if (*pat == '\\' && pat[1])
+ *b++ = *pat++;
+ *b++ = *pat++;
+ continue;
+ } else {
+ copy = 0;
+ pat++;
+ }
+ p = pat;
+ while (*pat && (nest || *pat != ',' && /*{*/ *pat != '}')) {
+ if (*pat == '\\')
+ pat++;
+ else if (*pat == '{')
+ nest++;
+ else if (*pat == '}')
+ nest--;
+ if (*pat)
+ pat++;
+ }
+ if (*pat) {
+ oldpat[i] = pat;
+ newpat[i++] = p;
+ if (*pat != ',') {
+ *pat++ = 0;
+ break;
+ } else
+ *pat++ = 0;
+ }
+ }
+ oldpat[i] = NULL;
+ if (i > 0 && mat) {
+ *mat = (char **)malloc((unsigned)((i + 1) * sizeof(char *)));
+ if (*mat)
+ (*mat)[i] = NULL;
+ else{
+ xfree(pat2);
+ return -1;
+ }
+ ret = i;
+ }
+ while (!mat && i-- > 0)
+ if (ret = glob2(str, newpat[i], pat))
+ break;
+ for (i = 0; oldpat[i]; i++) {
+ if (mat && *mat) {
+ (void) sprintf(b, "%s%s", newpat[i], pat);
+ (*mat)[i] = savestr(buf);
+ }
+ if (oldpat[i + 1])
+ oldpat[i][0] = ',';
+ else
+ oldpat[i][0] = /*{*/ '}';
+ }
+ if (ret == 0 && b > buf && mat) {
+ *b = 0;
+ ret = ((*mat = unitv(buf)) ? 1 : -1);
+ }
+ xfree(pat2);
+ return ret;
+ }
+
+ /*
* The basic globbing matcher.
*
* "*" = match 0 or more occurances of anything
***************
*** 434,523 ****
while (*pat == '*')
pat++;
return ((*str == '\0') && (*pat == '\0'));
- }
-
- /*
- * Match a pattern set {s1,s2,...} followed by any other pattern.
- * Pattern sets and other patterns may nest arbitrarily.
- *
- * If "mat" is not a null pointer, a vector of possible expansions
- * is generated and placed in *mat; otherwise, the expansions are
- * matched against str and a truth value is returned ("/" is NOT
- * treated as a directory separator in this case). NOTE: The vector
- * of expansions may still contain nested pattern sets, which must
- * be expanded separately. See sxp().
- *
- * Currently allows at most 256 alternatives per set. Enough? :-)
- */
- static
- sglob(str, pat, mat)
- char *str, *pat, ***mat;
- {
- char *p, *newpat[256], *oldpat[256], buf[MAXPATHLEN], *b = buf;
- int copy = 1, nest = 0, i = 0, ret = 0;
-
- if (!pat)
- return FALSE;
-
- while (*pat) {
- if (copy)
- if (*pat != '{') /*}*/ {
- if (*pat == '\\' && pat[1])
- *b++ = *pat++;
- *b++ = *pat++;
- continue;
- } else {
- copy = 0;
- pat++;
- }
- p = pat;
- while (*pat && (nest || *pat != ',' && /*{*/ *pat != '}')) {
- if (*pat == '\\')
- pat++;
- else if (*pat == '{')
- nest++;
- else if (*pat == '}')
- nest--;
- if (*pat)
- pat++;
- }
- if (*pat) {
- oldpat[i] = pat;
- newpat[i++] = p;
- if (*pat != ',') {
- *pat++ = 0;
- break;
- } else
- *pat++ = 0;
- }
- }
- oldpat[i] = NULL;
- if (i > 0 && mat) {
- *mat = (char **)malloc((unsigned)((i + 1) * sizeof(char *)));
- if (*mat)
- (*mat)[i] = NULL;
- else
- return -1;
- ret = i;
- }
- while (!mat && i-- > 0)
- if (ret = glob2(str, newpat[i], pat))
- break;
- for (i = 0; oldpat[i]; i++) {
- if (mat && *mat) {
- (void) sprintf(b, "%s%s", newpat[i], pat);
- (*mat)[i] = savestr(buf);
- }
- if (oldpat[i + 1])
- oldpat[i][0] = ',';
- else
- oldpat[i][0] = /*{*/ '}';
- }
- if (ret == 0 && b > buf && mat) {
- *b = 0;
- ret = ((*mat = unitv(buf)) ? 1 : -1);
- }
- return ret;
}
/*
--- 525,530 ----
*** hdrs.c Fri Oct 30 13:55:32 1992
--- ../mush-7.2.5/hdrs.c Sun Jun 12 15:37:34 1994
***************
*** 672,679 ****
if (!unscramble_addr(p, line)) { /* p is safely recopied to line */
p2 = addr;
goto BrokenFrom;
! } else
p2 = NULL;
#else /* MSG_SEPARATOR */
wprint("Warning: unable to find who msg %d is from!\n", n+1);
p2 = addr;
--- 672,681 ----
if (!unscramble_addr(p, line)) { /* p is safely recopied to line */
p2 = addr;
goto BrokenFrom;
! } else {
! p = line;
p2 = NULL;
+ }
#else /* MSG_SEPARATOR */
wprint("Warning: unable to find who msg %d is from!\n", n+1);
p2 = addr;
*** loop.c Fri Oct 30 13:55:35 1992
--- ../mush-7.2.5/loop.c Tue Jun 21 09:13:58 1994
***************
*** 936,958 ****
register char *str;
int *argc;
{
! register char *s = NULL, *p;
register int tmp, err = 0, unq_sep = 0;
char *newargv[MAXARGS], **argv, *p2, c, buf[BUFSIZ];
if (debug > 3)
! (void) printf("Working on: %s\n",str);
/* If final is true, do variable expansions first */
if (final) {
! (void) strcpy(buf, str);
! str = buf;
! if (!variable_expand(str))
return DUBL_NULL;
}
*argc = 0;
! while (*str && *argc < MAXARGS) {
! while (isspace(*str))
! ++str;
/* When we have hit an unquoted `;', final must be true,
* so we're finished. Stuff the rest of the string at the
* end of the argv -- do_command will pass it back later,
--- 936,961 ----
register char *str;
int *argc;
{
! register char *s = NULL, *p,*str1;
register int tmp, err = 0, unq_sep = 0;
char *newargv[MAXARGS], **argv, *p2, c, buf[BUFSIZ];
+ if((str1=savestr(str)) == NULL)
+ return DUBL_NULL;;
if (debug > 3)
! (void) printf("Working on: %s\n",str1);
/* If final is true, do variable expansions first */
if (final) {
! (void) strcpy(buf, str1);
! free(str1);
! str1 = buf;
! if (!variable_expand(str1))
return DUBL_NULL;
}
*argc = 0;
! while (*str1 && *argc < MAXARGS) {
! while (isspace(*str1))
! ++str1;
/* When we have hit an unquoted `;', final must be true,
* so we're finished. Stuff the rest of the string at the
* end of the argv -- do_command will pass it back later,
***************
*** 961,1014 ****
* loop, so unq_sep should always be initialized to 0.
*/
if (unq_sep && s && *s == ';') {
! if (*str) { /* Don't bother saving a null string */
newargv[*argc] = savestr(str);
(*argc)++;
}
break;
}
! if (*str) { /* found beginning of a word */
unq_sep = 0; /* innocent until proven guilty */
! s = p = str;
do {
if (p - s >= sizeof buf-1) {
print("argument list too long.\n");
return DUBL_NULL;
}
! if (*str == ';' || *str == '|')
unq_sep = final; /* Mark an unquoted separator */
! if ((*p = *str++) == '\\') {
! if (final && (*str == ';' || *str == '|'))
--p; /* Back up to overwrite the backslash */
! if (*++p = *str) /* assign and compare to NUL */
! str++;
continue;
}
if (p2 = index("\"'", *p)) {
register char c2 = *p2;
/* you can't escape quotes inside quotes of the same type */
! if (!(p2 = index(str, c2))) {
if (final)
print("Unmatched %c.\n", c2);
err++;
! p2 = str;
}
/* This is the intent of the following loop:
! * tmp = (int)(p2 - str) + 1;
! * (void) strncpy(p + !final, str, tmp);
* The strncpy() can't be used directly because
* it may be overlapping, which fails sometimes.
*/
/* copy up to and including quote */
! for (tmp = 0; tmp < (int)(p2 - str) + 1; tmp++)
! p[tmp+!final] = str[tmp];
p += tmp - 2 * !!final; /* change final to a boolean */
! if (*(str = p2))
! str++;
}
! } while (++p, *str && (!isdelimeter(*str) || str[-1] == '\\'));
! if (c = *str) /* set c = *str, check for null */
! str++;
*p = 0;
if (*s) {
/* To differentiate real separators from quoted or
--- 964,1018 ----
* loop, so unq_sep should always be initialized to 0.
*/
if (unq_sep && s && *s == ';') {
! if (*str1) { /* Don't bother saving a null string */
newargv[*argc] = savestr(str);
(*argc)++;
}
break;
}
! if (*str1) { /* found beginning of a word */
unq_sep = 0; /* innocent until proven guilty */
! s = p = str1;
do {
if (p - s >= sizeof buf-1) {
print("argument list too long.\n");
+ free(str1);
return DUBL_NULL;
}
! if (*str1 == ';' || *str1 == '|')
unq_sep = final; /* Mark an unquoted separator */
! if ((*p = *str1++) == '\\') {
! if (final && (*str1 == ';' || *str1 == '|'))
--p; /* Back up to overwrite the backslash */
! if (*++p = *str1) /* assign and compare to NUL */
! str1++;
continue;
}
if (p2 = index("\"'", *p)) {
register char c2 = *p2;
/* you can't escape quotes inside quotes of the same type */
! if (!(p2 = index(str1, c2))) {
if (final)
print("Unmatched %c.\n", c2);
err++;
! p2 = str1;
}
/* This is the intent of the following loop:
! * tmp = (int)(p2 - str1) + 1;
! * (void) strncpy(p + !final, str1, tmp);
* The strncpy() can't be used directly because
* it may be overlapping, which fails sometimes.
*/
/* copy up to and including quote */
! for (tmp = 0; tmp < (int)(p2 - str1) + 1; tmp++)
! p[tmp+!final] = str1[tmp];
p += tmp - 2 * !!final; /* change final to a boolean */
! if (*(str1 = p2))
! str1++;
}
! } while (++p, *str1 && (!isdelimeter(*str1) || str1[-1] == '\\'));
! if (c = *str1) /* set c = *str, check for null */
! str1++;
*p = 0;
if (*s) {
/* To differentiate real separators from quoted or
***************
*** 1031,1041 ****
*p = c;
}
}
! if (!*argc)
return DUBL_NULL;
/* newargv[*argc] = NULL; */
if (!(argv = (char **)calloc((unsigned)((*argc)+1), sizeof(char *)))) {
perror("mk_argv: calloc");
return DUBL_NULL;
}
for (tmp = 0; tmp < *argc; tmp++)
--- 1035,1048 ----
*p = c;
}
}
! if (!*argc){
! free(str1);
return DUBL_NULL;
+ }
/* newargv[*argc] = NULL; */
if (!(argv = (char **)calloc((unsigned)((*argc)+1), sizeof(char *)))) {
perror("mk_argv: calloc");
+ free(str1);
return DUBL_NULL;
}
for (tmp = 0; tmp < *argc; tmp++)
***************
*** 1044,1049 ****
--- 1051,1057 ----
*argc = -1;
else if (debug > 3)
(void) printf("Made argv: "), print_argv(argv);
+ free(str1);
return argv;
}
*** mail.c Fri Oct 30 13:55:36 1992
--- ../mush-7.2.5/mail.c Sun Jun 12 16:51:46 1994
***************
*** 19,25 ****
static int killme;
static u_long flags;
static SIGRET (*oldterm)(), (*oldint)(), (*oldquit)();
! static int finish_up_letter(), send_it(), start_file();
static long add_headers();
static jmp_buf cntrl_c_buf;
static char *Hfile, *edfile;
--- 19,25 ----
static int killme;
static u_long flags;
static SIGRET (*oldterm)(), (*oldint)(), (*oldquit)();
! static int finish_up_letter(), send_it(), start_file(), mail_someone();
static long add_headers();
static jmp_buf cntrl_c_buf;
static char *Hfile, *edfile;
*** /dev/null Tue Jun 21 08:40:28 1994
--- ../mush-7.2.5/makefile.bsdi Tue Jun 21 11:02:03 1994
***************
*** 0 ****
--- 1,74 ----
+ # makefile.bsdi
+ #
+ HDRS= mush.h config.h-dist strings.h bindings.h options.h version.h glob.h pop.h
+
+ SRCS= main.c init.c misc.c mail.c hdrs.c execute.c commands.c print.c dates.c \
+ signals.c setopts.c msgs.c pick.c sort.c expr.c folders.c \
+ loop.c viewopts.c curses.c curs_io.c bind.c file.c strings.c \
+ lock.c macros.c options.c addrs.c malloc.c glob.c command2.c \
+ pop.c pmush.c xcreat.c
+ OBJS= main.o init.o misc.o mail.o hdrs.o execute.o commands.o print.o file.o \
+ signals.o setopts.o msgs.o pick.o sort.o expr.o strings.o \
+ folders.o dates.o loop.o viewopts.o curses.o curs_io.o bind.o \
+ lock.o macros.o options.o addrs.o malloc.o glob.o command2.o \
+ pop.o pmush.o xcreat.o
+
+ HELP_FILES= README README-7.0 README-7.1 README-7.2.0 README-7.2.2 \
+ README-7.2.4 mush.1 cmd_help Mushrc Mailrc Gnurc \
+ sample.mushrc advanced.mushrc digestify
+
+ MAKES= makefile.bsdi makefile.bsd makefile.xenix makefile.sys.v makefile.hpux makefile.sun makefile.solaris
+
+ CFLAGS= -g -DCURSES -DBSD -DSIGRET=void -DBSD44
+ LDFLAGS= -g
+ LINTFLAGS= -bxah -Dlint -DCURSES -DBSD
+ LIBS= -lcurses -ltermlib -lcompat
+ OTHERLIBS=
+ # Use some variant of this one if you #define MMDF in config.h
+ #OTHERLIBS=/usr/src/mmdf/lib/libmmdf.a
+
+ mush: $(OBJS)
+ @echo loading...
+ @$(CC) $(LDFLAGS) $(OBJS) $(LIBS) $(OTHERLIBS) -o mush
+
+ $(OBJS): config.h mush.h
+ loop.o: version.h
+
+ tape:
+ @tar cv $(MAKES) $(HDRS) $(SRCS) $(HELP_FILES)
+
+ tar:
+ @tar fcv MUSH $(MAKES) $(HDRS) $(SRCS) $(HELP_FILES)
+
+ tarmail:
+ tar fcv - $(MAKES) $(HDRS) $(SRCS) $(HELP_FILES) | \
+ compress | btoa > mush.tarmail
+
+ lint:
+ lint $(LINTFLAGS) $(SRCS)
+
+ clean:
+ rm -f *.o core mush
+
+ BINDIR= /usr/local/bin
+ LIBDIR= /usr/local/lib
+ MRCDIR= /usr/share/misc
+ MANDIR= /usr/local/man/man1
+ MANEXT= 1
+
+ install: mush
+ mv mush $(BINDIR)
+ strip $(BINDIR)/mush
+ chmod 0755 $(BINDIR)/mush
+ cp mush.1 $(MANDIR)/mush.$(MANEXT)
+ chmod 0644 $(MANDIR)/mush.$(MANEXT)
+ cp cmd_help $(LIBDIR)
+ chmod 0644 $(LIBDIR)/cmd_help
+ cp Mushrc $(MRCDIR)/Mushrc
+ chmod 0644 $(MRCDIR)/Mushrc
+
+
+ glob: glob.c
+ $(CC) $(CFLAGS) -DTEST -DTEST2 glob.c $(LIBS) $(OTHERLIBS) -o glob
+
+
*** /dev/null Tue Jun 21 08:40:28 1994
--- ../mush-7.2.5/makefile.solaris Mon Jun 13 18:38:21 1994
***************
*** 0 ****
--- 1,65 ----
+ #
+ # Mush makefile for Solaris with gcc 2.5.8
+ #
+ CC=gcc
+ HDRS1= mush.h config.h
+ HDRS2= strings.h options.h
+ HDRS3= bindings.h glob.h
+ HDRS4= version.h pop.h
+ SRCS1= commands.c dates.c execute.c expr.c folders.c \
+ hdrs.c init.c loop.c mail.c main.c misc.c msgs.c pick.c \
+ print.c setopts.c signals.c sort.c viewopts.c options.c lock.c
+ SRCS2= bind.c curs_io.c curses.c file.c strings.c macros.c \
+ addrs.c malloc.c command2.c pop.c pmush.c xcreat.c glob.c
+
+ OBJS1= commands.o dates.o execute.o expr.o folders.o \
+ hdrs.o init.o loop.o mail.o main.o misc.o msgs.o pick.o \
+ print.o setopts.o signals.o sort.o viewopts.o options.o lock.o
+ OBJS2= bind.o curs_io.o curses.o file.o strings.o macros.o \
+ addrs.o malloc.o command2.o pop.o pmush.o xcreat.o glob.o
+
+ HELP= README README-7.0 README-7.1 README-7.2.0 README-7.2.2 \
+ README-7.2.4 mush.1 cmd_help Mushrc Mailrc Gnurc \
+ sample.mushrc advanced.mushrc digestify
+ #
+ #
+ #
+ CFLAGS= -g -DSYSV -DUSG -DCURSES -DSIGRET=void -DSVR4 -DREGCMP
+ LDFLAGS= -g
+ LIBS= -L/usr/ccs/lib -lcurses -lgen -ltermlib
+ OTHERLIBS=
+ # Use some variant of this one if you #define MMDF in config.h
+ #OTHERLIBS=/usr/src/mmdf/lib/libmmdf.a
+ PROG= mush
+
+ $(PROG): $(OBJS1) $(OBJS2)
+ @echo loading...
+ @$(CC) $(LDFLAGS) $(OBJS1) $(OBJS2) -o $(PROG) $(LIBS) $(OTHERLIBS)
+
+ $(OBJS1): $(HDRS1) $(HDRS2)
+ $(OBJS2): $(HDRS1) $(HDRS2) $(HDRS3)
+ loop.o: version.h
+
+ BINDIR= /usr/local/bin
+ LIBDIR= /usr/local/lib
+ MRCDIR= /usr/local/lib
+ MANDIR= /usr/local/man/man1
+ MANEXT= 1
+
+ install: mush
+ cp mush $(BINDIR)
+ strip $(BINDIR)/mush
+ chmod 0755 $(BINDIR)/mush
+ cp mush.1 $(MANDIR)/mush.$(MANEXT)
+ chmod 0644 $(MANDIR)/mush.$(MANEXT)
+ cp cmd_help $(LIBDIR)
+ chmod 0644 $(LIBDIR)/cmd_help
+ cp Mushrc $(MRCDIR)/Mushrc
+ chmod 0644 $(MRCDIR)/Mushrc
+
+
+ clean:
+ rm -f *.o mush
+
+ glob: glob.c
+ $(CC) $(LDFLAGS) $(CFLAGS) -DTEST -DTEST2 glob.c -o glob $(LIBS) $(OTHERLIBS)
*** sort.c Sun Oct 21 21:25:03 1990
--- ../mush-7.2.5/sort.c Sun Jun 12 16:53:21 1994
***************
*** 12,23 ****
static int depth, order, ignore_case;
static jmp_buf sortbuf;
!
sort(argc, argv, list)
register int argc;
register char *argv[], list[];
{
- int msg_cmp();
SIGRET (*oldint)(), (*oldquit)();
int n, offset = -1, range = 0;
long curr_msg_off = msg[current_msg].m_offset;
--- 12,22 ----
static int depth, order, ignore_case;
static jmp_buf sortbuf;
! static int msg_cmp();
sort(argc, argv, list)
register int argc;
register char *argv[], list[];
{
SIGRET (*oldint)(), (*oldquit)();
int n, offset = -1, range = 0;
long curr_msg_off = msg[current_msg].m_offset;
*** strings.c Wed Jul 4 09:26:33 1990
--- ../mush-7.2.5/strings.c Sat Jul 2 23:47:33 1994
***************
*** 69,97 ****
register char *list1, *list2, *delimiters;
{
register char *p, c;
register int found = 0;
if (!list1 || !list2)
return 0;
!
! if (p = any(list1, delimiters)) {
! if (p > list1) {
c = *p; *p = 0;
/* Check list2 against the first word of list1.
* Swap places of list2 and list1 to step through list2.
*/
! found = chk_two_lists(list2, list1, delimiters);
*p = c;
}
! if (found)
return 1;
for (p++; *p && index(delimiters, *p); p++)
;
! if (!*p)
return 0;
! } else if (!any(list2, delimiters))
/* Do the trivial case of single words */
return !lcase_strncmp(list1, list2, -1);
else
p = list1;
--- 69,114 ----
register char *list1, *list2, *delimiters;
{
register char *p, c;
+ char *list1a;
+ char *list2a;
register int found = 0;
if (!list1 || !list2)
return 0;
! /* duplicate the lists so we can play with them */
! if ((list1a = savestr(list1)) == NULL)
! return 0;
! if ((list2a = savestr(list2)) == NULL){
! free(list1a);
! return 0;
! }
! if (p = any(list1a, delimiters)) {
! if (p > list1a) {
c = *p; *p = 0;
/* Check list2 against the first word of list1.
* Swap places of list2 and list1 to step through list2.
*/
! found = chk_two_lists(list2a, list1a, delimiters);
*p = c;
}
! if (found){
! free(list1a);
! free(list2a);
return 1;
+ }
for (p++; *p && index(delimiters, *p); p++)
;
! if (!*p){
! free(list1a);
! free(list2a);
return 0;
! }
! } else if (!any(list2a, delimiters)){
! free(list2a);
! free(list1a);
/* Do the trivial case of single words */
return !lcase_strncmp(list1, list2, -1);
+ }
else
p = list1;
***************
*** 100,106 ****
* rest of list1. This could be more efficient by using a
* different function to avoid repeating the any() calls.
*/
! return chk_two_lists(list2, p, delimiters);
}
bzero(addr, size)
--- 117,126 ----
* rest of list1. This could be more efficient by using a
* different function to avoid repeating the any() calls.
*/
! found = chk_two_lists(list2a, p, delimiters);
! free(list2a);
! free(list1a);
! return found;
}
bzero(addr, size)