summaryrefslogtreecommitdiff
path: root/mail/mush
diff options
context:
space:
mode:
authorchristos <christos>1998-09-04 18:33:46 +0000
committerchristos <christos>1998-09-04 18:33:46 +0000
commitcf711e6fe6c10e92db64ebea7af6721fd151c325 (patch)
tree4743ccb92a8acbcb97036747c21a0f6cff0fc95e /mail/mush
parentd795143e2734597f396934f0b7082beda061de35 (diff)
downloadpkgsrc-cf711e6fe6c10e92db64ebea7af6721fd151c325.tar.gz
Add and enable mush
Diffstat (limited to 'mail/mush')
-rw-r--r--mail/mush/Makefile41
-rw-r--r--mail/mush/files/md510
-rw-r--r--mail/mush/patches/patch-aa21
-rw-r--r--mail/mush/patches/patch-ab48
-rw-r--r--mail/mush/patches/patch-ac21
-rw-r--r--mail/mush/patches/patch-ad978
-rw-r--r--mail/mush/patches/patch-ae48
-rw-r--r--mail/mush/patches/patch-af943
-rw-r--r--mail/mush/patches/patch-ag83
-rw-r--r--mail/mush/patches/patch-ah50
-rw-r--r--mail/mush/pkg/COMMENT1
-rw-r--r--mail/mush/pkg/DESCR9
-rw-r--r--mail/mush/pkg/PLIST5
13 files changed, 2258 insertions, 0 deletions
diff --git a/mail/mush/Makefile b/mail/mush/Makefile
new file mode 100644
index 00000000000..d4581f9b12b
--- /dev/null
+++ b/mail/mush/Makefile
@@ -0,0 +1,41 @@
+# $NetBSD: Makefile,v 1.1 1998/09/04 18:33:46 christos Exp $
+
+DISTNAME= mush-7.2.6.b4
+CATEGORIES= mail
+MASTER_SITES= ftp://cse.ogi.edu/pub/mush/ \
+ ftp://cse.ogi.edu/pub/mush/CONTRIB/
+
+MAINTAINER= christos@netbsd.org
+
+EXTRACT_ONLY= mush-7.2.5.tar.Z
+STD_PATCH_FILES=patch-7.2.6-alpha-1 \
+ patch-7.2.6-alpha-2 \
+ patch-7.2.6-alpha-3 \
+ patch-7.2.6-beta-1 \
+ patch-7.2.6-beta-2 \
+ patch-7.2.6-beta-3 \
+ patch-7.2.6-beta-4
+DISTFILES= ${EXTRACT_ONLY} ${STD_PATCH_FILES}
+
+RESTRICTED= "Z-Code license"
+MIRROR_DISTFILE= no
+NO_WRKSUBDIR= yes
+
+post-extract:
+ @${ECHO} "===> Applying mush-7.2.6/beta4 patches"
+ @(cd ${WRKDIR}; \
+ for i in ${STD_PATCH_FILES}; do \
+ ${PATCH} < ${_DISTDIR}/$$i; \
+ done > /dev/null 2> /dev/null; \
+ ${RM} -f *.orig; \
+ x=*.rej; \
+ if [ "$$x" != '*.rej' ]; then \
+ ${ECHO} "Patching failed: $$x" 1>&2; \
+ exit 1; \
+ fi)
+
+pre-configure:
+ ${SED} -e 's:__PREFIX:'${PREFIX}':g'< ${WRKSRC}/config.h-dist > ${WRKSRC}/config.h
+ ${SED} -e 's:__PREFIX:'${PREFIX}':g'< ${WRKSRC}/makefile.netbsd > ${WRKSRC}/Makefile
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/mail/mush/files/md5 b/mail/mush/files/md5
new file mode 100644
index 00000000000..e64d2b64588
--- /dev/null
+++ b/mail/mush/files/md5
@@ -0,0 +1,10 @@
+$NetBSD: md5,v 1.1 1998/09/04 18:33:46 christos Exp $
+
+MD5 (mush-7.2.5.tar.Z) = ecf3ba537e9936d765e0113361052f75
+MD5 (patch-7.2.6-alpha-1) = 97fa466431171051bed08f5e5165137e
+MD5 (patch-7.2.6-alpha-2) = c7763ae91d3e469c34a1c77e60583a60
+MD5 (patch-7.2.6-alpha-3) = 5510ba98c510a09fca844f0cf0a48f9e
+MD5 (patch-7.2.6-beta-1) = 61627bba6aac5e5d6781205370649e35
+MD5 (patch-7.2.6-beta-2) = a864a84e515e0d38628049ce5160b46b
+MD5 (patch-7.2.6-beta-3) = a46a60543a46ab2ae76cd70c373b0b68
+MD5 (patch-7.2.6-beta-4) = 3f80887b12860b3a28cc1edf465f86bd
diff --git a/mail/mush/patches/patch-aa b/mail/mush/patches/patch-aa
new file mode 100644
index 00000000000..32db031d4ef
--- /dev/null
+++ b/mail/mush/patches/patch-aa
@@ -0,0 +1,21 @@
+$NetBSD: patch-aa,v 1.1 1998/09/04 18:33:46 christos Exp $
+
+*** old/curs_io.c Fri Sep 4 11:22:07 1998
+--- curs_io.c Fri Sep 4 11:21:28 1998
+***************
+*** 56,62 ****
+ if (is_tty)
+ savetty();
+
+! #if defined(SYSV) || defined(AIX)
+ eofc = _tty.c_cc[VEOF];
+ #else
+ #ifdef BSD
+--- 56,62 ----
+ if (is_tty)
+ savetty();
+
+! #if defined(SYSV) || defined(AIX) || defined(POSIX)
+ eofc = _tty.c_cc[VEOF];
+ #else
+ #ifdef BSD
diff --git a/mail/mush/patches/patch-ab b/mail/mush/patches/patch-ab
new file mode 100644
index 00000000000..7f13124941f
--- /dev/null
+++ b/mail/mush/patches/patch-ab
@@ -0,0 +1,48 @@
+$NetBSD: patch-ab,v 1.1 1998/09/04 18:33:46 christos Exp $
+
+*** old/file.c Fri Sep 4 11:22:07 1998
+--- file.c Fri Sep 4 11:21:28 1998
+***************
+*** 115,121 ****
+ return buf; /* it may be wanted for creating */
+ }
+ *isdir = -1;
+! return sys_errlist[errno];
+ }
+ *isdir = ((stat_buf.st_mode & S_IFMT) == S_IFDIR);
+ return buf;
+--- 115,121 ----
+ return buf; /* it may be wanted for creating */
+ }
+ *isdir = -1;
+! return (char *) sys_errlist[errno];
+ }
+ *isdir = ((stat_buf.st_mode & S_IFMT) == S_IFDIR);
+ return buf;
+***************
+*** 396,401 ****
+--- 396,402 ----
+ register int total = 0;
+ char file[MAXPATHLEN], buf[HDRSIZ], *start = s, c;
+ register char *p, *b = buf, *fpath;
++ static char gpat[] = "/?*=*?/\052";
+
+ do {
+ if (!(p = get_name_n_addr(s, NULL, file)))
+***************
+*** 409,415 ****
+ * \052 is a * for broken compilers that would do a comment.
+ */
+ if (force || *file == '+' || *file == '~' ||
+! *file == '|' || *file == '/' && !glob(file, "/?*=*?/\052")) {
+ int isdir;
+ /* open either "file" or &file[1] */
+ if (*file == '|') {
+--- 410,416 ----
+ * \052 is a * for broken compilers that would do a comment.
+ */
+ if (force || *file == '+' || *file == '~' ||
+! *file == '|' || *file == '/' && !glob(file, gpat)) {
+ int isdir;
+ /* open either "file" or &file[1] */
+ if (*file == '|') {
diff --git a/mail/mush/patches/patch-ac b/mail/mush/patches/patch-ac
new file mode 100644
index 00000000000..361cb512fa6
--- /dev/null
+++ b/mail/mush/patches/patch-ac
@@ -0,0 +1,21 @@
+$NetBSD: patch-ac,v 1.1 1998/09/04 18:33:47 christos Exp $
+
+*** old/malloc.c Fri Sep 4 11:22:08 1998
+--- malloc.c Fri Sep 4 11:21:28 1998
+***************
+*** 436,442 ****
+ {
+ extern char end[];
+
+! if (cp && cp >= end && cp < stackbottom && cp < (char *) &cp && debug < 5)
+ free(cp);
+ }
+
+--- 436,442 ----
+ {
+ extern char end[];
+
+! if (cp && cp >= (void *) end && cp < (void *) stackbottom && cp < (void *) &cp && debug < 5)
+ free(cp);
+ }
+
diff --git a/mail/mush/patches/patch-ad b/mail/mush/patches/patch-ad
new file mode 100644
index 00000000000..43972c1ebee
--- /dev/null
+++ b/mail/mush/patches/patch-ad
@@ -0,0 +1,978 @@
+$NetBSD: patch-ad,v 1.1 1998/09/04 18:33:47 christos Exp $
+
+*** old/mush.h Fri Sep 4 12:08:00 1998
+--- mush.h Fri Sep 4 13:12:45 1998
+***************
+*** 4,92 ****
+
+ /* POSIX -- a collection of standardized parts from SYSV and BSD */
+ #if defined(POSIX) || defined(BSD44)
+! #include <unistd.h>
+! #ifndef NO_STDLIB
+! #include <stdlib.h>
+! #endif
+! #define SIGRET void
+ #endif
+ #ifdef SVR4
+! #include <libgen.h>
+ #endif
+
+ /* STDC -- i.e. ANSI C, a collection of standardized modifications to
+ * the C language, often accompanied by [partial] POSIX compliance
+ */
+ #ifdef __STDC__
+! #ifndef VPRINTF
+! #define VPRINTF
+! #endif
+ #endif
+
+ #ifdef CURSES
+
+! #ifndef POSIX
+! #ifdef USG
+! # define _USG
+! # undef USG
+! #endif /* USG */
+! #ifdef SYSV
+! # define _SYSV
+! # undef SYSV
+! #endif /* SYSV */
+! #endif /* POSIX */
+!
+! #ifdef NCURSES
+! # undef NCURSES
+! # include <ncurses.h>
+! #else
+! # include <curses.h>
+! #endif
+!
+! #ifdef timeout
+! #undef timeout
+! #endif
+! #ifdef overwrite
+! #undef overwrite
+! #endif
+!
+! #ifdef linux
+! #include <termios.h>
+! #endif /* linux */
+!
+! #if !defined(USG) && defined(_USG)
+! # define USG
+! #endif /* USG */
+! #if !defined(SYSV) && defined(_SYSV)
+! # define SYSV
+! #endif /* SYSV */
+
+ #else /* CURSES */
+! #include <stdio.h>
+! #if defined(POSIX) || defined(SVR4)
+! #include <termios.h>
+! #else /* POSIX */
+! #if defined(SYSV) && defined(USG) || defined(AIX)
+! #include <termio.h>
+! #ifdef DGUX
+! #include <ioctl.h>
+! #endif /* DGUX */
+! #endif /* POSIX */
+! #endif /* SYSV && USG */
+ #endif /* CURSES */
+
+ #ifdef HPUX
+! #include <termio.h>
+ #endif /* HPUX */
+
+ #if defined(SVR4)
+! #include <sys/ttold.h>
+ #endif /* SVR4 */
+
+ #include <ctype.h>
+ #include <errno.h>
+ #include <setjmp.h>
+ #include "strings.h"
+
+ #ifndef __STDC__
+ extern char
+--- 4,101 ----
+
+ /* POSIX -- a collection of standardized parts from SYSV and BSD */
+ #if defined(POSIX) || defined(BSD44)
+! # include <unistd.h>
+! # ifndef NO_STDLIB
+! # include <stdlib.h>
+! # endif
+! # define SIGRET void
+ #endif
++
+ #ifdef SVR4
+! # include <libgen.h>
+ #endif
+
+ /* STDC -- i.e. ANSI C, a collection of standardized modifications to
+ * the C language, often accompanied by [partial] POSIX compliance
+ */
+ #ifdef __STDC__
+! # ifndef VPRINTF
+! # define VPRINTF
+! # endif
+ #endif
+
+ #ifdef CURSES
+
+! # ifndef POSIX
+! # ifdef USG
+! # define _USG
+! # undef USG
+! # endif /* USG */
+! # ifdef SYSV
+! # define _SYSV
+! # undef SYSV
+! # endif /* SYSV */
+! # endif /* POSIX */
+!
+! # ifdef BSD44
+! # include <termios.h>
+! # endif /* BSD44 */
+! # ifdef NCURSES
+! # undef NCURSES
+! # include <ncurses.h>
+! # else
+! # include <curses.h>
+! # endif
+!
+! # ifdef timeout
+! # undef timeout
+! # endif
+! # ifdef overwrite
+! # undef overwrite
+! # endif
+!
+! # ifdef linux
+! # include <termios.h>
+! # endif /* linux */
+!
+! # if !defined(USG) && defined(_USG)
+! # define USG
+! # endif /* USG */
+! # if !defined(SYSV) && defined(_SYSV)
+! # define SYSV
+! # endif /* SYSV */
+
+ #else /* CURSES */
+! # include <stdio.h>
+! # if defined(POSIX) || defined(SVR4)
+! # include <termios.h>
+! # else /* POSIX */
+! # if defined(SYSV) && defined(USG) || defined(AIX)
+! # include <termio.h>
+! # ifdef DGUX
+! # include <ioctl.h>
+! # endif /* DGUX */
+! # endif /* SYSV && USG || AIX */
+! # endif /* POSIX */
+ #endif /* CURSES */
+
+ #ifdef HPUX
+! # include <termio.h>
+ #endif /* HPUX */
+
+ #if defined(SVR4)
+! # include <sys/ttold.h>
+ #endif /* SVR4 */
+
+ #include <ctype.h>
+ #include <errno.h>
+ #include <setjmp.h>
+ #include "strings.h"
++ #ifdef MSGS_DYNAMIC
++ # if (defined(sun) || defined(__sun__)) && (defined(sparc) || defined(__sparc__))
++ # include <alloca.h>
++ # endif
++ #endif
+
+ #ifndef __STDC__
+ extern char
+***************
+*** 100,178 ****
+ xfree(); /* free malloc'ed pointers */
+
+ #ifdef BSD
+! #define fputs Fputs /* See comments in print.c */
+ #endif /* BSD */
+
+ #if (defined(BSD) || defined(GETWD)) && !defined(__STDC__)
+ extern char *getwd();
+! #define GetCwd(buf,len) getwd(buf)
+ #else
+! #ifndef __STDC__
+ extern char *getcwd();
+! #endif
+! #define GetCwd(buf,len) getcwd(buf,len)
+ #endif /* BSD || GETWD */
+
+ #ifdef SUNTOOL
+! # include <suntool/sunview.h>
+! #ifdef SUN_4_0
+! # include <suntool/alert.h>
+! #endif /* SUN_4_0 */
+! # include <suntool/textsw.h>
+! # include <sys/ioctl.h> /* for ltchars */
+ #else
+! # include <sys/types.h>
+! # include <signal.h>
+! # ifndef SYSV
+! # include <sys/time.h>
+! # include <sys/ioctl.h> /* for ltchars */
+! # else
+! # include <time.h>
+! # ifdef M_UNIX
+! # ifndef SELECT
+! # define SELECT
+! # endif
+! # include <sys/select.h>
+! # endif /* M_UNIX */
+! # include <fcntl.h>
+! # endif /* SYSV */
+ #endif /* SUNTOOL */
+
+ #ifdef POSIX_UTIME
+! #ifdef POSIX
+! #include <utime.h>
+! #else /* POSIX */
+! #include <sys/utime.h>
+! #endif /* POSIX */
+ #endif /* POSIX_UTIME */
+ #include <sys/stat.h>
+ #include <sys/file.h>
+
+ #ifdef SUNTOOL
+! # include <suntool/panel.h>
+! # include <suntool/canvas.h>
+! # include <suntool/tty.h>
+! # include <suntool/menu.h>
+! # include <suntool/icon.h>
+! # include <suntool/scrollbar.h>
+! # include <suntool/icon_load.h>
+ #endif /* SUNTOOL */
+
+ /* if no maximum number of files can be found, we'll use getdtablesize() */
+ #ifdef _NFILE
+! # define MAXFILES _NFILE
+ #else
+! #ifdef NOFILE
+! # define MAXFILES NOFILE
+! #endif /* NOFILE */
+ #endif /* _NFILE */
+
+ #ifndef MAXPATHLEN
+! #define MAXPATHLEN BUFSIZ
+ #endif /* MAXPATHLEN */
+
+ #ifdef CTRL
+! #undef CTRL
+ #endif /* CTRL */
+ #define CTRL(c) ((c) & 037)
+
+--- 109,193 ----
+ xfree(); /* free malloc'ed pointers */
+
+ #ifdef BSD
+! # define fputs Fputs /* See comments in print.c */
+ #endif /* BSD */
+
+ #if (defined(BSD) || defined(GETWD)) && !defined(__STDC__)
+ extern char *getwd();
+! # define GetCwd(buf,len) getwd(buf)
+ #else
+! # ifndef __STDC__
+ extern char *getcwd();
+! # endif
+! # define GetCwd(buf,len) getcwd(buf,len)
+ #endif /* BSD || GETWD */
+
+ #ifdef SUNTOOL
+! # include <suntool/sunview.h>
+! # ifdef SUN_4_0
+! # include <suntool/alert.h>
+! # endif /* SUN_4_0 */
+! # include <suntool/textsw.h>
+! # include <sys/ioctl.h> /* for ltchars */
+ #else
+! # include <sys/types.h>
+! # include <signal.h>
+! # ifndef SYSV
+! # include <sys/time.h>
+! # include <sys/ioctl.h> /* for ltchars */
+! # else
+! # include <time.h>
+! # ifdef M_UNIX
+! # ifndef SELECT
+! # define SELECT
+! # endif
+! # include <sys/select.h>
+! # endif /* M_UNIX */
+! # include <fcntl.h>
+! # endif /* SYSV */
+ #endif /* SUNTOOL */
+
++ #ifdef BSD44
++ # define REGCOMP
++ # include <regex.h>
++ #endif
++
+ #ifdef POSIX_UTIME
+! # ifdef POSIX
+! # include <utime.h>
+! # else /* POSIX */
+! # include <sys/utime.h>
+! # endif /* POSIX */
+ #endif /* POSIX_UTIME */
++
+ #include <sys/stat.h>
+ #include <sys/file.h>
+
+ #ifdef SUNTOOL
+! # include <suntool/panel.h>
+! # include <suntool/canvas.h>
+! # include <suntool/tty.h>
+! # include <suntool/menu.h>
+! # include <suntool/icon.h>
+! # include <suntool/scrollbar.h>
+! # include <suntool/icon_load.h>
+ #endif /* SUNTOOL */
+
+ /* if no maximum number of files can be found, we'll use getdtablesize() */
+ #ifdef _NFILE
+! # define MAXFILES _NFILE
+ #else
+! # ifdef NOFILE
+! # define MAXFILES NOFILE
+! # endif /* NOFILE */
+ #endif /* _NFILE */
+
+ #ifndef MAXPATHLEN
+! # define MAXPATHLEN BUFSIZ
+ #endif /* MAXPATHLEN */
+
+ #ifdef CTRL
+! # undef CTRL
+ #endif /* CTRL */
+ #define CTRL(c) ((c) & 037)
+
+***************
+*** 180,199 ****
+
+ #define NO_STRING ""
+ #ifdef NULL
+! #undef NULL
+ #endif /* NULL */
+ #define NULL (char *)0
+ #define NULL_FILE (FILE *)0
+ #define DUBL_NULL (char **)0
+ #define TRPL_NULL (char ***)0
+ #ifdef putchar
+! #undef putchar
+ #endif /* putchar */
+ #define putchar(c) (void) (fputc(c, stdout), fflush(stdout))
+ #ifdef SUNTOOL
+ extern int bell();
+ #else /* SUNTOOL */
+! #define bell() (void) (fputc('\007', stderr), fflush(stderr))
+ #endif /* SUNTOOL */
+
+ /* For error recovery purposes, send keyboard generated signals to a special
+--- 195,218 ----
+
+ #define NO_STRING ""
+ #ifdef NULL
+! # undef NULL
+ #endif /* NULL */
++ #ifdef __STDC__
++ #define NULL (void *)0
++ #else
+ #define NULL (char *)0
++ #endif
+ #define NULL_FILE (FILE *)0
+ #define DUBL_NULL (char **)0
+ #define TRPL_NULL (char ***)0
+ #ifdef putchar
+! # undef putchar
+ #endif /* putchar */
+ #define putchar(c) (void) (fputc(c, stdout), fflush(stdout))
+ #ifdef SUNTOOL
+ extern int bell();
+ #else /* SUNTOOL */
+! # define bell() (void) (fputc('\007', stderr), fflush(stderr))
+ #endif /* SUNTOOL */
+
+ /* For error recovery purposes, send keyboard generated signals to a special
+***************
+*** 211,331 ****
+
+ /* Don't flush input when setting echo or cbreak modes (allow typeahead) */
+ #ifdef TIOCSETN
+! #ifdef stty
+! #undef stty
+! #endif /* stty */
+! #define stty(fd, sgttybuf) ioctl(fd, TIOCSETN, sgttybuf)
+ #endif /* TIOCSETN */
+
+ /* for system-V machines that run termio */
+ #if defined(SYSV) && defined(USG) || defined(AIX) || defined(POSIX) || defined(BSD44)
+! #ifdef crmode
+! #undef crmode
+! #undef nocrmode
+! #endif /* nocrmode */
+
+ unsigned char vmin, vtime;
+
+! #ifdef __linux__
+! # undef TCGETA
+! # undef TCSETAW
+! # define TCGETA TCGETS
+! # define TCSETAW TCSETSW
+! #endif
+! #ifdef BSD44
+! # undef TCGETA
+! # undef TCSETAW
+! # define TCGETA TIOCGETA
+! # define TCSETAW TIOCSETAW
+! #endif
+!
+! #ifdef POSIX
+! #define sg_erase c_cc[VERASE]
+! #define sg_flags c_lflag
+! #define sg_kill c_cc[VKILL]
+! #define gtty(fd, SGTTYbuf) tcgetattr(fd, SGTTYbuf)
+! #undef stty
+! #define stty(fd, SGTTYbuf) tcsetattr(fd, TCSADRAIN, SGTTYbuf)
+! #else /* !POSIX */
+! #define sg_erase c_cc[2]
+! #define sg_flags c_lflag
+! #define sg_kill c_cc[3]
+! #define sg_ospeed c_cflag
+! #define gtty(fd, SGTTYbuf) ioctl(fd, TCGETA, SGTTYbuf)
+! #undef stty
+! #define stty(fd, SGTTYbuf) ioctl(fd, TCSETAW, SGTTYbuf)
+! #endif /* POSIX */
+!
+! #define echon() (_tty.sg_flags |= (ECHO|ECHOE), stty(0, &_tty))
+! #define echoff() (_tty.sg_flags &= ~ECHO, stty(0, &_tty))
+! #define cbrkon() \
+ (_tty.sg_flags &= ~ICANON, _tty.c_cc[VMIN] = 1, stty(0, &_tty))
+! #define cbrkoff() \
+ (_tty.sg_flags |= ICANON,_tty.c_cc[VMIN] = vmin,_tty.c_iflag |= ICRNL, \
+ _tty.c_cc[VTIME] = vtime, stty(0, &_tty))
+
+! #ifdef __linux__
+! # undef savetty
+! # undef cbreak
+! # undef nocbreak
+! #endif
+
+! #ifndef savetty
+! # define savetty() \
+ (void) gtty(0, &_tty), vtime = _tty.c_cc[VTIME], vmin = _tty.c_cc[VMIN]
+! #endif
+! #ifndef cbreak
+! # define cbreak() cbrkon()
+! #endif
+! #ifndef nocbreak
+! # define nocbreak() cbrkoff()
+! #endif
+
+ /* If curses isn't defined, declare our 'tty' and macros for echo/cbreak */
+! #ifndef CURSES
+! #ifdef POSIX
+ typedef struct termios SGTTY;
+! #else
+ typedef struct termio SGTTY;
+! #endif
+! #define echom() echon()
+! #define noechom() echoff()
+! #define crmode() cbrkon()
+! #define nocrmode() cbrkoff()
+
+ /* These two moved from above; is that right?? Were they misplaced? */
+ /* are these even needed? I don't think any code (except below) uses them. */
+! #define cbreak() cbrkon()
+! #define nocbreak() cbrkoff()
+
+! #else /* CURSES */
+! #ifdef DEFINE_CURSES_SGTTY
+ typedef struct termios SGTTY;
+! #endif
+ /* If curses is defined, use the echo/cbreak commands in library only
+ * if curses is running. If curses isn't running, use macros above.
+ */
+! #define echom() ((iscurses) ? echo(): echon())
+! #define noechom() ((iscurses) ? noecho(): echoff())
+! #define crmode() ((iscurses) ? cbreak() : cbrkon())
+! #define nocrmode() ((iscurses) ? nocbreak() : cbrkoff())
+! #endif /* CURSES */
+ #endif /* SYSV && USG || AIX || POSIX || BSD44 */
+
+ #if !defined(USG) && !defined(AIX) && !defined(POSIX) && !defined(BSD44)
+! #ifndef CURSES
+ /* if curses is not defined, simulate the same tty based macros */
+ typedef struct sgttyb SGTTY;
+ /* Do real ioctl calls to set the tty modes */
+! #define crmode() (_tty.sg_flags |= CBREAK, stty(0, &_tty))
+! #define nocrmode() (_tty.sg_flags &= ~CBREAK, stty(0, &_tty))
+! #define echom() (_tty.sg_flags |= ECHO, stty(0, &_tty))
+! #define noechom() (_tty.sg_flags &= ~ECHO, stty(0, &_tty))
+! #define savetty() (void) gtty(0, &_tty)
+! #else /* CURSES */
+! #define echom() echo()
+! #define noechom() noecho()
+! #endif /* ~CURSES */
+ #endif /* ~USG */
+
+ /* With all that out of the way, we can now declare our tty type */
+--- 230,350 ----
+
+ /* Don't flush input when setting echo or cbreak modes (allow typeahead) */
+ #ifdef TIOCSETN
+! # ifdef stty
+! # undef stty
+! # endif /* stty */
+! # define stty(fd, sgttybuf) ioctl(fd, TIOCSETN, sgttybuf)
+ #endif /* TIOCSETN */
+
+ /* for system-V machines that run termio */
+ #if defined(SYSV) && defined(USG) || defined(AIX) || defined(POSIX) || defined(BSD44)
+! # ifdef crmode
+! # undef crmode
+! # undef nocrmode
+! # endif /* nocrmode */
+
+ unsigned char vmin, vtime;
+
+! # ifdef __linux__
+! # undef TCGETA
+! # undef TCSETAW
+! # define TCGETA TCGETS
+! # define TCSETAW TCSETSW
+! # endif
+! # ifdef BSD44
+! # undef TCGETA
+! # undef TCSETAW
+! # define TCGETA TIOCGETA
+! # define TCSETAW TIOCSETAW
+! # endif
+!
+! # ifdef POSIX
+! # define sg_erase c_cc[VERASE]
+! # define sg_flags c_lflag
+! # define sg_kill c_cc[VKILL]
+! # define gtty(fd, SGTTYbuf) tcgetattr(fd, SGTTYbuf)
+! # undef stty
+! # define stty(fd, SGTTYbuf) tcsetattr(fd, TCSADRAIN, SGTTYbuf)
+! # else /* !POSIX */
+! # define sg_erase c_cc[2]
+! # define sg_flags c_lflag
+! # define sg_kill c_cc[3]
+! # define sg_ospeed c_cflag
+! # define gtty(fd, SGTTYbuf) ioctl(fd, TCGETA, SGTTYbuf)
+! # undef stty
+! # define stty(fd, SGTTYbuf) ioctl(fd, TCSETAW, SGTTYbuf)
+! # endif /* POSIX */
+!
+! # define echon() (_tty.sg_flags |= (ECHO|ECHOE), stty(0, &_tty))
+! # define echoff() (_tty.sg_flags &= ~ECHO, stty(0, &_tty))
+! # define cbrkon() \
+ (_tty.sg_flags &= ~ICANON, _tty.c_cc[VMIN] = 1, stty(0, &_tty))
+! # define cbrkoff() \
+ (_tty.sg_flags |= ICANON,_tty.c_cc[VMIN] = vmin,_tty.c_iflag |= ICRNL, \
+ _tty.c_cc[VTIME] = vtime, stty(0, &_tty))
+
+! # ifdef __linux__
+! # undef savetty
+! # undef cbreak
+! # undef nocbreak
+! # endif
+
+! # ifndef savetty
+! # define savetty() \
+ (void) gtty(0, &_tty), vtime = _tty.c_cc[VTIME], vmin = _tty.c_cc[VMIN]
+! # endif
+! # ifndef cbreak
+! # define cbreak() cbrkon()
+! # endif
+! # ifndef nocbreak
+! # define nocbreak() cbrkoff()
+! # endif
+
+ /* If curses isn't defined, declare our 'tty' and macros for echo/cbreak */
+! # ifndef CURSES
+! # ifdef POSIX
+ typedef struct termios SGTTY;
+! # else
+ typedef struct termio SGTTY;
+! # endif
+! # define echom() echon()
+! # define noechom() echoff()
+! # define crmode() cbrkon()
+! # define nocrmode() cbrkoff()
+
+ /* These two moved from above; is that right?? Were they misplaced? */
+ /* are these even needed? I don't think any code (except below) uses them. */
+! # define cbreak() cbrkon()
+! # define nocbreak() cbrkoff()
+
+! # else /* CURSES */
+! # if defined(DEFINE_CURSES_SGTTY) || defined(BSD44)
+ typedef struct termios SGTTY;
+! # endif
+ /* If curses is defined, use the echo/cbreak commands in library only
+ * if curses is running. If curses isn't running, use macros above.
+ */
+! # define echom() ((iscurses) ? echo(): echon())
+! # define noechom() ((iscurses) ? noecho(): echoff())
+! # define crmode() ((iscurses) ? cbreak() : cbrkon())
+! # define nocrmode() ((iscurses) ? nocbreak() : cbrkoff())
+! # endif /* CURSES */
+ #endif /* SYSV && USG || AIX || POSIX || BSD44 */
+
+ #if !defined(USG) && !defined(AIX) && !defined(POSIX) && !defined(BSD44)
+! # ifndef CURSES
+ /* if curses is not defined, simulate the same tty based macros */
+ typedef struct sgttyb SGTTY;
+ /* Do real ioctl calls to set the tty modes */
+! # define crmode() (_tty.sg_flags |= CBREAK, stty(0, &_tty))
+! # define nocrmode() (_tty.sg_flags &= ~CBREAK, stty(0, &_tty))
+! # define echom() (_tty.sg_flags |= ECHO, stty(0, &_tty))
+! # define noechom() (_tty.sg_flags &= ~ECHO, stty(0, &_tty))
+! # define savetty() (void) gtty(0, &_tty)
+! # else /* CURSES */
+! # define echom() echo()
+! # define noechom() noecho()
+! # endif /* ~CURSES */
+ #endif /* ~USG */
+
+ /* With all that out of the way, we can now declare our tty type */
+***************
+*** 351,428 ****
+ #define Debug if (debug == 0) {;} else (void) wprint
+
+ #ifdef SYSV
+! #ifndef L_SET
+! #define L_SET 0
+! #endif /* L_SET */
+! #ifndef F_OK
+! #define F_OK 000
+! #define R_OK 004
+! #define W_OK 002
+! #define E_OK 001
+! #endif /* F_OK */
+! #ifdef u_long
+! #undef u_long
+! #endif /* u_long */
+! #define u_long unsigned long
+! #ifndef HPUX
+! #define vfork fork
+! #endif /* HPUX */
+! #ifndef SIGCHLD
+! #define SIGCHLD SIGCLD
+! #endif /* SIGCHLD */
+ #endif /* SYSV */
+
+ #if !defined(SUNTOOL) && !defined(CURSES)
+
+! #define TRUE 1
+! #define FALSE 0
+! #define print (void) printf
+! #define wprint (void) printf
+! #define print_more (void) printf
+
+ #endif /* !SUNTOOL && !CURSES */
+
+ #ifndef max
+! #define max(a,b) (((a) > (b)) ? (a) : (b))
+! #define min(a,b) (((a) < (b)) ? (a) : (b))
+ #endif /* max */
+
+ #if defined(CURSES) && (!defined(SUNTOOL))
+! #define wprint (void) printf
+ #endif /* CURSES && (!SUNTOOL) */
+
+ #ifdef SUNTOOL
+ /* stdout may be closed */
+! #define printf wprint
+ #else /* !SUNTOOL */
+! #define ok_box print
+ #endif /* SUNTOOL */
+
+ #if defined(CURSES) || defined(SUNTOOL)
+! #define print_more turnon(glob_flags, CONT_PRNT), print
+! #ifdef __STDC__
+ void print(char *fmt,...); /* compliance with ansi header for varargs */
+! #else /* __STDC__ */
+ void print(); /* printf to window or curses or tty accordingly */
+! #endif /* __STDC__ */
+ #endif /* CURSES || SUNTOOL */
+
+ #define ArraySize(o) (sizeof(o) / sizeof(*o))
+
+ #ifdef SUNTOOL
+
+! #define NO_ITEM (Panel_item)0
+! #define NO_EVENT (struct inputevent *)0
+! #define TIME_OUT 60 /* sleep 60 secs between mailchecks */
+! #define PIX_XOR PIX_SRC ^ PIX_DST
+! #define ID event_id(event)
+! #define l_width() mush_font->pf_defaultsize.x /* width of letter */
+! #define l_height() mush_font->pf_defaultsize.y /* height of letter */
+! #define Clrtoeol(w,x,y) ((void) pw_text(w, x, y, PIX_SRC, mush_font, blank))
+!
+ /* Miscellaneous old-SunView cleanup */
+ #ifndef TTY_ARGV_DO_NOT_FORK
+! #define TTY_ARGV_DO_NOT_FORK (-1)
+ #endif
+
+ #endif /* SUNTOOL */
+--- 370,447 ----
+ #define Debug if (debug == 0) {;} else (void) wprint
+
+ #ifdef SYSV
+! # ifndef L_SET
+! # define L_SET 0
+! # endif /* L_SET */
+! # ifndef F_OK
+! # define F_OK 000
+! # define R_OK 004
+! # define W_OK 002
+! # define E_OK 001
+! # endif /* F_OK */
+! # ifdef u_long
+! # undef u_long
+! # endif /* u_long */
+! # define u_long unsigned long
+! # ifndef HPUX
+! # define vfork fork
+! # endif /* HPUX */
+! # ifndef SIGCHLD
+! # define SIGCHLD SIGCLD
+! # endif /* SIGCHLD */
+ #endif /* SYSV */
+
+ #if !defined(SUNTOOL) && !defined(CURSES)
+
+! # define TRUE 1
+! # define FALSE 0
+! # define print (void) printf
+! # define wprint (void) printf
+! # define print_more (void) printf
+
+ #endif /* !SUNTOOL && !CURSES */
+
+ #ifndef max
+! # define max(a,b) (((a) > (b)) ? (a) : (b))
+! # define min(a,b) (((a) < (b)) ? (a) : (b))
+ #endif /* max */
+
+ #if defined(CURSES) && (!defined(SUNTOOL))
+! # define wprint (void) printf
+ #endif /* CURSES && (!SUNTOOL) */
+
+ #ifdef SUNTOOL
+ /* stdout may be closed */
+! # define printf wprint
+ #else /* !SUNTOOL */
+! # define ok_box print
+ #endif /* SUNTOOL */
+
+ #if defined(CURSES) || defined(SUNTOOL)
+! # define print_more turnon(glob_flags, CONT_PRNT), print
+! # ifdef __STDC__
+ void print(char *fmt,...); /* compliance with ansi header for varargs */
+! # else /* __STDC__ */
+ void print(); /* printf to window or curses or tty accordingly */
+! # endif /* __STDC__ */
+ #endif /* CURSES || SUNTOOL */
+
+ #define ArraySize(o) (sizeof(o) / sizeof(*o))
+
+ #ifdef SUNTOOL
+
+! # define NO_ITEM (Panel_item)0
+! # define NO_EVENT (struct inputevent *)0
+! # define TIME_OUT 60 /* sleep 60 secs between mailchecks */
+! # define PIX_XOR PIX_SRC ^ PIX_DST
+! # define ID event_id(event)
+! # define l_width() mush_font->pf_defaultsize.x /* width of letter */
+! # define l_height() mush_font->pf_defaultsize.y /* height of letter */
+! # define Clrtoeol(w,x,y) ((void) pw_text(w, x, y, PIX_SRC, mush_font, blank))
+!
+ /* Miscellaneous old-SunView cleanup */
+ #ifndef TTY_ARGV_DO_NOT_FORK
+! # define TTY_ARGV_DO_NOT_FORK (-1)
+ #endif
+
+ #endif /* SUNTOOL */
+***************
+*** 547,554 ****
+ /* It is possible to reset MAX_PRIORITY to as high as 9 */
+ #define MAX_PRIORITY 5
+
+! #define MAXMSGS_BITS ((MAXMSGS+7)/8) /* number of bits for bitmap */
+!
+ struct msg {
+ u_long m_flags;
+ long m_offset; /* offset in tempfile of msg */
+--- 566,578 ----
+ /* It is possible to reset MAX_PRIORITY to as high as 9 */
+ #define MAX_PRIORITY 5
+
+! #ifndef MSGS_DYNAMIC
+! # define MAXMSGS_BITS MAXMSGS/sizeof(char) /* number of bits for bitmap */
+! #else
+! # define MSGS_BITS(a) (((a)+7)/8)
+! # define MSGS_INCR 500
+! #endif
+!
+ struct msg {
+ u_long m_flags;
+ long m_offset; /* offset in tempfile of msg */
+***************
+*** 559,565 ****
+ char *m_to; /* Cached To: field */
+ char *m_subject; /* Cached Subject: field */
+ char *m_from; /* Cached Reply-To: or From: field */
+! } msg[MAXMSGS];
+
+ struct options {
+ char *option;
+--- 583,598 ----
+ char *m_to; /* Cached To: field */
+ char *m_subject; /* Cached Subject: field */
+ char *m_from; /* Cached Reply-To: or From: field */
+! char *m_addr; /* Cached Reply-To: or From: field */
+! char *m_name; /* Cached Reply-To: or From: field */
+! char m_author; /* if any of the 3 preceding ones has been inited */
+! u_long m_spare; /* spare field */
+! }
+! #ifdef MSGS_DYNAMIC
+! *msg;
+! #else
+! msg[MAXMSGS];
+! #endif
+
+ struct options {
+ char *option;
+***************
+*** 603,609 ****
+--- 636,646 ----
+ char
+ debug, /* debug causes various print statements in code */
+ tempfile[MAXPATHLEN], /* path to filename of temporary file */
++ #ifdef MSGS_DYNAMIC
++ *msg_list, /* boolean storage */
++ #else
+ msg_list[MAXMSGS_BITS], /* MAXMSGS bits of boolean storage */
++ #endif
+ **alternates, /* alternates list --see alts() */
+ *cmd_help, /* filename of location for "command -?" commands. */
+ *login, /* login name of user */
+***************
+*** 658,663 ****
+--- 695,703 ----
+ int
+ last_msg_cnt, /* when checking for new mail, save the last msg_cnt */
+ msg_cnt, /* total number of messages */
++ #ifdef MSGS_DYNAMIC
++ msg_max, /* current maximum allocation limit */
++ #endif
+ crt, /* min number of lines msg contains to invoke pager */
+ current_msg, /* the current message we're dealing with */
+ exec_pid, /* pid of a command that has been "exec"ed */
+***************
+*** 666,672 ****
+ #if defined(SUNTOOL) || defined(lint)
+ istool, /* argv[0] == "xxxxtool", ranges from 0 to 2 */
+ #else /* !SUNTOOL */
+! #define istool 0
+ #endif /* SUNTOOL */
+ n_array[128], /* array of message numbers in the header window */
+ screen, /* number of headers window can handle */
+--- 706,712 ----
+ #if defined(SUNTOOL) || defined(lint)
+ istool, /* argv[0] == "xxxxtool", ranges from 0 to 2 */
+ #else /* !SUNTOOL */
+! # define istool 0
+ #endif /* SUNTOOL */
+ n_array[128], /* array of message numbers in the header window */
+ screen, /* number of headers window can handle */
+***************
+*** 725,731 ****
+ char * quoteit();
+
+ #ifndef SIGRET
+! #define SIGRET int
+ #endif /* SIGRET */
+ SIGRET
+ rm_edfile(), /* remove letter-compose file on interrupts */
+--- 765,771 ----
+ char * quoteit();
+
+ #ifndef SIGRET
+! # define SIGRET int
+ #endif /* SIGRET */
+ SIGRET
+ rm_edfile(), /* remove letter-compose file on interrupts */
+***************
+*** 754,762 ****
+ #ifdef TIOCGLTC
+ struct ltchars ltchars; /* tty character settings */
+ #endif /* TIOCGLTC */
+! #if defined(BSD) && !defined(AIX) /* (TIOCGETC) */
+ struct tchars tchars; /* more tty character settings */
+! #endif /* BSD && !AIX (TIOCGETC) */
+
+ #ifdef CURSES
+
+--- 794,802 ----
+ #ifdef TIOCGLTC
+ struct ltchars ltchars; /* tty character settings */
+ #endif /* TIOCGLTC */
+! #if defined(BSD) && !defined(AIX) && defined(TIOCGETC)
+ struct tchars tchars; /* more tty character settings */
+! #endif /* BSD && !AIX && TIOCGETC */
+
+ #ifdef CURSES
+
+***************
+*** 775,790 ****
+ mac_flush(); /* Abandon macro processing (on error) */
+
+ #if defined(SUNTOOL) || defined(POP3_SUPPORT)
+! #ifdef POP3_SUPPORT
+! #define MIN_TIME_OUT (15 * 60) /* 15 min. checks */
+ extern void popchkmail();
+ extern void popgetmail();
+! #ifdef MAIL_FROM_POPHOST
+ extern char *pophostname();
+! #endif /* MAIL_FROM_POPHOST */
+! #else
+! #define MIN_TIME_OUT 30 /* 30 sec. checks */
+! #endif /* POP3_SUPPORT */
+
+ int
+ time_out; /* time out interval to wait for new mail */
+--- 815,830 ----
+ mac_flush(); /* Abandon macro processing (on error) */
+
+ #if defined(SUNTOOL) || defined(POP3_SUPPORT)
+! # ifdef POP3_SUPPORT
+! # define MIN_TIME_OUT (15 * 60) /* 15 min. checks */
+ extern void popchkmail();
+ extern void popgetmail();
+! # ifdef MAIL_FROM_POPHOST
+ extern char *pophostname();
+! # endif /* MAIL_FROM_POPHOST */
+! # else
+! # define MIN_TIME_OUT 30 /* 30 sec. checks */
+! # endif /* POP3_SUPPORT */
+
+ int
+ time_out; /* time out interval to wait for new mail */
diff --git a/mail/mush/patches/patch-ae b/mail/mush/patches/patch-ae
new file mode 100644
index 00000000000..f7c74aa7839
--- /dev/null
+++ b/mail/mush/patches/patch-ae
@@ -0,0 +1,48 @@
+$NetBSD: patch-ae,v 1.1 1998/09/04 18:33:47 christos Exp $
+
+*** old/panels.c Fri Sep 4 11:22:05 1998
+--- panels.c Fri Sep 4 11:21:28 1998
+***************
+*** 31,36 ****
+--- 31,37 ----
+ save_item, /* saves messages */
+ sub_hdr_item[6]; /* display items that just sit there and give help */
+
++ static char gpat[] = "*/{.,..}";
+ #ifndef NO_WALK_MENUS
+ Panel
+ folder_panel,
+***************
+*** 461,467 ****
+ struct stat s_buf;
+ char buf[MAXPATHLEN];
+
+! if (glob(path, "*/{.,..}")) {
+ return NULL;
+ }
+
+--- 462,468 ----
+ struct stat s_buf;
+ char buf[MAXPATHLEN];
+
+! if (glob(path, gpat)) {
+ return NULL;
+ }
+
+***************
+*** 708,714 ****
+ sprintf(buf, "%s/{.*,*}", path);
+ if (filexp(buf, &names) > 0) {
+ for (np = names; np && *np; np++) {
+! if (!glob(*np, "*/{.,..}"))
+ add_path_to_menu(item, *np, n);
+ }
+ free_vec(names);
+--- 709,715 ----
+ sprintf(buf, "%s/{.*,*}", path);
+ if (filexp(buf, &names) > 0) {
+ for (np = names; np && *np; np++) {
+! if (!glob(*np, gpat))
+ add_path_to_menu(item, *np, n);
+ }
+ free_vec(names);
diff --git a/mail/mush/patches/patch-af b/mail/mush/patches/patch-af
new file mode 100644
index 00000000000..8db2913ca2d
--- /dev/null
+++ b/mail/mush/patches/patch-af
@@ -0,0 +1,943 @@
+$NetBSD: patch-af,v 1.1 1998/09/04 18:33:47 christos Exp $
+
+*** old/commands.c Fri Sep 4 11:22:06 1998
+--- commands.c Fri Sep 4 11:21:28 1998
+***************
+*** 493,499 ****
+--- 493,503 ----
+ char **argv, *list;
+ {
+ register char *cmd = *argv;
++ #ifndef MSGS_DYNAMIC
+ char list1[MAXMSGS_BITS];
++ #else
++ char *list1 = (char *) alloca(MSGS_BITS(msg_cnt));
++ #endif
+ int cur_msg = current_msg, save_cnt = msg_cnt;
+
+ if (*++argv && !strcmp(*argv, "-?"))
+***************
+*** 502,508 ****
+ return -1;
+
+ /* make into our own list so ~: commands don't overwrite this list */
+! bitput(list, list1, MAXMSGS, =);
+
+ /* back up one arg to replace "cmd" in the new argv[0] */
+ argv += (n-1);
+--- 506,512 ----
+ return -1;
+
+ /* make into our own list so ~: commands don't overwrite this list */
+! bitput(list, list1, msg_cnt, =);
+
+ /* back up one arg to replace "cmd" in the new argv[0] */
+ argv += (n-1);
+***************
+*** 533,539 ****
+ if (istool)
+ (void) do_hdrs(0, DUBL_NULL, NULL);
+ /* copy the specified list back into msg_list */
+! bitput(list1, list, MAXMSGS, =);
+ return 0;
+ }
+
+--- 537,543 ----
+ if (istool)
+ (void) do_hdrs(0, DUBL_NULL, NULL);
+ /* copy the specified list back into msg_list */
+! bitput(list1, list, msg_cnt, =);
+ return 0;
+ }
+
+*** old/doproc.c Fri Sep 4 11:22:05 1998
+--- doproc.c Fri Sep 4 11:21:28 1998
+***************
+*** 859,865 ****
+ int value;
+ Event *event;
+ {
+! char *argv[3], list[MAXMSGS_BITS];
+ char *p = (char *)panel_get_value(msg_num_item);
+ int n = 0;
+
+--- 859,869 ----
+ int value;
+ Event *event;
+ {
+! #ifndef MSGS_DYNAMIC
+! char list[MAXMSGS_BITS];
+! #else
+! char *list = (char *) alloca(MSGS_BITS(msg_cnt));
+! #endif
+ char *p = (char *)panel_get_value(msg_num_item);
+ int n = 0;
+
+*** old/expr.c Thu May 3 15:40:10 1990
+--- expr.c Fri Sep 4 11:21:28 1998
+***************
+*** 17,23 ****
+--- 17,27 ----
+ {
+ register int num1 = -1, num2 = -1, except = 0;
+ register char *p2;
++ #ifndef MSGS_DYNAMIC
+ char list2[MAXMSGS_BITS];
++ #else
++ char *list2 = (char *) alloca(MSGS_BITS(msg_cnt));
++ #endif
+
+ if (!p)
+ return "";
+*** old/folders.c Fri Sep 4 11:22:09 1998
+--- folders.c Fri Sep 4 11:21:28 1998
+***************
+*** 138,145 ****
+--- 138,153 ----
+ xfree(msg[msg_cnt].m_subject);
+ xfree(msg[msg_cnt].m_to);
+ xfree(msg[msg_cnt].m_from);
++ xfree(msg[msg_cnt].m_name);
++ xfree(msg[msg_cnt].m_addr);
+ msg[msg_cnt].m_subject = NULL;
+ msg[msg_cnt].m_to = msg[msg_cnt].m_from = NULL;
++ msg[msg_cnt].m_name = msg[msg_cnt].m_addr = NULL;
++ msg[msg_cnt].m_author = 0;
++ msg[msg_cnt].m_flags = 0;
++ msg[msg_cnt].m_size = 0;
++ msg[msg_cnt].m_offset = 0;
++ msg[msg_cnt].m_lines = 0;
+ }
+ msg_cnt = 0, msg[0].m_offset = 0L;
+ turnoff(glob_flags, CONT_PRNT);
+***************
+*** 268,274 ****
+ register char **argv;
+ {
+ register char *p;
+! char buf[128], unused[MAXMSGS_BITS];
+
+ if (argv && argv[1] && !strcmp(argv[1], "-?"))
+ return help(0, "folders", cmd_help);
+--- 276,287 ----
+ register char **argv;
+ {
+ register char *p;
+! char buf[128];
+! #ifndef MSGS_DYNAMIC
+! char *unused[MAXMSGS_BITS];
+! #else
+! char *unused = (char *) alloca(MSGS_BITS(msg_cnt));
+! #endif
+
+ if (argv && argv[1] && !strcmp(argv[1], "-?"))
+ return help(0, "folders", cmd_help);
+***************
+*** 418,424 ****
+ char *argv[], list[];
+ {
+ int r, articles = 0, merge = 0, appending = 0;
+! char buf[MAXPATHLEN], cmdbuf[MAXPATHLEN], newlist[MAXMSGS_BITS], *dir;
+ char *art_sep = ARTICLE_SEP;
+ FILE *fp;
+
+--- 431,442 ----
+ char *argv[], list[];
+ {
+ int r, articles = 0, merge = 0, appending = 0;
+! char buf[MAXPATHLEN], cmdbuf[MAXPATHLEN], *dir;
+! #ifndef MSGS_DYNAMIC
+! char newlist[MAXMSGS_BITS];
+! #else
+! char *newlist = (char *) alloca(MSGS_BITS(msg_cnt));
+! #endif
+ char *art_sep = ARTICLE_SEP;
+ FILE *fp;
+
+*** old/loop.c Fri Sep 4 11:22:07 1998
+--- loop.c Fri Sep 4 11:21:28 1998
+***************
+*** 251,257 ****
+--- 251,261 ----
+
+ /* Return values from commands, see check_internal() */
+ static int last_status; /* Changes after every command */
++ #ifndef MSGS_DYNAMIC
+ static char last_output[MAXMSGS]; /* Changes after SUCCESSFUL command */
++ #else
++ char* last_output; /* Changes after SUCCESSFUL command */
++ #endif
+
+ /*
+ * do the command specified by the argument vector, argv.
+***************
+*** 1196,1203 ****
+--- 1200,1211 ----
+ struct history *hist;
+ #ifndef REGCMP
+ # ifdef REGCOMP
++ # ifdef REG_EXTENDED
++ regex_t rex;
++ # else
+ char *rex = NULL;
+ extern char *regcomp();
++ # endif
+ # else
+ extern char *re_comp();
+ # endif
+***************
+*** 1222,1228 ****
+--- 1230,1240 ----
+ if (*str) {
+ #ifndef REGCMP
+ # ifdef REGCOMP
++ # ifdef REG_EXTENDED
++ if (regcomp(&rex, str, REG_EXTENDED) != 0) /* Assign and test */
++ # else
+ if (!(rex = regcomp(str))) /* Assign and test */
++ # endif
+ # else
+ if (re_comp(str))
+ # endif
+***************
+*** 1256,1262 ****
+--- 1268,1278 ----
+ found =
+ #ifndef REGCMP
+ # ifdef REGCOMP
++ # ifdef REG_EXTENDED
++ regexec(&rex, buf, 0, NULL, 0) == 0
++ # else
+ !!regexec(rex, buf)
++ # endif
+ # else
+ re_exec(buf)
+ # endif
+***************
+*** 1273,1279 ****
+--- 1289,1299 ----
+ free(rex);
+ #else
+ # ifdef REGCOMP
++ # ifdef REG_EXTENDED
++ regfree(&rex);
++ # else
+ free(rex);
++ # endif
+ # endif
+ #endif
+ return (*p == '?' ? p + 1 : p);
+***************
+*** 1286,1292 ****
+--- 1306,1316 ----
+ #else
+ # ifdef REGCOMP
+ /* XXX: regfree */
++ # ifdef REG_EXTENDED
++ regfree(&rex);
++ # else
+ free(rex);
++ # endif
+ # endif
+ #endif
+ return NULL;
+*** old/mail.c Fri Sep 4 11:22:09 1998
+--- mail.c Fri Sep 4 11:21:28 1998
+***************
+*** 34,40 ****
+ char firstchar = (argv)? **argv: 'm';
+ char *to = NULL, *cc = NULL, *addcc = NULL, *bcc = NULL, *subj = NULL;
+ char *route = NULL;
+! char inc_list[MAXMSGS_BITS], buf[HDRSIZ];
+ u_long flgs = 0;
+
+ if (ison(glob_flags, IS_GETTING)) {
+--- 34,45 ----
+ char firstchar = (argv)? **argv: 'm';
+ char *to = NULL, *cc = NULL, *addcc = NULL, *bcc = NULL, *subj = NULL;
+ char *route = NULL;
+! char buf[HDRSIZ];
+! #ifndef MSGS_DYNAMIC
+! char inc_list[MAXMSGS_BITS];
+! #else
+! char *inc_list = (char *) alloca(MSGS_BITS(msg_cnt));
+! #endif
+ u_long flgs = 0;
+
+ if (ison(glob_flags, IS_GETTING)) {
+***************
+*** 350,356 ****
+--- 355,365 ----
+
+ /* If forwarding w/o editing, start a new file for each. */
+ if (ison(flags, FORWARD) && ison(flags, SEND_NOW)) {
++ #ifndef MSGS_DYNAMIC
+ char fwd[MAXMSGS_BITS];
++ #else
++ char *fwd = (char *) alloca(MSGS_BITS(msg_cnt));
++ #endif
+ register int i;
+ clear_msg_list(fwd);
+ for (i = 0; i < msg_cnt; i++)
+***************
+*** 694,700 ****
+--- 703,713 ----
+ putstring(p2, ed_fp);
+ }
+ when ':': {
++ #ifndef MSGS_DYNAMIC
+ char new[MAXMSGS_BITS];
++ #else
++ char *new = (char *) alloca(MSGS_BITS(msg_cnt));
++ #endif
+ u_long save_flags = glob_flags;
+
+ turnon(glob_flags, IGN_SIGS);
+***************
+*** 706,712 ****
+--- 719,729 ----
+ when 'i': case 'f': case 'I': case 'm': {
+ int n;
+ u_long copy_flgs = 0;
++ #ifndef MSGS_DYNAMIC
+ char list[MAXMSGS_BITS];
++ #else
++ char *list = (char *) alloca(MSGS_BITS(msg_cnt));
++ #endif
+
+ if (!msg_cnt) {
+ wprint("No messages.\n");
+***************
+*** 962,967 ****
+--- 979,985 ----
+ register char *p;
+ int c;
+ char buf[MAXPATHLEN];
++ static char gpat[] = "{,{,*[ \\,]}mail{,[ \\,]*}}";
+
+ /* forwarded mail has no additional personalized text */
+ if (ison(flags, FORWARD)) {
+***************
+*** 985,992 ****
+ p = NULL;
+ if (!strncmp(Cc, "~v", 2) ||
+ /* Flashy test for $verify either empty or set to "mail" */
+! glob(p = do_set(set_options, "verify"),
+! "{,{,*[ \\,]}mail{,[ \\,]*}}")) {
+ if (!p) /* so we don't Cc to ~v! */
+ *Cc = 0;
+ for (;;) {
+--- 1003,1009 ----
+ p = NULL;
+ if (!strncmp(Cc, "~v", 2) ||
+ /* Flashy test for $verify either empty or set to "mail" */
+! glob(p = do_set(set_options, "verify"), gpat)) {
+ if (!p) /* so we don't Cc to ~v! */
+ *Cc = 0;
+ for (;;) {
+*** old/main.c Fri Sep 4 11:22:09 1998
+--- main.c Fri Sep 4 11:21:28 1998
+***************
+*** 30,36 ****
+ char buf[MAXPATHLEN];
+ register char *p;
+ struct mush_flags Flags;
+!
+ #ifndef INTERNAL_MALLOC
+ extern char *stackbottom; /* used by xfree() */
+
+--- 30,36 ----
+ char buf[MAXPATHLEN];
+ register char *p;
+ struct mush_flags Flags;
+! static char gpat[] = "{,{,*[ \\,]}startup{,[ \\,]*}}";
+ #ifndef INTERNAL_MALLOC
+ extern char *stackbottom; /* used by xfree() */
+
+***************
+*** 59,64 ****
+--- 59,80 ----
+ malloc_debug(0);
+ #endif /* sun && debug */
+
++ #ifdef MSGS_DYNAMIC
++ {
++ extern char *last_output;
++ msg_max = MSGS_INCR;
++ msg = (struct msg *) malloc(sizeof(struct msg) * msg_max);
++ bzero(msg, sizeof(struct msg) * msg_max);
++ msg_list = (char *) malloc(MSGS_BITS(msg_max));
++ last_output = (char *) malloc(sizeof(char) * msg_max);
++ if (msg == (struct msg *) 0 || msg_list == NULL ||
++ last_output == NULL) {
++ (void) fprintf(stderr, "%s: Out of memory.\n", prog_name);
++ exit(1);
++ }
++ }
++ #endif
++
+ if (!isatty(0))
+ turnon(glob_flags, REDIRECT);
+ else
+***************
+*** 255,261 ****
+ (void) signal(SIGHUP, catch);
+
+ if (!hdrs_only && !istool && (!Flags.src_file || !Flags.src_n_exit) &&
+! !glob(do_set(set_options, "quiet"), "{,{,*[ \\,]}startup{,[ \\,]*}}"))
+ (void) printf("%s: Type '?' for help.\n", check_internal("version"));
+
+ (void) sprintf(buf, "folder %s %s", Flags.f_flags, mailfile);
+--- 271,277 ----
+ (void) signal(SIGHUP, catch);
+
+ if (!hdrs_only && !istool && (!Flags.src_file || !Flags.src_n_exit) &&
+! !glob(do_set(set_options, "quiet"), gpat))
+ (void) printf("%s: Type '?' for help.\n", check_internal("version"));
+
+ (void) sprintf(buf, "folder %s %s", Flags.f_flags, mailfile);
+*** old/misc.c Fri Sep 4 11:22:08 1998
+--- misc.c Fri Sep 4 11:21:28 1998
+***************
+*** 201,207 ****
+--- 201,211 ----
+ int argc, ret_val = -1;
+ u_long save_do_pipe = ison(glob_flags, DO_PIPE);
+ u_long save_is_pipe = ison(glob_flags, IS_PIPE);
++ #ifndef MSGS_DYNAMIC
+ char dummy_list[MAXMSGS_BITS];
++ #else
++ char *dummy_list = (char *) alloca(MSGS_BITS(msg_cnt));
++ #endif
+
+ turnoff(glob_flags, DO_PIPE);
+ turnoff(glob_flags, IS_PIPE);
+*** old/msgs.c Fri Sep 4 11:22:08 1998
+--- msgs.c Fri Sep 4 11:21:28 1998
+***************
+*** 843,848 ****
+--- 843,849 ----
+ }
+ #endif /* MMDF */
+ buf[0] = 0;
++ date[0] = 0;
+ while (fgets(buf, sizeof (buf), fp)) {
+ #ifndef MSG_SEPARATOR
+ turnoff(glob_flags, WARNING);
+***************
+*** 875,880 ****
+--- 876,882 ----
+ {
+ msg_found++;
+ had_error = 0;
++ #ifndef MSGS_DYNAMIC
+ if (append && cnt == MAXMSGS-append) {
+ wprint("WARNING: exceeded %d messages.\n", MAXMSGS-append);
+ wprint("Not all messages have been loaded.\n");
+***************
+*** 882,887 ****
+--- 884,931 ----
+ had_error++;
+ break;
+ }
++ #else
++ if (append && cnt == msg_max-append) {
++ /*
++ * XXX: should really ignore signals here but instead
++ * are careful with the order we do things
++ * so if we get interrupted, we only lose memory
++ */
++ int nmsg_max = msg_max + MSGS_INCR;
++ struct msg* m;
++ char* b, *l;
++ extern char* last_output;
++
++ m = (struct msg *) realloc(msg, sizeof(struct msg) *
++ nmsg_max);
++ if (m == (struct msg *) 0) {
++ bad:
++ wprint("Out of memory for %d messages.\n", nmsg_max);
++ wprint("Not all messages have been loaded.\n");
++ msg_cnt--;
++ had_error++;
++ break;
++ }
++
++ b = (char *) realloc(msg_list, MSGS_BITS(nmsg_max));
++ if (b == NULL)
++ goto bad;
++
++ l = (char *) realloc(last_output, sizeof(char) * nmsg_max);
++ if (l == NULL)
++ goto bad;
++
++
++ msg = m;
++ msg_list = b;
++ last_output = l;
++
++ bzero(&msg[msg_max], sizeof(struct msg) * MSGS_INCR);
++
++ msg_max = nmsg_max;
++
++ }
++ #endif /* MSGS_DYNAMIC */
+ if (ison(glob_flags, READ_ONLY))
+ bytes = ftell(fp) - strlen(buf);
+ else {
+***************
+*** 1058,1064 ****
+ }
+ close_lock(file, fp);
+ if (isoff(glob_flags, READ_ONLY)) {
+! if (had_error && msg_found && append == 1 && cnt == MAXMSGS-append) {
+ wprint("Using read-only mode.\n");
+ turnon(glob_flags, READ_ONLY);
+ had_error = 0; /* return successfully anyway */
+--- 1102,1113 ----
+ }
+ close_lock(file, fp);
+ if (isoff(glob_flags, READ_ONLY)) {
+! #ifndef MSGS_DYNAMIC
+! if (had_error && msg_found && append == 1 && cnt == MAXMSGS-append)
+! #else
+! if (had_error && msg_found && append == 1 && cnt == msg_max-append)
+! #endif
+! {
+ wprint("Using read-only mode.\n");
+ turnon(glob_flags, READ_ONLY);
+ had_error = 0; /* return successfully anyway */
+
+*** old/version.h Fri Sep 4 11:22:09 1998
+--- version.h Fri Sep 4 11:21:28 1998
+***************
+*** 1,7 ****
+ /* @(#)version.h (c) Copyright 1989, 1990, 1991 (Dan Heller) */
+
+ #define MUSHNAME "Mail User's Shell"
+! #define RELEASE_DATE "beta(4) 03/19/98"
+ #define RELEASE 7
+ #define REVISION "2"
+ #define PATCHLEVEL 6
+--- 1,7 ----
+ /* @(#)version.h (c) Copyright 1989, 1990, 1991 (Dan Heller) */
+
+ #define MUSHNAME "Mail User's Shell"
+! #define RELEASE_DATE "beta(4)+dynamic 03/19/98"
+ #define RELEASE 7
+ #define REVISION "2"
+ #define PATCHLEVEL 6
+
+*** pick.c.orig Fri Sep 4 12:07:59 1998
+--- pick.c Fri Sep 4 13:12:17 1998
+***************
+*** 11,19 ****
+ static int pick();
+ static void month_day_year();
+
+! #ifdef REGCOMP
+ regerror(msg)
+! char *msg;
+ {
+ printf("regcomp error: %s\n", msg);
+ }
+--- 11,20 ----
+ static int pick();
+ static void month_day_year();
+
+! #if defined(REGCOMP) && !defined(REG_EXTENDED)
+! void
+ regerror(msg)
+! const char *msg;
+ {
+ printf("regcomp error: %s\n", msg);
+ }
+***************
+*** 23,29 ****
+--- 24,34 ----
+ register int n;
+ register char **argv, list[];
+ {
++ #ifndef MSGS_DYNAMIC
+ char ret_list[MAXMSGS_BITS];
++ #else
++ char *ret_list = (char *) alloca(MSGS_BITS(msg_cnt));
++ #endif
+
+ if (n > 1 && !strcmp(argv[1], "-?"))
+ return help(0, "pick", cmd_help);
+***************
+*** 72,78 ****
+ register char c;
+ int matches = 0;
+ char pattern[256];
+! short head_first, head_cnt, tail_cnt, search = TRUE;
+ int n;
+
+ if (!msg_cnt) {
+--- 77,83 ----
+ register char c;
+ int matches = 0;
+ char pattern[256];
+! short head_first, head_cnt, tail_cnt, search = TRUE, dups = FALSE;
+ int n;
+
+ if (!msg_cnt) {
+***************
+*** 166,171 ****
+--- 171,177 ----
+ turnon(match_priority, M_PRIORITY(c - 'A' + 1));
+ when 'x' : xflg = 1;
+ when 'i' : icase = 1;
++ when 'D' : dups = FALSE;
+ otherwise:
+ print("pick: unknown flag: %c\n", argv[0][1]);
+ clear_msg_list(ret_list);
+***************
+*** 175,181 ****
+ print("Can't specify -x and head/tail options together.\n");
+ return -1;
+ }
+! if (!mdy[1]) {
+ (void) argv_to_string(pattern, argv);
+ if (pattern[0] == '\0' && match_priority == 0 &&
+ head_cnt + tail_cnt < 0) {
+--- 181,187 ----
+ print("Can't specify -x and head/tail options together.\n");
+ return -1;
+ }
+! if (!mdy[1] && !dups) {
+ (void) argv_to_string(pattern, argv);
+ if (pattern[0] == '\0' && match_priority == 0 &&
+ head_cnt + tail_cnt < 0) {
+***************
+*** 184,190 ****
+ return -1;
+ }
+ }
+! search = (pattern[0] || mdy[1] || (match_priority != 0));
+ if (verbose) {
+ if (head_cnt + tail_cnt >= 0) {
+ print("Finding the ");
+--- 190,196 ----
+ return -1;
+ }
+ }
+! search = (pattern[0] || mdy[1] || (match_priority > 0));
+ if (verbose) {
+ if (head_cnt + tail_cnt >= 0) {
+ print("Finding the ");
+***************
+*** 209,216 ****
+ print_more(" of the last %d", tail_cnt);
+ } else
+ print_more("Searching for %smessages",
+! match_priority != 0 ? "priority " : "");
+! if (!search) {
+ if (tail_cnt > 0 && head_cnt > 0)
+ print_more(" messages");
+ if (ison(glob_flags, IS_PIPE))
+--- 215,224 ----
+ print_more(" of the last %d", tail_cnt);
+ } else
+ print_more("Searching for %smessages",
+! match_priority > 0 ? "priority " : "");
+! if (dups) {
+! print_more(" that are duplicates");
+! } else if (!search) {
+ if (tail_cnt > 0 && head_cnt > 0)
+ print_more(" messages");
+ if (ison(glob_flags, IS_PIPE))
+***************
+*** 241,247 ****
+ }
+ if (mdy[1] > 0 && icase)
+ print("using date: -i flag ignored.\n");
+! if (!search) {
+ for (n = 0; n < msg_cnt && (!head_first || matches < head_cnt); n++)
+ if (msg_bit(list, n))
+ ++matches, set_msg_bit(ret_list, n);
+--- 249,258 ----
+ }
+ if (mdy[1] > 0 && icase)
+ print("using date: -i flag ignored.\n");
+! if (dups)
+! matches = find_dups(head_first? head_cnt : msg_cnt,
+! list, ret_list);
+! else if (!search) {
+ for (n = 0; n < msg_cnt && (!head_first || matches < head_cnt); n++)
+ if (msg_bit(list, n))
+ ++matches, set_msg_bit(ret_list, n);
+***************
+*** 284,289 ****
+--- 295,424 ----
+ return matches;
+ }
+
++
++ static int
++ cmplines(m1, m2)
++ struct msg **m1;
++ struct msg **m2;
++ {
++ int z = (int) (*m2)->m_lines - (int) (*m1)->m_lines;
++ if (z > 0)
++ return 1;
++ else if (z < 0)
++ return -1;
++ else
++ return 0;
++ }
++
++
++ /*
++ * find_dups searches for messages with the same body as others
++ */
++ find_dups(cnt, check_list, ret_list)
++ int cnt;
++ char check_list[], ret_list[];
++ {
++ int i, j, n, lcur, mcur;
++ int matches = 0;
++ #ifndef MSGS_DYNAMIC
++ struct msg *mlist[MAXMSGS];
++ #else
++ struct msg **mlist = (struct msg **) alloca(msg_cnt *
++ sizeof(struct msg *));
++ #endif
++ char *omsg = NULL, *nmsg = NULL, *otext, *ntext;
++ size_t otsize = 0, ntsize = 0, omsize = 0, nmsize = 0, mid;
++
++ if (cnt == -1)
++ cnt = msg_cnt;
++
++ for (i = 0, n = 0; i < cnt && n < msg_cnt; n++)
++ if (msg_bit(check_list, n)) {
++ mlist[i] = &msg[n];
++ mlist[i]->m_spare = n;
++ i++;
++ }
++
++ cnt = i;
++ qsort((char *) mlist, cnt, sizeof(struct msg *), cmplines);
++
++ clear_msg_list(ret_list);
++
++ lcur = -1;
++
++ for (i = 0; i < cnt - 1; i++) {
++ lcur = mlist[i]->m_lines;
++ mcur = mlist[i]->m_spare;
++
++ if (mlist[i + 1]->m_lines != lcur)
++ /* Next message has not the same number of lines, skip */
++ continue;
++
++ (void) msg_get(mcur, NULL, 0);
++ if (otsize < mlist[i]->m_size) {
++ otsize = mlist[i]->m_size;
++ otext = otext ? (char *) malloc(otsize) :
++ (char *) realloc(otext, otsize);
++ if (otext == NULL) {
++ print("Out of memory in find_dups\n");
++ goto bad;
++ }
++ }
++ if (fread(otext, 1, mlist[i]->m_size, tmpf) != mlist[i]->m_size) {
++ print("fread old for %d failed %d\n", mcur, sys_errlist[errno]);
++ goto bad;
++ }
++ if ((omsg = (char *) strstr(otext, "\n\n")) == NULL) {
++ printf("could not find start of message %d\n", mcur);
++ continue;
++ }
++ omsize = mlist[i]->m_size - (omsg - otext);
++ for (j = i + 1; j < cnt; j++) {
++ if (mlist[j]->m_lines != lcur)
++ /* Next message has not the same number of lines, skip */
++ break;
++ mid = mlist[j]->m_spare;
++ (void) msg_get(mid, NULL, 0);
++ if (ntsize < mlist[j]->m_size) {
++ ntsize = mlist[j]->m_size;
++ ntext = ntext ? (char *) malloc(ntsize) :
++ (char *) realloc(ntext, ntsize);
++ if (ntext == NULL) {
++ print("Out of memory in find_dups\n");
++ goto bad;
++ }
++ }
++ if (fread(ntext, 1, mlist[j]->m_size, tmpf) != mlist[j]->m_size) {
++ print("fread new for %d failed %d\n", mid, sys_errlist[errno]);
++ goto bad;
++ }
++ if ((nmsg = (char *) strstr(ntext, "\n\n")) == NULL) {
++ printf("could not find start of message %d\n", mid);
++ continue;
++ }
++ nmsize = mlist[j]->m_size - (nmsg - ntext);
++ if (nmsize != omsize)
++ continue;
++ if (memcmp(nmsg, omsg, nmsize) == 0) {
++ ++matches;
++ set_msg_bit(ret_list, mid);
++ }
++ }
++ }
++ if (otext)
++ free(otext);
++ if (ntext)
++ free(ntext);
++ return matches;
++ bad:
++ clear_msg_list(ret_list);
++ if (otext)
++ free(otext);
++ if (ntext)
++ free(ntext);
++ return 0;
++ }
++
+ /*
+ * find_pattern will search thru all the messages set in the check_list
+ * until the list runs out or "cnt" has been exhasted. ret_list contains
+***************
+*** 307,313 ****
+--- 442,452 ----
+ #endif
+ #else /* REGCMP */
+ # ifdef REGCOMP
++ # ifdef REG_EXTENDED
++ regex_t rex;
++ # else
+ char *regcomp(), *regexec();
++ # endif
+ # else
+ char *re_comp();
+ # endif
+***************
+*** 328,334 ****
+--- 467,478 ----
+ }
+ #else /* REGCMP */
+ # ifdef REGCOMP
++ # ifdef REG_EXTENDED
++ if (regcomp(&rex, p, REG_EXTENDED) != 0)
++ # else
+ if ((err = regcomp(p)) == NULL) {
++ # endif
++ {
+ clear_msg_list(ret_list);
+ return -1;
+ }
+***************
+*** 348,354 ****
+ /* start searching: set bytes, and message number: n */
+ for (n = 0; cnt && n < msg_cnt; n++)
+ if (msg_bit(check_list, n)) {
+! if (match_priority != 0) {
+ if (msg[n].m_flags & match_priority)
+ ++matches, set_msg_bit(ret_list, n);
+ continue;
+--- 492,498 ----
+ /* start searching: set bytes, and message number: n */
+ for (n = 0; cnt && n < msg_cnt; n++)
+ if (msg_bit(check_list, n)) {
+! if (match_priority > 0) {
+ if (msg[n].m_flags & match_priority)
+ ++matches, set_msg_bit(ret_list, n);
+ continue;
+***************
+*** 421,427 ****
+--- 565,575 ----
+ val = !!regex(err, p, NULL); /* convert value to a boolean */
+ #else /* REGCMP */
+ # ifdef REGCOMP
++ # ifdef REG_EXTENDED
++ val = regexec(&rex, p, 0, NULL, 0) == 0;
++ # else
+ val = !!regexec(err, p);
++ # endif
+ # else
+ val = re_exec(p);
+ # endif
+***************
+*** 448,455 ****
+--- 596,607 ----
+ #else
+ # ifdef REGCOMP
+ if (err)
++ # ifdef REG_EXTENDED
++ regfree(&rex);
++ # else
+ /* XXX: regfree soon */
+ free(err);
++ # endif
+ # endif
+ #endif /* REGCMP */
+ return matches;
+***************
+*** 476,482 ****
+--- 628,638 ----
+ #endif
+ #else /* REGCMP */
+ # ifdef REGCOMP
++ # ifdef REG_EXTENDED
++ regex_t rex;
++ # else
+ char *regcomp(), *regexec();
++ # endif
+ # else
+ char *re_comp();
+ # endif
+***************
+*** 509,515 ****
+ }
+ #else /* REGCMP */
+ # ifdef REGCOMP
+! if (*pattern && !(err = regcomp(pattern, NULL))) {
+ print("Error in regcomp in %s", pattern);
+ return 0;
+ }
+--- 665,676 ----
+ }
+ #else /* REGCMP */
+ # ifdef REGCOMP
+! # ifdef REG_EXTENDED
+! if (*pattern && regcomp(&rex, pattern, REG_EXTENDED))
+! # else
+! if (*pattern && !(err = regcomp(pattern, NULL)))
+! # endif
+! {
+ print("Error in regcomp in %s", pattern);
+ return 0;
+ }
+***************
+*** 534,540 ****
+--- 695,705 ----
+ val = !!regex(err, p, NULL); /* convert value to a boolean */
+ #else /* REGCMP */
+ # ifdef REGCOMP
++ # ifdef REG_EXTENDED
++ val = regexec(&rex, p, 0, NULL, 0) == 0;
++ # else
+ val = !!regexec(err, p);
++ # endif
+ # else
+ val = re_exec(p);
+ # endif
+***************
+*** 549,556 ****
+--- 714,725 ----
+ #else
+ # ifdef REGCOMP
+ if (err)
++ # ifdef REG_EXTENDED
++ regfree(&rex);
++ # else
+ /* XXX: regfree soon */
+ free(err);
++ # endif
+ # endif
+ #endif /* REGCMP */
+
diff --git a/mail/mush/patches/patch-ag b/mail/mush/patches/patch-ag
new file mode 100644
index 00000000000..28413dac55e
--- /dev/null
+++ b/mail/mush/patches/patch-ag
@@ -0,0 +1,83 @@
+$NetBSD: patch-ag,v 1.1 1998/09/04 18:33:48 christos Exp $
+
+*** /dev/null Fri Sep 4 13:38:54 1998
+--- makefile.netbsd Fri Sep 4 13:36:36 1998
+***************
+*** 0 ****
+--- 1,76 ----
++ # makefile.netbsd
++ #
++ 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 makefile.freebsd
++
++ CFLAGS= -O2 -DPOSIX -DCURSES -DBSD -DBSD44 -DSIGRET=void -DBASENAME -DENV_MAIL
++ LDFLAGS=
++ LINTFLAGS= -bxah -Dlint -DCURSES -DBSD
++ LIBS= -lcurses -ltermlib
++ OTHERLIBS=
++ # Use some variant of this one if you #define MMDF in config.h
++ #OTHERLIBS=/usr/src/mmdf/lib/libmmdf.a
++
++ all: mush
++
++ 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= __PREFIX/bin
++ LIBDIR= __PREFIX/share/misc
++ MRCDIR= __PREFIX/share/misc
++ MANDIR= __PREFIX/man/man1
++ MANEXT= 1
++
++ install: mush
++ cp mush $(BINDIR)
++ strip $(BINDIR)/mush
++ chmod 0755 $(BINDIR)/mush
++ cp cmd_help $(LIBDIR)
++ chmod 0644 $(LIBDIR)/cmd_help
++ cp Mushrc $(MRCDIR)/Mushrc
++ chmod 0644 $(MRCDIR)/Mushrc
++ cp mush.1 $(MANDIR)/mush.$(MANEXT)
++ chmod 0644 $(MANDIR)/mush.$(MANEXT)
++
++
++ glob: glob.c
++ $(CC) $(CFLAGS) -DTEST -DTEST2 glob.c $(LIBS) $(OTHERLIBS) -o glob
++
++
diff --git a/mail/mush/patches/patch-ah b/mail/mush/patches/patch-ah
new file mode 100644
index 00000000000..ec93cc332ef
--- /dev/null
+++ b/mail/mush/patches/patch-ah
@@ -0,0 +1,50 @@
+$NetBSD: patch-ah,v 1.1 1998/09/04 18:33:48 christos Exp $
+
+*** old/config.h-dist Fri Sep 4 11:21:28 1998
+--- config.h-dist Fri Sep 4 11:21:28 1998
+***************
+*** 3,15 ****
+ /* Default names and locations for files */
+ #define MAILRC ".mushrc"
+ #define ALTERNATE_RC ".mailrc"
+! #define DEFAULT_RC "/usr/lib/Mushrc"
+! #define ALT_DEF_RC "/usr/lib/Mail.rc"
+ #define SIGNATURE ".signature"
+ #define FORTUNE "/usr/games/fortune"
+! #define COMMAND_HELP "/usr/lib/cmd_help"
+ #ifdef SUNTOOL
+! # define TOOL_HELP "/usr/lib/tool_help"
+ #endif /* SUNTOOL */
+ #define ALTERNATE_HOME "/tmp" /* Path must be read/write to EVERYONE */
+ #define EDFILE ".edXXXXXX" /* file/pathname added to user's "home" */
+--- 3,15 ----
+ /* Default names and locations for files */
+ #define MAILRC ".mushrc"
+ #define ALTERNATE_RC ".mailrc"
+! #define DEFAULT_RC "__PREFIX/etc/Mushrc"
+! #define ALT_DEF_RC "/etc/Mail.rc"
+ #define SIGNATURE ".signature"
+ #define FORTUNE "/usr/games/fortune"
+! #define COMMAND_HELP "__PREFIX/share/misc/cmd_help"
+ #ifdef SUNTOOL
+! # define TOOL_HELP "__PREFIX/share/misc/tool_help"
+ #endif /* SUNTOOL */
+ #define ALTERNATE_HOME "/tmp" /* Path must be read/write to EVERYONE */
+ #define EDFILE ".edXXXXXX" /* file/pathname added to user's "home" */
+***************
+*** 112,118 ****
+ /*
+ * If you are not using MMDF, check these definitions.
+ */
+! #ifdef __FreeBSD__
+ #define MAIL_DELIVERY "/usr/sbin/sendmail -i" /* "-i" works like "-oi" */
+ #else
+ #define MAIL_DELIVERY "/usr/lib/sendmail -i" /* "-i" works like "-oi" */
+--- 113,119 ----
+ /*
+ * If you are not using MMDF, check these definitions.
+ */
+! #ifdef BSD44
+ #define MAIL_DELIVERY "/usr/sbin/sendmail -i" /* "-i" works like "-oi" */
+ #else
+ #define MAIL_DELIVERY "/usr/lib/sendmail -i" /* "-i" works like "-oi" */
diff --git a/mail/mush/pkg/COMMENT b/mail/mush/pkg/COMMENT
new file mode 100644
index 00000000000..f51d70e2b7f
--- /dev/null
+++ b/mail/mush/pkg/COMMENT
@@ -0,0 +1 @@
+text-based mail client
diff --git a/mail/mush/pkg/DESCR b/mail/mush/pkg/DESCR
new file mode 100644
index 00000000000..f2861feffe1
--- /dev/null
+++ b/mail/mush/pkg/DESCR
@@ -0,0 +1,9 @@
+The "Mail User's Shell" (MUSH) is a "Mail User Agent" (MUA) that is
+designed to manage electronic mail on most UNIX systems. That is,
+mush is used by users to read mail, sort it, edit it, delete it,
+or use it to act as an interface to send mail to others. A Mail
+Transport Agent (MTA) is the program which mush communicates with
+that actually -delivers- mail.
+
+Mush is copyright (c) 1986, 1987, 1988, 1989, 1990, 1991 by Dan Heller.
+All Rights Reserved. This software is not in the public domain.
diff --git a/mail/mush/pkg/PLIST b/mail/mush/pkg/PLIST
new file mode 100644
index 00000000000..8f035c775c6
--- /dev/null
+++ b/mail/mush/pkg/PLIST
@@ -0,0 +1,5 @@
+@comment $NetBSD: PLIST,v 1.1 1998/09/04 18:33:49 christos Exp $
+bin/mush
+man/man1/mush.1
+share/misc/Mushrc
+share/misc/cmd_help