[comp.sources.bugs] MH 6.7 Updates - part 08/14

mh@beanie.ICS.UCI.EDU (John Romine) (04/15/90)

These are patches for MH 6.6 to bring it up to the current release MH
6.7.  If you can FTP, you should instead retrieve the current release
(from ics.uci.edu [128.195.1.1] in pub/mh).  See the announcement in
comp.mail.mh for all the details.  A document descibing the changes
from MH 6.6 can also be found in comp.mail.mh.

There are fourteen parts to these patches; you *must* have all the
parts to compile MH.  It will not work if you try to compile an
intermediate version.

Save this message, extract the file below and apply it with "patch -p"
from the top of your MH source tree:

	cd mh-6.6/
	patch -p < MH.6.6.n

If you have modified your source tree, you'll have to merge your local
changes in after you apply these patches to the original sources.

/JLR

: This is a shar archive.  Extract with sh, not csh.
: This archive ends with exit, so do not worry about trailing junk.
echo 'Extracting MH.6.6.7'
sed 's/^X//' > MH.6.6.7 << '+ END-OF-FILE MH.6.6.7'
XPrereq: patch.6
X*** Patchlevel.orig	Thu Apr 12 15:57:35 1990
X--- Patchlevel	Thu Apr 12 15:57:57 1990
X***************
X*** 1 ****
X! MH.6.6 patch.6
X--- 1 ----
X! MH.6.6 patch.7
X*** ../mh-6.6.0/./sbr/uprf.c	Thu Oct 29 15:00:52 1987
X--- ./sbr/uprf.c	Mon Apr  2 15:07:24 1990
X***************
X*** 1,17 ****
X  /* uprf.c - "unsigned" lexical prefix  */
X
X
X  uprf (c1, c2)
X  register char  *c1,
X                 *c2;
X  {
X!     register int    c;
X
X      while (c = *c2++)
X! 	if ((c | 040) != (*c1 | 040))
X  	    return 0;
X  	else
X  	    c1++;
X!
X      return 1;
X  }
X--- 1,26 ----
X  /* uprf.c - "unsigned" lexical prefix  */
X
X+ #define TO_LOWER 040
X+ #define NO_MASK  000
X+ #include <ctype.h>
X
X  uprf (c1, c2)
X  register char  *c1,
X                 *c2;
X  {
X!     register int    c,
X! 		    mask;
X
X+     if (c1 == 0 || c2 == 0)
X+ 	return(0);         /* XXX */
X+
X      while (c = *c2++)
X!     {
X! 	mask = (isalpha(c) && isalpha(*c1)) ?  TO_LOWER : NO_MASK;
X! 	if ((c | mask) != (*c1 | mask))
X  	    return 0;
X  	else
X  	    c1++;
X!     }
X      return 1;
X  }
X*** ../mh-6.6.0/./sbr/m_maildir.c	Thu Oct 29 15:00:38 1987
X--- ./sbr/m_maildir.c	Tue Feb  6 13:08:59 1990
X***************
X*** 13,19 ****
X
X  static char mailfold[BUFSIZ];
X
X! char   *exmaildir ();
X
X
X  char   *m_maildir (folder)
X--- 13,19 ----
X
X  static char mailfold[BUFSIZ];
X
X! static char   *exmaildir ();
X
X
X  char   *m_maildir (folder)
X*** ../mh-6.6.0/./sbr/path.c	Thu Oct 29 15:00:42 1987
X--- ./sbr/path.c	Tue Feb  6 13:09:03 1990
X***************
X*** 13,19 ****
X
X  static char *pwds;
X
X! char   *expath ();
X
X
X  char   *path (name, flag)
X--- 13,20 ----
X
X  static char *pwds;
X
X! static char   *expath ();
X! static	compath();
X
X
X  char   *path (name, flag)
X*** /dev/null	Thu Apr 12 15:37:43 1990
X--- ./sbr/m_seq.c	Fri Feb 23 17:50:01 1990
X***************
X*** 0 ****
X--- 1,53 ----
X+ /* m_seq.c - print out a message sequence */
X+
X+ #include "../h/mh.h"
X+ #include <stdio.h>
X+
X+ /* new version from VJ 2/90 - faster? */
X+
X+ char *
X+ m_seq(mp, cp)
X+ 	struct msgs *mp;
X+ 	char *cp;
X+ {
X+ 	int mask;
X+ 	register int i, j;
X+ 	register char *bp;
X+ 	static char buffer[BUFSIZ*2];	/* for big sequences */
X+
X+ 	if (strcmp(current, cp) == 0) {
X+ 		if (mp->curmsg) {
X+ 			(void) sprintf(buffer, "%s", m_name(mp->curmsg));
X+ 			return (buffer);
X+ 		} else
X+ 			return (NULL);
X+ 	}
X+ 	for (i = 0; mp->msgattrs[i]; i++)
X+ 		if (strcmp(mp->msgattrs[i], cp) == 0)
X+ 			break;
X+
X+ 	if (! mp->msgattrs[i])
X+ 		return (NULL);
X+
X+ 	mask = EXISTS | (1 << (FFATTRSLOT + i));
X+ 	bp = buffer;
X+ 	for (i = mp->lowmsg; i <= mp->hghmsg; ++i) {
X+ 		if ((mp->msgstats[i] & mask) != mask)
X+ 			continue;
X+
X+ 		if (bp > buffer)
X+ 			*bp++ = ' ';
X+
X+ 		(void) sprintf(bp, "%s", m_name(i));
X+ 		bp += strlen(bp);
X+ 		j = i;
X+ 		for (++i; i <= mp->hghmsg && (mp->msgstats[i] & mask) == mask;
X+ 		     ++i)
X+ 			;
X+ 		if (i - j > 1) {
X+ 			(void) sprintf(bp, "-%s", m_name(i - 1));
X+ 			bp += strlen(bp);
X+ 		}
X+ 	}
X+ 	return (bp > buffer? buffer : NULL);
X+ }
X*** ../mh-6.6.0/./sbr/m_seqnew.c	Thu Oct 29 15:00:42 1987
X--- ./sbr/m_seqnew.c	Tue Feb  6 13:09:00 1990
X***************
X*** 4,9 ****
X--- 4,10 ----
X  #include <ctype.h>
X  #include <stdio.h>
X
X+ static int	m_seqok();
X
X  int     m_seqnew (mp, cp, public)
X  register struct msgs *mp;
X*** ../mh-6.6.0/./sbr/m_sync.c	Thu Oct 29 15:00:44 1987
X--- ./sbr/m_sync.c	Mon Feb  5 14:22:46 1990
X***************
X*** 23,32 ****
X      register char  *cp;
X      char    flags,
X  	    attr[BUFSIZ],
X! 	    seq[BUFSIZ];
X      register FILE  *fp;
X  #ifndef	BSD42
X!     int     (*hstat) (), (*istat) (), (*qstat) (), (*tstat) ();
X  #else	BSD42
X      int	    smask;
X  #endif	BSD42
X--- 23,32 ----
X      register char  *cp;
X      char    flags,
X  	    attr[BUFSIZ],
X! 	    seq[BUFSIZ * 2];
X      register FILE  *fp;
X  #ifndef	BSD42
X!     TYPESIG (*hstat) (), (*istat) (), (*qstat) (), (*tstat) ();
X  #else	BSD42
X      int	    smask;
X  #endif	BSD42
X*** ../mh-6.6.0/./sbr/m_update.c	Thu Oct 29 15:00:45 1987
X--- ./sbr/m_update.c	Tue Feb  6 13:09:01 1990
X***************
X*** 7,17 ****
X  #define	sigmask(s)	(1 << ((s) - 1))
X  #endif	not sigmask
X
X
X  void m_update () {
X      int     action;
X  #ifndef	BSD42
X!     int     (*hstat) (), (*istat) (), (*qstat) (), (*tstat) ();
X  #else	BSD42
X      int	    smask;
X  #endif	BSD42
X--- 7,18 ----
X  #define	sigmask(s)	(1 << ((s) - 1))
X  #endif	not sigmask
X
X+ static int	m_chkids();
X
X  void m_update () {
X      int     action;
X  #ifndef	BSD42
X!     TYPESIG (*hstat) (), (*istat) (), (*qstat) (), (*tstat) ();
X  #else	BSD42
X      int	    smask;
X  #endif	BSD42
X*** ../mh-6.6.0/./sbr/makedir.c	Thu Oct 29 15:00:45 1987
X--- ./sbr/makedir.c	Mon Mar 12 10:13:19 1990
X***************
X*** 1,27 ****
X  /* makedir.c - make a directory */
X
X  #include "../h/mh.h"
X  #include <stdio.h>
X
X
X  makedir (dir)
X  register char *dir;
X  {
X      int     pid;
X      register char  *cp;
X
X      m_update ();
X      (void) fflush (stdout);
X
X! #ifdef	BSD42
X      if (getuid () == geteuid ()) {
X! 	if (mkdir (dir, 0755) == NOTOK) {
X! 	    advise (dir, "unable to create directory");
X! 	    return 0;
X! 	}
X      }
X      else
X! #endif	BSD42
X      switch (pid = vfork ()) {
X  	case NOTOK:
X  	    advise ("fork", "unable to");
X--- 1,67 ----
X  /* makedir.c - make a directory */
X
X+ #if defined (BSD42) || defined (hpux)
X+ /* Modified to try recursive create.  Really, this should be broken
X+  * out into a subr so that SYS5 systems can do this too.  I don't
X+  * have a SYS5 machine around to test anymore, so someone else will
X+  * have to send me the code.
X+  */
X+ #endif
X+
X  #include "../h/mh.h"
X  #include <stdio.h>
X
X+ #if defined (BSD42)  || defined (hpux)
X+ #include <errno.h>
X+ #include <sys/param.h>
X+ #include <sys/file.h>
X+ #endif BDS42
X+ #ifdef	SYS5DIR
X+ #include <sys/types.h>
X+ #include <sys/stat.h>
X+ #endif	SYS5DIR
X
X+ extern int  errno;
X+
X  makedir (dir)
X  register char *dir;
X  {
X      int     pid;
X      register char  *cp;
X+ #if defined (BSD42)  || defined (hpux)
X+     register char  *c;
X+     char path[MAXPATHLEN];
X+ #endif BSD42
X
X      m_update ();
X      (void) fflush (stdout);
X
X! #if	defined (BSD42) ||  defined (hpux) || defined (SYS5DIR)
X      if (getuid () == geteuid ()) {
X! 	    c = strcpy(path, dir);
X!
X! 	    while ((c = index((c + 1), '/')) != NULL) {
X! 		    *c = (char)0;
X! 		    if (access(path, X_OK)) {
X! 			    if (errno != ENOENT){
X! 				    advise (dir, "unable to create directory");
X! 				    return 0;
X! 			    }
X! 			    if (mkdir(path, 0775)) {
X! 				    advise (dir, "unable to create directory");
X! 				    return 0;
X! 			    }
X! 		    }
X! 		    *c = '/';
X! 	    }
X!
X! 	    if (mkdir (dir, 0755) == NOTOK) {
X! 		    advise (dir, "unable to create directory");
X! 		    return 0;
X! 	    }
X      }
X      else
X! #endif	BSD42 or hpux or SYS5DIR
X      switch (pid = vfork ()) {
X  	case NOTOK:
X  	    advise ("fork", "unable to");
X*** ../mh-6.6.0/./sbr/pidwait.c	Thu Oct 29 15:00:46 1987
X--- ./sbr/pidwait.c	Mon Feb  5 14:23:26 1990
X***************
X*** 13,19 ****
X  		 sigsok;
X  {
X      register int    pid;
X!     int     (*hstat) (), (*istat) (), (*qstat) (), (*tstat) ();
X  #ifndef	BSD42
X      int     status;
X  #else	BSD42
X--- 13,19 ----
X  		 sigsok;
X  {
X      register int    pid;
X!     TYPESIG (*hstat) (), (*istat) (), (*qstat) (), (*tstat) ();
X  #ifndef	BSD42
X      int     status;
X  #else	BSD42
X*** ../mh-6.6.0/./sbr/putenv.c	Thu Oct 29 15:00:47 1987
X--- ./sbr/putenv.c	Tue Feb  6 13:08:42 1990
X***************
X*** 6,11 ****
X--- 6,12 ----
X
X  extern  char **environ;
X
X+ static nvmatch();
X
X  int     putenv (name, value)
X  register char  *name,
X*** ../mh-6.6.0/./sbr/remdir.c	Thu Oct 29 15:00:49 1987
X--- ./sbr/remdir.c	Mon Feb  5 14:39:43 1990
X***************
X*** 7,20 ****
X  remdir (dir)
X  char *dir;
X  {
X! #ifndef	BSD42
X      int     pid;
X! #endif	not BSD42
X
X      m_update ();
X      (void) fflush (stdout);
X
X! #ifndef	BSD42
X      switch (pid = vfork ()) {
X  	case NOTOK:
X  	    advise ("fork", "unable to");
X--- 7,20 ----
X  remdir (dir)
X  char *dir;
X  {
X! #if	!defined (BSD42) && !defined (SYS5DIR)
X      int     pid;
X! #endif	not BSD42 and not SYS5DIR
X
X      m_update ();
X      (void) fflush (stdout);
X
X! #if	!defined (BSD42) && !defined (SYS5DIR)
X      switch (pid = vfork ()) {
X  	case NOTOK:
X  	    advise ("fork", "unable to");
X***************
X*** 32,43 ****
X  		return 0;
X  	    break;
X      }
X! #else	BSD42
X      if (rmdir (dir) == NOTOK) {
X  	admonish (dir, "unable to remove directory");
X  	return 0;
X      }
X! #endif	BSD42
X
X      return 1;
X  }
X--- 32,43 ----
X  		return 0;
X  	    break;
X      }
X! #else	BSD42 or SYS5DIR
X      if (rmdir (dir) == NOTOK) {
X  	admonish (dir, "unable to remove directory");
X  	return 0;
X      }
X! #endif	BSD42 or SYS5DIR
X
X      return 1;
X  }
X*** ../mh-6.6.0/./sbr/fmtcompile.c	Thu Oct 29 15:00:29 1987
X--- ./sbr/fmtcompile.c	Fri Mar 23 14:38:47 1990
X***************
X*** 60,65 ****
X--- 60,66 ----
X
X      "comp",	TF_COMP,	FT_LS_COMP,	0,		TFL_PUTS,
X      "lit",	TF_STR,		FT_LS_LIT,	0,		TFL_PUTS,
X+     "trim",	TF_EXPR,	FT_LS_TRIM,	0,		0,
X      "compval",	TF_COMP,	FT_LV_COMP,	0,		TFL_PUTN,
X      "compflag",	TF_COMP,	FT_LV_COMPFLAG,	0,		TFL_PUTN,
X      "num",	TF_NUM,		FT_LV_LIT,	0,		TFL_PUTN,
X***************
X*** 72,77 ****
X--- 73,79 ----
X      "me",	TF_MYBOX,	FT_LS_LIT,	0,		TFL_PUTS,
X      "plus",	TF_NUM,		FT_LV_PLUS_L,	0,		TFL_PUTN,
X      "minus",	TF_NUM,		FT_LV_MINUS_L,	0,		TFL_PUTN,
X+     "divide",	TF_NUM,		FT_LV_DIVIDE_L,	0,		TFL_PUTN,
X      "charleft",	TF_NONE,	FT_LV_CHAR_LEFT, 0,		TFL_PUTN,
X      "timenow",	TF_NOW,		FT_LV_LIT,	0,		TFL_PUTN,
X
X***************
X*** 93,101 ****
X      "clock",	TF_COMP,	FT_LV_CLOCK,	FT_PARSEDATE,	TFL_PUTN,
X      "rclock",	TF_COMP,	FT_LV_RCLOCK,	FT_PARSEDATE,	TFL_PUTN,
X      "sday",	TF_COMP,	FT_LV_DAYF,	FT_PARSEDATE,	TFL_PUTN,
X!     "dst",	TF_COMP,	FT_LV_TZONEF,	FT_PARSEDATE,	TFL_PUTN,
X      "pretty",	TF_COMP,	FT_LS_PRETTY,	FT_PARSEDATE,	TFL_PUTS,
X      "nodate",	TF_COMP,	FT_LV_COMPFLAG,	FT_PARSEDATE,	TFL_PUTN,
X
X      "pers",	TF_COMP,	FT_LS_PERS,	FT_PARSEADDR,	TFL_PUTS,
X      "mbox",	TF_COMP,	FT_LS_MBOX,	FT_PARSEADDR,	TFL_PUTS,
X--- 95,106 ----
X      "clock",	TF_COMP,	FT_LV_CLOCK,	FT_PARSEDATE,	TFL_PUTN,
X      "rclock",	TF_COMP,	FT_LV_RCLOCK,	FT_PARSEDATE,	TFL_PUTN,
X      "sday",	TF_COMP,	FT_LV_DAYF,	FT_PARSEDATE,	TFL_PUTN,
X!     "szone",	TF_COMP,	FT_LV_ZONEF,	FT_PARSEDATE,	TFL_PUTN,
X!     "dst",	TF_COMP,	FT_LV_DST,	FT_PARSEDATE,	TFL_PUTN,
X      "pretty",	TF_COMP,	FT_LS_PRETTY,	FT_PARSEDATE,	TFL_PUTS,
X      "nodate",	TF_COMP,	FT_LV_COMPFLAG,	FT_PARSEDATE,	TFL_PUTN,
X+     "date2local", TF_COMP,	FT_LOCALDATE,	FT_PARSEDATE,	0,
X+     "date2gmt",	TF_COMP,	FT_GMTDATE,	FT_PARSEDATE,	0,
X
X      "pers",	TF_COMP,	FT_LS_PERS,	FT_PARSEADDR,	TFL_PUTS,
X      "mbox",	TF_COMP,	FT_LS_MBOX,	FT_PARSEADDR,	TFL_PUTS,
X***************
X*** 111,116 ****
X--- 116,124 ----
X      "friendly",	TF_COMP,	FT_LS_FRIENDLY,	FT_PARSEADDR,	TFL_PUTS,
X
X      "mymbox",	TF_COMP,	FT_LV_COMPFLAG,	FT_MYMBOX,	TFL_PUTN,
X+ #ifdef	VAN
X+     "addtoseq", TF_STR,		FT_ADDTOSEQ,	0,		0,
X+ #endif
X
X      (char *)0,	0,		0,		0,		0
X  };
X***************
X*** 169,175 ****
X
X  #define CERROR(str) compile_error (str, cp)
X
X! static compile_error (str, cp)
X      char *str;
X      char *cp;
X  {
X--- 177,184 ----
X
X  #define CERROR(str) compile_error (str, cp)
X
X! static void
X! compile_error(str, cp)
X      char *str;
X      char *cp;
X  {
X***************
X*** 293,301 ****
X
X      c = *cp++;
X      if (c == '-') {
X! #ifndef	lint
X! 	ljust++;		/* should do something with this */
X! #endif	not lint
X  	c = *cp++;
X      }
X      if (c == '0') {
X--- 302,308 ----
X
X      c = *cp++;
X      if (c == '-') {
X! 	ljust++;
X  	c = *cp++;
X      }
X      if (c == '0') {
X***************
X*** 325,330 ****
X--- 332,339 ----
X      else {
X  	CERROR("component or function name expected");
X      }
X+     if (ljust)
X+ 	wid = -wid;
X      fp->f_width = wid;
X      fp->f_fill = fill;
X
X*** ../mh-6.6.0/./support/pop/mmdfII/pop/lock.c	Thu Oct 29 15:01:44 1987
X--- ./support/pop/mmdfII/pop/lock.c	Thu Apr  5 16:02:39 1990
X***************
X*** 1,4 ****
X--- 1,7 ----
X  /* lock.c - universal locking routines */
X+ #ifndef	lint
X+ static char ident[] = "@(#)$Id: lock.c,v 1.4 90/04/05 15:34:26 sources Exp $";
X+ #endif	lint
X
X  #ifdef	MMDFONLY
X  #define	LOCKONLY
X***************
X*** 176,181 ****
X--- 179,187 ----
X  #ifdef	BSD42
X
X  #include <sys/file.h>
X+ #ifdef	SUN40
X+ #include <sys/fcntl.h>
X+ #endif	SUN40
X
X  static int  f_lkopen (file, access)
X  register char   *file;
X*** ../mh-6.6.0/./support/pop/popd.c	Thu Oct 29 15:01:57 1987
X--- ./support/pop/popd.c	Mon Apr  9 09:45:16 1990
X***************
X*** 1,4 ****
X--- 1,7 ----
X  /* popd.c - the POP server */
X+ #ifndef	lint
X+ static char ident[] = "@(#)$Id: popd.c,v 1.8 90/04/09 09:45:09 sources Exp Locker: sources $";
X+ #endif	lint
X
X  /* Author:	Marshall T. Rose	<MRose@UDel>	(MTR)
X  		Department of Computer Science and Information Sciences
X***************
X*** 12,31 ****
X  #include <errno.h>
X  #include <signal.h>
X  #include <stdio.h>
X! #include <strings.h>
X! #include <syslog.h>
X  #include <sys/types.h>
X  #include <sys/file.h>
X  #include <sys/ioctl.h>
X  #include <sys/socket.h>
X  #include <sys/time.h>
X  #include <sys/resource.h>
X  #include <sys/wait.h>
X  #include <netinet/in.h>
X  #include <netdb.h>
X  #include <arpa/inet.h>
X
X
X  #define	NOTOK	(-1)
X  #define	OK	0
X
X--- 15,45 ----
X  #include <errno.h>
X  #include <signal.h>
X  #include <stdio.h>
X! #include "../h/strings.h"
X! #include "syslog.h"
X  #include <sys/types.h>
X  #include <sys/file.h>
X+ #ifndef	NOIOCTLH
X  #include <sys/ioctl.h>
X+ #endif	NOIOCTLH
X  #include <sys/socket.h>
X  #include <sys/time.h>
X+ #ifdef	SIGTSTP
X  #include <sys/resource.h>
X  #include <sys/wait.h>
X+ #endif	SIGTSTP
X  #include <netinet/in.h>
X  #include <netdb.h>
X  #include <arpa/inet.h>
X+ #ifdef	SYS5
X+ #include <fcntl.h>
X+ #endif	SYS5
X
X
X+ #ifdef	SYS5
X+ #define	u_short	ushort
X+ #endif	SYS5
X+
X  #define	NOTOK	(-1)
X  #define	OK	0
X
X***************
X*** 46,64 ****
X  static int  nbits = ((sizeof (int)) * 8);
X  static int  options = 0;
X
X
X  char *myname = "popd";
X  char myhost[BUFSIZ];
X  static char *myprotocol = "tcp";
X! static char *myservice = "pop";
X
X  static struct sockaddr_in   in_socket;
X  static struct sockaddr_in  *isock = &in_socket;
X
X
X! int	chldser ();
X  void	padios (), padvise ();
X
X  /*  */
X
X  /* ARGSUSED */
X--- 60,82 ----
X  static int  nbits = ((sizeof (int)) * 8);
X  static int  options = 0;
X
X+ #ifndef	POPSERVICE
X+ #define	POPSERVICE	"pop"
X+ #endif
X
X  char *myname = "popd";
X  char myhost[BUFSIZ];
X  static char *myprotocol = "tcp";
X! static char *myservice = POPSERVICE;
X
X  static struct sockaddr_in   in_socket;
X  static struct sockaddr_in  *isock = &in_socket;
X
X
X! static int	chldser ();
X  void	padios (), padvise ();
X
X+ static	server(), arginit(), envinit();
X  /*  */
X
X  /* ARGSUSED */
X***************
X*** 145,151 ****
X--- 163,171 ----
X      if (bind (sd, (struct sockaddr *) isock, sizeof *isock) == NOTOK)
X  	padios ("socket", "unable to bind");
X
X+ #ifdef	SIGCHLD
X      (void) signal (SIGCHLD, chldser);
X+ #endif	SIGCHLD
X      (void) listen (sd, SOMAXCONN);
X  #ifdef	FAST
X      popinit ();
X***************
X*** 165,171 ****
X--- 185,193 ----
X  	switch (fork ()) {
X  	    case OK:
X  		(void) close (sd);
X+ #ifdef	SIGCHLD
X  		(void) signal (SIGCHLD, SIG_DFL);
X+ #endif	SIGCHLD
X  		server (fd, osock);
X  		_exit (0);
X
X***************
X*** 282,288 ****
X--- 304,312 ----
X  	(void) dup2 (0, 2);
X
X  	if ((sd = open ("/dev/tty", O_RDWR)) != NOTOK) {
X+ #ifdef	TIOCNOTTY
X  	    (void) ioctl (sd, TIOCNOTTY, NULLCP);
X+ #endif	TIOCNOTTY
X  	    (void) close (sd);
X  	}
X      }
X***************
X*** 307,312 ****
X--- 331,338 ----
X
X  /* ARGSUSED */
X
X+ #ifdef	SIGCHLD
X+
X  static int chldser (sig, code, sc)
X  int	sig;
X  long    code;
X***************
X*** 317,322 ****
X--- 343,350 ----
X      while (wait3 (&status, WNOHANG, NULLRP) > 0)
X  	continue;
X  }
X+
X+ #endif	SIGCHLD
X
X  /*  */
X
X*** ../mh-6.6.0/./support/pop/popser.c	Thu Oct 29 15:01:59 1987
X--- ./support/pop/popser.c	Mon Apr  9 09:45:20 1990
X***************
X*** 1,4 ****
X--- 1,7 ----
X  /* popser.c - the POP service */
X+ #ifndef	lint
X+ static char ident[]="@(#)$Id: popser.c,v 1.13 90/04/09 09:45:18 sources Exp Locker: sources $";
X+ #endif
X
X  #include "../h/mh.h"
X  #include "../h/dropsbr.h"
X***************
X*** 9,17 ****
X  #include <errno.h>
X  #include <pwd.h>
X  #include <signal.h>
X! #include <syslog.h>
X  #include <sys/types.h>
X  #include <sys/stat.h>
X
X
X  #define	TRUE	1
X--- 12,26 ----
X  #include <errno.h>
X  #include <pwd.h>
X  #include <signal.h>
X! #include "syslog.h"
X  #include <sys/types.h>
X  #include <sys/stat.h>
X+ #ifdef	SYS5
X+ #include <fcntl.h>
X+ #endif	SYS5
X+ #ifdef	SHADOW
X+ #include <shadow.h>
X+ #endif	SHADOW
X
X
X  #define	TRUE	1
X***************
X*** 19,24 ****
X--- 28,37 ----
X
X  #define	NVEC	4
X
X+ #ifndef	POPSERVICE
X+ #define	POPSERVICE	"pop"
X+ #endif
X+
X  /*  */
X
X  extern int  errno;
X***************
X*** 32,47 ****
X  } mystate;
X
X
X! int     user (), pass ();
X  #ifdef	RPOP
X! int	rpop ();
X  #endif	RPOP
X! int     status (), list (), retrieve (), delete (), reset ();
X! int	top (), last ();
X  #ifdef	BPOP
X  int	xtnd ();
X  #endif	BPOP
X! int     quit ();
X
X  static struct vector {
X      char   *v_cmd;
X--- 45,64 ----
X  } mystate;
X
X
X! static int     user (), pass ();
X! #ifdef	BPOP
X! static		isguest(), getbbmax();
X! static	int	xtnd1(), xtnd2();
X! #endif	BPOP
X  #ifdef	RPOP
X! static int	rpop ();
X  #endif	RPOP
X! static int     status (), list (), retrieve (), delete (), reset ();
X! static int	top (), last ();
X  #ifdef	BPOP
X  int	xtnd ();
X  #endif	BPOP
X! static int     quit ();
X
X  static struct vector {
X      char   *v_cmd;
X***************
X*** 76,82 ****
X      NULL
X  };
X
X! struct vector  *getvector ();
X
X  /*  */
X
X--- 93,99 ----
X      NULL
X  };
X
X! static struct vector  *getvector ();
X
X  /*  */
X
X***************
X*** 139,145 ****
X  #define	TRMLEN	(sizeof TRM - 1)
X  #define	IAC	255
X
X! int    pipeser ();
X
X  FILE   *input;
X  FILE   *output;
X--- 156,162 ----
X  #define	TRMLEN	(sizeof TRM - 1)
X  #define	IAC	255
X
X! static int    pipeser ();
X
X  FILE   *input;
X  FILE   *output;
X***************
X*** 149,154 ****
X--- 166,178 ----
X  long	lseek ();
X  char   *crypt ();
X
X+ static	int	pmbx_read ();
X+ static	char   *p_copy(), *p_copyin(), *p_nextword();
X+ static		p_cmatch(), p_isdate(), p_ishead(), p_parse(), any();
X+
X+ static int	setup(), setupaux(), read_map(), read_file(), pmbx_size();
X+ static int	quitaux(), quitfile(), respond(), getline();
X+ static	m_gMsgs(), multiline(), multiend(), putline();
X  /*  */
X
X  popinit () {
X***************
X*** 304,309 ****
X--- 328,336 ----
X      int	guest = 0;
X  #ifndef	DPOP
X      register struct passwd *pw;
X+ #ifdef	SHADOW
X+     register struct spwd *shpw;
X+ #endif	SHADOW
X  #else	DPOP
X      register struct bboard *pw;
X  #endif	DPOP
X***************
X*** 323,333 ****
X      }
X  #endif	BPOP
X      if ((pw = getpwnam (username)) == NULL
X  	    || *pw -> pw_passwd == NULL
X  	    || strcmp (crypt (vec[1], pw -> pw_passwd), pw -> pw_passwd)) {
X  #ifdef	TRUSTED
X  	trusted (0, hostname, NULLCP, 0, pw ? pw -> pw_name : username,
X! 	    pw && pw -> pw_uid == 0, "pop", "tcp", NULL);
X  #endif	TRUSTED
X  	return respond (NOTOK, "login incorrect");
X      }
X--- 350,366 ----
X      }
X  #endif	BPOP
X      if ((pw = getpwnam (username)) == NULL
X+ #ifndef	SHADOW
X  	    || *pw -> pw_passwd == NULL
X  	    || strcmp (crypt (vec[1], pw -> pw_passwd), pw -> pw_passwd)) {
X+ #else	SHADOW
X+ 	    || (shpw = getspnam (username)) == NULL
X+ 	    || *shpw -> sp_pwdp == NULL
X+ 	    || strcmp (crypt (vec[1], shpw -> sp_pwdp), shpw -> sp_pwdp)) {
X+ #endif	SHADOW
X  #ifdef	TRUSTED
X  	trusted (0, hostname, NULLCP, 0, pw ? pw -> pw_name : username,
X! 	    pw && pw -> pw_uid == 0, POPSERVICE, "tcp", NULL);
X  #endif	TRUSTED
X  	return respond (NOTOK, "login incorrect");
X      }
X***************
X*** 348,354 ****
X  	    || strcmp (crypt (vec[1], pw -> bb_passwd), pw -> bb_passwd)) {
X  #ifdef	TRUSTED
X  	trusted (0, hostname, NULLCP, 0, pw ? pw -> bb_name : username,
X! 	    0, "pop", "tcp", NULL);
X  #endif	TRUSTED
X  	return respond (NOTOK, "login incorrect");
X      }
X--- 381,387 ----
X  	    || strcmp (crypt (vec[1], pw -> bb_passwd), pw -> bb_passwd)) {
X  #ifdef	TRUSTED
X  	trusted (0, hostname, NULLCP, 0, pw ? pw -> bb_name : username,
X! 	    0, POPSERVICE, "tcp", NULL);
X  #endif	TRUSTED
X  	return respond (NOTOK, "login incorrect");
X      }
X***************
X*** 364,370 ****
X  #else	DPOP
X  		pw -> bb_name, 0,
X  #endif	DPOP
X! 		"pop", "tcp", NULL)
X  	    == 0)
X  	return respond (NOTOK, "permission denied");
X  #endif	TRUSTED
X--- 397,403 ----
X  #else	DPOP
X  		pw -> bb_name, 0,
X  #endif	DPOP
X! 		POPSERVICE, "tcp", NULL)
X  	    == 0)
X  	return respond (NOTOK, "permission denied");
X  #endif	TRUSTED
X***************
X*** 497,503 ****
X--- 530,538 ----
X  #ifdef	BPOP
X      if (guest) {
X  	(void) setgid (guest_gid);
X+ #ifndef	SYS5
X  	(void) initgroups (popbbuser, guest_gid);
X+ #endif	SYS5
X  	(void) setuid (guest_uid);
X      }
X      else {
X***************
X*** 504,514 ****
X--- 539,553 ----
X  #endif	BPOP
X  #ifndef	DPOP
X  	(void) setgid (pw -> pw_gid);
X+ #ifndef	SYS5
X  	(void) initgroups (pw -> pw_name, pw -> pw_gid);
X+ #endif	SYS5
X  	(void) setuid (pw -> pw_uid);
X  #else	DPOP
X  	(void) setgid (pop_gid);
X+ #ifndef	SYS5
X  	(void) initgroups (POPUID, pop_gid);
X+ #endif	SYS5
X  	(void) setuid (pop_uid);
X  #endif	DPOP
X  #ifdef	BPOP
X***************
X*** 578,584 ****
X      Msgs[0].m_size = 0;
X      for (i = 1; i <= nmsgs; i++) {
X  	if (Msgs[i].m_size == 0)
X! 	    Msgs[i].m_size = mbx_size (i);
X  	Msgs[0].m_size += Msgs[i].m_size;
X  	Msgs[i].m_flags = MNULL;
X      }
X--- 617,623 ----
X      Msgs[0].m_size = 0;
X      for (i = 1; i <= nmsgs; i++) {
X  	if (Msgs[i].m_size == 0)
X! 	    Msgs[i].m_size = pmbx_size (i);
X  	Msgs[0].m_size += Msgs[i].m_size;
X  	Msgs[i].m_flags = MNULL;
X      }
X***************
X*** 643,649 ****
X  	padvise (NULLCP, LOG_DEBUG, "read_file (%ld, %d)",
X  		pos, msgp);
X
X!     if ((i = mbx_read (dp, pos, &rp, debug)) <= 0)
X  	return (msgp - 1);
X
X      m_gMsgs ((msgp - 1) + i);
X--- 682,688 ----
X  	padvise (NULLCP, LOG_DEBUG, "read_file (%ld, %d)",
X  		pos, msgp);
X
X!     if ((i = pmbx_read (dp, pos, &rp, debug)) <= 0)
X  	return (msgp - 1);
X
X      m_gMsgs ((msgp - 1) + i);
X***************
X*** 689,695 ****
X
X  /*  */
X
X! static int  mbx_size (m)
X  register int     m;
X  {
X      register int    i;
X--- 728,734 ----
X
X  /*  */
X
X! static int  pmbx_size (m)
X  register int     m;
X  {
X      register int    i;
X***************
X*** 1156,1162 ****
X--- 1195,1206 ----
X      mode = (int) (st.st_mode & 0777);
X
X      if (nmsgs == dmsgs) {
X+ #ifndef	SYS5
X  	i = truncate (maildrop, 0);
X+ #else	SYS5
X+ 	i = open (maildrop, O_WRONLY | O_TRUNC);
X+ 	if (i != NOTOK) (void) close (i);
X+ #endif	SYS5
X  	(void) unlink (map_name (maildrop));/* XXX */
X  	if (i == NOTOK)
X  	    return respond (NOTOK, "unable to zero %s", maildrop);
X***************
X*** 1165,1171 ****
X
X      (void) strcpy (tmpfil, m_backup (maildrop));
X      if ((md = mbx_open (tmpfil, st.st_uid, st.st_gid, mode)) == NOTOK)
X! 	return respond (NOTOK, "unable to create temporary file");
X
X      j = 0, tmpDR = Msgs[0].m_last;
X  if(debug)padvise(NULLCP,LOG_DEBUG,"XXX: last=%d",Msgs[0].m_last);
X--- 1209,1218 ----
X
X      (void) strcpy (tmpfil, m_backup (maildrop));
X      if ((md = mbx_open (tmpfil, st.st_uid, st.st_gid, mode)) == NOTOK)
X! 	  { char msgbuf0[256];
X! 	    sprintf(msgbuf0,"unable to create temporary file (%s)",tmpfil);
X! 	    return respond (NOTOK, msgbuf0);
X!           }
X
X      j = 0, tmpDR = Msgs[0].m_last;
X  if(debug)padvise(NULLCP,LOG_DEBUG,"XXX: last=%d",Msgs[0].m_last);
X***************
X*** 1290,1296 ****
X      char    buffer[BUFSIZ + TRMLEN];
X
X      (void) strcpy (buffer, TRM);
X!     cp = sprintf (buffer + TRMLEN, fmt, a, b, c, d);
X      if (strncmp (cp, TRM, TRMLEN) == 0)
X  	cp = buffer;
X
X--- 1337,1343 ----
X      char    buffer[BUFSIZ + TRMLEN];
X
X      (void) strcpy (buffer, TRM);
X!     (void) sprintf (cp = (buffer + TRMLEN), fmt, a, b, c, d);
X      if (strncmp (cp, TRM, TRMLEN) == 0)
X  	cp = buffer;
X
X***************
X*** 1355,1358 ****
X--- 1402,1865 ----
X      padvise (NULLCP, LOG_WARNING, "lost connection");
X
X      _exit (NOTOK);
X+ }
X+
X+ /*  */
X+
X+ /* Some people don't want to use the POP delivery agent with Sendmail
X+  * if they're going to run POP.  Sendmail writes maildrops in the old
X+  * UUCP format, and popd doesn't know how to read them.  These people
X+  * really should do what the MH manual says -- run the pop delivery
X+  * agent and be done with it.  Some things never die.
X+  *
X+  * A real fix would be to make uip/dropsbr.c should use the same methods
X+  * as sbr/m_getfld.c to determine the format of maildrops and read &
X+  * write them.  Unfortunately, it'll take a lot of work to bring it into
X+  * the fold.  20Mar90/JLR
X+  *
X+  * I really really hate to add this, but this lets stuff popd read
X+  * UUCP style maildrops as well as MMDF (ctrl/A) style maildrops.  It was
X+  * contributed by Steve Dempsey <steved@longs.LANCE.ColoState.Edu>.
X+  *
X+  * Here's what he says:
X+  *
X+  * Ideally, one should be able to do it with the mmdelim strings, but
X+  * the MH parser is not intelligent enough to do this.  You have at
X+  * least a couple of choices:
X+  *
X+  *   - use aliases to deliver mail to POP users (user: user@pop) and
X+  *     install the POP delivery agent - should work well with sendmail.
X+  *   - fix the POP server!
X+  *
X+  * We have all mail sent to one machine and users are given two options:
X+  *
X+  *   - MH on any machine.
X+  *   - any user agent on the postoffice machine.
X+  *
X+  * Most of our workstations run xmh and users find that to be sufficient.
X+  * New users are only taught to use MH, and a very few old timers stay
X+  * with BSD mail.  In any case, several agents are available at the cost
X+  * of a telnet/rlogin if a user does not like MH.
X+  *
X+  * I have made the changes to the POP server (MH-6.6/support/pop/popser.c)
X+  * to look for the `\n\nFrom ' delimiter instead of the ^A's, using some
X+  * code from the BSD agent.  Context diff is included below.  When this
X+  * is installed, you just go back to the normal localmail and get rid of
X+  * slocal completely.
X+  *
X+  * I have not tried this modification with anything but the MH client,
X+  * but it should work.  Nothing in the POP protocol changes; the server
X+  * just has different criteria for delimiting messages in the mailbox.
X+  * If you decide to use this, I'd like to know what happens.
X+  *
X+  *         Steve Dempsey,  Center for Computer Assisted Engineering
X+  *   Colorado State University, Fort Collins, CO  80523    +1 303 491 0630
X+  * INET: steved@longs.LANCE.ColoState.Edu, dempsey@handel.CS.ColoState.Edu
X+  * boulder!ccncsu!longs.LANCE.ColoState.Edu!steved, ...!ncar!handel!dempsey
X+  */
X+
X+ /*  */
X+ /* from dropsbr.c - read from a mailbox - pop server version */
X+
X+ /* ALMOST IDENTICAL to mbx_read */
X+
X+ static	int	pmbx_read (fp, pos, drops, noisy)
X+ register FILE  *fp;
X+ register long	pos;
X+ struct drop **drops;
X+ int	noisy;
X+ {
X+     register int    len,
X+                     size;
X+     long    ld1,
X+             ld2;
X+     register char  *bp;
X+     char    buffer[BUFSIZ];
X+     register struct drop   *cp,
X+                            *dp,
X+                            *ep,
X+                            *pp;
X+
X+     /* get drop storage */
X+     pp = (struct drop  *) calloc ((unsigned) (len = MAXFOLDER), sizeof *dp);
X+
X+     if (debug)
X+ 	padvise (NULLCP, LOG_DEBUG, "pmbx_read (%d, %ld, %d, %d)",
X+ 		fp, pos,drops,noisy);
X+
X+     if (pp == NULL) {
X+ 	if (noisy)
X+ 	    admonish (NULLCP, "unable to allocate drop storage");
X+ 	return NOTOK;
X+     }
X+
X+     /* get sizes of msg delimiters */
X+     ld1 = (long) strlen (mmdlm1);
X+     ld2 = (long) strlen (mmdlm2);
X+
X+     /* rewind drop file */
X+     (void) fseek (fp, pos, 0);
X+
X+     if (debug)
X+ 	padvise (NULLCP, LOG_DEBUG, "rewind maildrop");
X+
X+     /* read a buffer */
X+     for (ep = (dp = pp) + len - 1; fgets (buffer, sizeof buffer, fp);) {
X+ 	size = 0;
X+
X+ 	/* if beginning of msg then mark it */
X+
X+ 	if (p_ishead(buffer)) /*(strcmp (buffer, mmdlm1) == 0)*/ {
X+ 	    /* (don't) inc pos to msg start, mark it */
X+ 	    /*pos += ld1;*/
X+ 	    dp -> d_start = pos;
X+ 	    pos += strlen(buffer);  /* inc pos after marking head */
X+ 	}
X+ 	else {
X+ 	    /* didn't find it; mark it anyway */
X+ 	    dp -> d_start = pos, pos += (long) strlen (buffer);
X+
X+ 	    /* count newlines and inc size if any found */
X+ 	    for (bp = buffer; *bp; bp++, size++)
X+ 		if (*bp == '\n')
X+ 		    size++;
X+ 	}
X+
X+ 	/* read more lines... */
X+ 	while (fgets (buffer, sizeof buffer, fp) != NULL)
X+
X+ 	    /* found end? */
X+ 	    if (p_ishead(buffer)) /*(strcmp (buffer, mmdlm2) == 0)*/ {
X+
X+ 		/* out of loop */
X+ 	        (void) fseek (fp, pos, 0);
X+ 		break;
X+
X+             }
X+ 	    else {
X+ 		/* add buffer size to pos */
X+ 		pos += (long) strlen (buffer);
X+
X+ 		/* count newlines.... */
X+ 		for (bp = buffer; *bp; bp++, size++)
X+ 		    if (*bp == '\n')
X+ 			size++;
X+ 	    }
X+
X+ 	if (dp -> d_start != pos) {
X+ 	    /* do this if pos was actually incremented; got some text */
X+ 	    dp -> d_id = 0;
X+ 	    dp -> d_size = size;  /* save the stuff we got */
X+ 	    dp -> d_stop = pos;
X+ 	    dp++;
X+ 	}
X+
X+ 	/* (don't) advance pos */
X+ 	/* pos += ld2; */
X+
X+ 	/* need more storage.... */
X+ 	if (dp >= ep) {
X+ 	    register int    curlen = dp - pp;
X+
X+ 	    cp = (struct drop  *) realloc ((char *) pp,
X+ 		                    (unsigned) (len += MAXFOLDER) * sizeof *pp);
X+ 	    if (cp == NULL) {
X+ 		if (noisy)
X+ 		    admonish (NULLCP, "unable to allocate drop storage");
X+ 		free ((char *) pp);
X+ 		return 0;
X+ 	    }
X+ 	    dp = cp + curlen, ep = (pp = cp) + len - 1;
X+ 	}
X+     }
X+
X+     /* return unused stuff */
X+     if (dp == pp)
X+ 	free ((char *) pp);
X+     else
X+ 	*drops = pp;
X+     return (dp - pp);
X+ }
X+
X+ /*
X+  * The remainder of this file adapted from:
X+  *
X+  *	head.c	5.2 (Berkeley) 6/21/85
X+  */
X+
X+ struct p_hdline {
X+ 	char	*l_from;	/* The name of the sender */
X+ 	char	*l_tty;		/* His tty string (if any) */
X+ 	char	*l_date;	/* The entire date string */
X+ };
X+
X+ /*
X+  *
X+  * See if position in a file is a mail header.
X+  * Return true if yes.  Note the extreme pains to
X+  * accomodate all funny formats.
X+  */
X+
X+ #define	NOSTR		((char *) 0)	/* Null string pointer */
X+ static	char *p_copyin();
X+ static	char *p_copy();
X+
X+
X+ static	p_ishead(buffer)
X+ char buffer[];
X+ {
X+ register char *cp;
X+ struct p_hdline hl;
X+ char linebuf[BUFSIZ];
X+ char parbuf[BUFSIZ];
X+
X+ 	strcpy(linebuf,buffer);
X+ 	cp = linebuf;
X+
X+ 	if (linebuf[0]=='F')
X+ 		  padvise (NULLCP, LOG_DEBUG, "ishead: '%s'",linebuf);
X+
X+ 	if (strncmp("From ", cp, 5) != 0)
X+ 		return(0);
X+
X+ 	padvise (NULLCP, LOG_DEBUG, "Fromline...");
X+
X+ 	/* get full header */
X+ 	p_parse(cp, &hl, parbuf);
X+
X+ 	if (hl.l_from == NOSTR || hl.l_date ==  NOSTR) {
X+ 		  padvise (NULLCP, LOG_DEBUG, "Fromline...NODATE");
X+ 		return(0);
X+ 		}
X+
X+ 	if (!p_isdate(hl.l_date)) {
X+ 		  padvise (NULLCP, LOG_DEBUG, "Fromline...BADDATE %s",
X+ 			hl.l_date);
X+ 		return(0);
X+ 		}
X+
X+ 	/* I guess we got it! */
X+ 	padvise (NULLCP, LOG_DEBUG, "got a head.. ");
X+
X+ 	return(1);
X+ }
X+
X+ /*
X+  * Split a headline into its useful components.
X+  * Copy the line into dynamic string space, then set
X+  * pointers into the copied line in the passed headline
X+  * structure.  Actually, it scans.
X+  */
X+
X+ static	p_parse(line, hl, pbuf)
X+ 	char line[], pbuf[];
X+ 	struct p_hdline *hl;
X+ {
X+ 	register char *cp, *dp;
X+ 	char *sp;
X+ 	char word[BUFSIZ];
X+ 	char * p_nextword();
X+
X+ 	hl->l_from = NOSTR;
X+ 	hl->l_tty = NOSTR;
X+ 	hl->l_date = NOSTR;
X+ 	cp = line;
X+ 	sp = pbuf;
X+
X+ 	/*
X+ 	 * Skip the first "word" of the line, which should be "From"
X+ 	 * anyway.
X+ 	 */
X+ 	cp = p_nextword(cp, word);
X+ 	dp = p_nextword(cp, word);
X+ 	if (!(strcmp(word, "")==0))
X+ 		hl->l_from = p_copyin(word, &sp);
X+
X+ 	/* UNLIKELY */
X+ 	if (strncmp(dp, "tty", 3) == 0) {
X+ 		cp = p_nextword(dp, word);
X+ 		hl->l_tty = p_copyin(word, &sp);
X+ 		if (cp != NOSTR)
X+ 			hl->l_date = p_copyin(cp, &sp);
X+ 	}
X+
X+ 	/* USUAL */
X+ 	else
X+ 		if (dp != NOSTR)
X+ 			hl->l_date = p_copyin(dp, &sp);
X+ }
X+
X+ /*
X+  * Copy the string on the left into the string on the right
X+  * and bump the right (reference) string pointer by the length.
X+  * Thus, dynamically allocate space in the right string, copying
X+  * the left string into it.
X+  */
X+
X+ static	char *
X+ p_copyin(src, space)
X+ 	char src[];
X+ 	char **space;
X+ {
X+ 	register char *cp, *top;
X+ 	register int s;
X+
X+ 	s = strlen(src);
X+ 	cp = *space;
X+ 	top = cp;
X+ 	strcpy(cp, src);
X+ 	cp += s + 1;
X+ 	*space = cp;
X+ 	return(top);
X+ }
X+
X+ /*
X+  * Collect a liberal (space, tab delimited) word into the word buffer
X+  * passed.  Also, return a pointer to the next word following that,
X+  * or (empty) if none follow.
X+  */
X+
X+ static	char *
X+ p_nextword(wp, wbuf)
X+ 	char wp[], wbuf[];
X+ {
X+ 	register char *cp, *cp2;
X+
X+ 	if ((cp = wp) == NOSTR) {
X+ 		p_copy("", wbuf);
X+ 		return(NOSTR);
X+ 	}
X+ 	cp2 = wbuf;
X+ 	while (!any(*cp, " \t") && *cp != '\0')
X+ 		if (*cp == '"') {
X+  			*cp2++ = *cp++;
X+  			while (*cp != '\0' && *cp != '"')
X+  				*cp2++ = *cp++;
X+  			if (*cp == '"')
X+  				*cp2++ = *cp++;
X+  		} else
X+  			*cp2++ = *cp++;
X+ 	*cp2 = '\0';
X+ 	while (any(*cp, " \t"))
X+ 		cp++;
X+ 	if (*cp == '\0')
X+ 		return(NOSTR);
X+ 	return(cp);
X+ }
X+
X+ /*
X+  * Copy str1 to str2, return pointer to null in str2.
X+  */
X+
X+ static	char *
X+ p_copy(str1, str2)
X+ 	char *str1, *str2;
X+ {
X+ 	register char *s1, *s2;
X+
X+ 	s1 = str1;
X+ 	s2 = str2;
X+ 	while (*s1)
X+ 		*s2++ = *s1++;
X+ 	*s2 = 0;
X+ 	return(s2);
X+ }
X+
X+ #define	L	1		/* A lower case char */
X+ #define	S	2		/* A space */
X+ #define	D	3		/* A digit */
X+ #define	O	4		/* An optional digit or space */
X+ #define	C	5		/* A colon */
X+ #define	N	6		/* A new line */
X+ #define U	7		/* An upper case char */
X+
X+ static	char p_ctypes[] =
X+ 	{U,L,L,S,U,L,L,S,O,D,S,D,D,C,D,D,C,D,D,S,D,D,D,D,0};
X+ /*       T h u   S e p   2 9   1 5 : 2 0 : 1 9   1 9 8 8 */
X+
X+ static	char p_tmztyp[] =
X+ 	{U,L,L,S,U,L,L,S,O,D,S,D,D,C,D,D,C,D,D,S,U,U,U,S,D,D,D,D,0};
X+ /*       T h u   S e p   2 9   1 5 : 2 0 : 1 9   M S T   1 9 8 8 */
X+
X+ static	p_isdate(date)
X+ 	char date[];
X+ {
X+ 	register char *cp;
X+
X+ 	cp = date;
X+ 	if (p_cmatch(cp, p_ctypes))
X+ 		return(1);
X+
X+ 	return(p_cmatch(cp, p_tmztyp));
X+ }
X+
X+ /*
X+  * Match the given string against the given template.
X+  * Return 1 if they match, 0 if they don't
X+  */
X+
X+ static	p_cmatch(str, temp)
X+ 	char str[], temp[];
X+ {
X+ 	register char *cp, *tp;
X+ 	register int c;
X+
X+ 	cp = str;
X+ 	tp = temp;
X+ 	while (*cp != '\0' && *tp != 0) {
X+ 		c = *cp++;
X+ 		switch (*tp++) {
X+ 		case L:
X+ 			if (c < 'a' || c > 'z')
X+ 				return(0);
X+ 			break;
X+
X+ 		case U:
X+ 			if (c < 'A' || c > 'Z')
X+ 				return(0);
X+ 			break;
X+
X+ 		case S:
X+ 			if (c != ' ')
X+ 				return(0);
X+ 			break;
X+
X+ 		case D:
X+ 			if (!isdigit(c))
X+ 				return(0);
X+ 			break;
X+
X+ 		case O:
X+ 			if (c != ' ' && !isdigit(c))
X+ 				return(0);
X+ 			break;
X+
X+ 		case C:
X+ 			if (c != ':')
X+ 				return(0);
X+ 			break;
X+
X+ 		case N:
X+ 			if (c != '\n')
X+ 				return(0);
X+ 			break;
X+ 		}
X+ 	}
X+ 	if ((*cp != '\0' && *cp != '\n') || *tp != 0)
X+ 		return(0);
X+ 	return(1);
X+ }
X+
X+ static	any(ch, str)
X+ 	char *str;
X+ {
X+ 	register char *f;
X+ 	register c;
X+
X+ 	f = str;
X+ 	c = ch;
X+ 	while (*f)
X+ 		if (c == *f++)
X+ 			return(1);
X+ 	return(0);
X  }
X*** ../mh-6.6.0/./support/pop/popwrd.c	Thu Oct 29 15:02:01 1987
X--- ./support/pop/popwrd.c	Thu Apr  5 16:02:50 1990
X***************
X*** 1,4 ****
X--- 1,7 ----
X  /* popwrd.c - set password for a POP subscriber */
X+ #ifndef	lint
X+ static char ident[] = "@(#)$Id: popwrd.c,v 1.5 90/04/05 15:34:47 sources Exp $";
X+ #endif	lint
X
X  #include "../h/strings.h"
X  #include "../zotnet/bboards.h"
X***************
X*** 8,13 ****
X--- 11,19 ----
X  #include <stdio.h>
X  #include <sys/types.h>
X  #include <sys/file.h>
X+ #ifdef	SYS5
X+ #include <fcntl.h>
X+ #endif	SYS5
X
X
X  static char  temp[] = "ptmp";
X***************
X*** 147,153 ****
X--- 153,161 ----
X  	exit (1);
X      }
X
X+ #ifdef	SIGTSTP
X      (void) signal (SIGTSTP, SIG_IGN);
X+ #endif	SIGTSTP
X      if ((fp = fdopen (fd, "w")) == NULL) {
X  	fprintf (stderr, "fdopen loses.\n");
X  	(void) unlink (temp);
X*** ../mh-6.6.0/./support/pop/popaka.c	Thu Oct 29 15:01:53 1987
X--- ./support/pop/popaka.c	Thu Apr  5 16:02:52 1990
X***************
X*** 1,8 ****
X--- 1,12 ----
X  /* popaka.c - generate POP entries for MMDF-II alias file */
X+ #ifndef	lint
X+ static char ident[] = "@(#)$Id: popaka.c,v 1.4 90/04/05 15:34:58 sources Exp $";
X+ #endif	lint
X
X  #include <stdio.h>
X  #include "../zotnet/bboards.h"
X
X+ static process();
X  /*  */
X
X  /* ARGSUSED */
X*** ../mh-6.6.0/./support/pop/popsbr.c	Thu Oct 29 15:01:57 1987
X--- ./support/pop/popsbr.c	Mon Apr  9 09:45:18 1990
X***************
X*** 1,4 ****
X--- 1,7 ----
X  /* popsbr.c - POP client subroutines */
X+ #ifndef	lint
X+ static char ident[] = "@(#)$Id: popsbr.c,v 1.5 90/04/09 09:45:16 sources Exp Locker: sources $";
X+ #endif	lint
X
X  /* LINTLIBRARY */
X
X***************
X*** 6,11 ****
X--- 9,17 ----
X  #include <stdio.h>
X  #include <signal.h>
X
X+ #ifndef	POPSERVICE
X+ #define	POPSERVICE	"pop"
X+ #endif
X
X  #define	NOTOK	(-1)
X  #define	OK	0
X***************
X*** 26,31 ****
X--- 32,39 ----
X  static FILE *input;
X  static FILE *output;
X
X+ static int	traverse(), command(), multiline(), getline();
X+ static putline();
X  /*  */
X
X  #ifndef	RPOP
X***************
X*** 46,52 ****
X  #endif	RPOP
X      char    buffer[BUFSIZ];
X
X!     if ((fd1 = client (host, "tcp", "pop", rpop, response)) == NOTOK)
X  	return NOTOK;
X
X      if ((fd2 = dup (fd1)) == NOTOK) {
X--- 54,60 ----
X  #endif	RPOP
X      char    buffer[BUFSIZ];
X
X!     if ((fd1 = client (host, "tcp", POPSERVICE, rpop, response)) == NOTOK)
X  	return NOTOK;
X
X      if ((fd2 = dup (fd1)) == NOTOK) {
X*** ../mh-6.6.0/./support/pop/syslog.c	Thu Oct 29 15:02:02 1987
X--- ./support/pop/syslog.c	Thu Apr  5 16:02:51 1990
X***************
X*** 1,7 ****
X! #ifndef	BSD43
X  #ifndef lint
X  static char SccsId[] =	"@(#)syslog.c	4.1 (Berkeley) 5/27/83";
X  #endif
X
X  /*
X   * SYSLOG -- print message on log file
X--- 1,10 ----
X! #if !defined (BSD43) && !defined(hpux)
X  #ifndef lint
X  static char SccsId[] =	"@(#)syslog.c	4.1 (Berkeley) 5/27/83";
X  #endif
X+ #ifndef	lint
X+ static char ident[] = "@(#)$Id: syslog.c,v 1.5 90/04/05 15:34:53 sources Exp $";
X+ #endif	lint
X
X  /*
X   * SYSLOG -- print message on log file
X***************
X*** 19,30 ****
X  #include <sys/socket.h>
X  #include <netinet/in.h>
X
X! #include <syslog.h>
X  #include <netdb.h>
X
X  #define	MAXLINE	1024		/* max message size */
X  #define BUFSLOP	20		/* space to allow for "extra stuff" */
X  #define NULL	0		/* manifest */
X
X  int	LogFile = -1;		/* fd for log */
X  int	LogStat	= 0;		/* status bits, set by initlog */
X--- 22,40 ----
X  #include <sys/socket.h>
X  #include <netinet/in.h>
X
X! #include "syslog.h"
X  #include <netdb.h>
X
X  #define	MAXLINE	1024		/* max message size */
X  #define BUFSLOP	20		/* space to allow for "extra stuff" */
X  #define NULL	0		/* manifest */
X+
X+ #define LOG_COOLIT	LOG_LOCAL0	/* local syslog code */
X+ #define LOG_DGRAM	LOG_LOCAL1	/* idem */
X+
X+ #ifndef	LOG_HOST
X+ #define LOG_HOST	"localhost"	/* host where syslogd is running */
X+ #endif	LOG_HOST
X
X  int	LogFile = -1;		/* fd for log */
X  int	LogStat	= 0;		/* status bits, set by initlog */
X*** ../mh-6.6.0/./support/bboards/mmdfII/bboards/lock.c	Fri Nov 17 15:49:11 1989
X--- ./support/bboards/mmdfII/bboards/lock.c	Fri Nov 17 16:04:13 1989
X***************
X*** 176,181 ****
X--- 176,184 ----
X  #ifdef	BSD42
X
X  #include <sys/file.h>
X+ #ifdef	SUN40
X+ #include <sys/fcntl.h>
X+ #endif	SUN40
X
X  static int  f_lkopen (file, access)
X  register char   *file;
X***************
X*** 186,195 ****
X--- 189,212 ----
X  		    j;
X
X      for (i = 0; i < 5; i++) {
X+ #ifdef	LOCKF
X+ 	j = access;
X+ 	access &= ! O_APPEND;	/* make sure we open at the beginning */
X+ #endif	LOCKF
X  	if ((fd = open (file, access | O_NDELAY)) == NOTOK)
X  	    return NOTOK;
X+ #ifndef	LOCKF
X  	if (flock (fd, LOCK_EX | LOCK_NB) != NOTOK)
X  	    return fd;
X+ #else	LOCKF
X+ 	if (lockf (fd, F_TLOCK, 0L) != NOTOK) {
X+ 	    /* see if we should be at the end */
X+ 	    if (j & O_APPEND) lseek (fd, 0L, L_XTND);
X+ 	    return fd;
X+ 	}
X+ 	/* Fix errno - lockf screws it */
X+ 	if (errno == EACCES) errno = EWOULDBLOCK;
X+ #endif	LOCKF
X  	j = errno;
X  	(void) close (fd);
X
X***************
X*** 218,223 ****
X--- 235,246 ----
X      switch (lockstyle) {
X  	case LOK_UNIX:
X  #ifdef	BSD42
X+ #ifndef	LOCKF
X+ 	    flock (fd, LOCK_UN);
X+ #else	LOCKF
X+ 	    lseek (fd, 0L, L_SET); /* make sure we unlock the whole thing */
X+ 	    lockf (fd, F_ULOCK, 0L);
X+ #endif	LOCKF
X  	    break;
X  #endif	BSD42
X
X***************
X*** 269,274 ****
X--- 292,303 ----
X      switch (lockstyle) {
X  	case LOK_UNIX:
X  #ifdef	BSD42
X+ #ifndef	LOCKF
X+ 	    flock (fileno(fp), LOCK_UN);
X+ #else	LOCKF
X+ 	    fseek (fp, 0L, 0); /* make sure we unlock the whole thing */
X+ 	    lockf (fileno(fp), F_ULOCK, 0L);
X+ #endif	LOCKF
X  	    break;
X  #endif	BSD42
X
X*** ../mh-6.6.0/./support/bboards/bbaka.c	Thu Oct 29 15:00:58 1987
X--- ./support/bboards/bbaka.c	Tue Mar 20 16:23:49 1990
X***************
X*** 6,14 ****
X  #include "../zotnet/mts.h"
X
X
X! static int  system = 0;
X  static char domain[BUFSIZ] = "";
X
X  /*  */
X
X  /* ARGSUSED */
X--- 6,16 ----
X  #include "../zotnet/mts.h"
X
X
X! static int  systemn = 0;
X  static char domain[BUFSIZ] = "";
X
X+ static	aka(), process();
X+
X  /*  */
X
X  /* ARGSUSED */
X***************
X*** 20,26 ****
X      struct bboard  *bb;
X
X      if (argc > 1 && strcmp (argv[1], "system") == 0)
X! 	system++;
X
X      mts_init (argv[0]);
X      make_lower (domain, bb_domain);
X--- 22,28 ----
X      struct bboard  *bb;
X
X      if (argc > 1 && strcmp (argv[1], "system") == 0)
X! 	systemn++;
X
X      mts_init (argv[0]);
X      make_lower (domain, bb_domain);
X***************
X*** 44,50 ****
X              ldaddr[BUFSIZ],
X              result[BUFSIZ];
X
X!     if (system) {
X  #ifndef	MHMTS
X  	(void) sprintf (bbaddr, "%s@bboards", bb -> bb_name, LocalName ());
X  #else	MHMTS
X--- 46,52 ----
X              ldaddr[BUFSIZ],
X              result[BUFSIZ];
X
X!     if (systemn) {
X  #ifndef	MHMTS
X  	(void) sprintf (bbaddr, "%s@bboards", bb -> bb_name, LocalName ());
X  #else	MHMTS
X***************
X*** 112,117 ****
X  #ifndef	MHMTS
X      printf ("%s: %s\n", field, value);
X  #else	MHMTS
X!     printf ("%s%s %s\n", field, system ? ":" : ";", value);
X  #endif	MHMTS
X  }
X--- 114,119 ----
X  #ifndef	MHMTS
X      printf ("%s: %s\n", field, value);
X  #else	MHMTS
X!     printf ("%s%s %s\n", field, systemn ? ":" : ";", value);
X  #endif	MHMTS
X  }
X*** ../mh-6.6.0/./support/bboards/bbexp.c	Thu Oct 29 15:00:59 1987
X--- ./support/bboards/bbexp.c	Tue Mar 20 16:25:11 1990
X***************
X*** 16,21 ****
X--- 16,23 ----
X
X  static int  broken_pipe;
X
X+ static	int	move();
X+ static		process(), chgrp();
X  int	pipeser ();
X
X
X*** ../mh-6.6.0/./support/bboards/bbtar.c	Thu Oct 29 15:00:59 1987
X--- ./support/bboards/bbtar.c	Tue Mar 20 16:25:36 1990
X***************
X*** 25,30 ****
X--- 25,31 ----
X
X  static char archives[BUFSIZ];
X
X+ static	process();
X
X  struct passwd  *getpwnam ();
X
X*** ../mh-6.6.0/./support/general/replcomps	Thu Oct 29 15:01:33 1987
X--- ./support/general/replcomps	Thu Apr  5 16:05:55 1990
X***************
X*** 1,2 ****
X! %(lit)%(formataddr %<{reply-to}%|%<{from}%|%<{sender}%|%{return-path}%>%>%>)\
X  %<(nonnull)%(void(width))%(putaddr To: )\n%>\
X--- 1,2 ----
X! %(lit)%(formataddr %<{reply-to}%|%<{from}%|%<{sender}%|%<{return-path}%>%>%>%>)\
X  %<(nonnull)%(void(width))%(putaddr To: )\n%>\
X***************
X*** 6,9 ****
X  %<{subject}Subject: Re: %{subject}\n%>\
X! %<{date}In-reply-to: Your message of \
X! %<(nodate{date})%{date}%|%(tws{date})%>.%<{message-id}
X               %{message-id}%>\n%>\
X--- 6,9 ----
X  %<{subject}Subject: Re: %{subject}\n%>\
X! %<{date}In-reply-to: Your message of "\
X! %<(nodate{date})%{date}%|%(pretty{date})%>."%<{message-id}
X               %{message-id}%>\n%>\
+ END-OF-FILE MH.6.6.7
chmod 'u=rw,g=r,o=r' 'MH.6.6.7'
echo '	-rw-r--r--  1 mh          44224 Apr 13 13:53 MH.6.6.7        (as sent)'
echo -n '	'
/bin/ls -l MH.6.6.7
exit 0