From casper@fwi.uva.nl Wed Nov  2 18:07:05 1994
Received: from binky.ics.uci.edu by q2.ics.uci.edu id aa16505; 3 Nov 94 5:51 PST
Received: from ics.uci.edu by binky.ics.uci.edu id aa17902; 3 Nov 94 5:51 PST
Received: from ics.uci.edu by binky.ics.uci.edu id aa17894; 3 Nov 94 5:50 PST
Received: from USENET by q2.ics.uci.edu id aa16476; 3 Nov 94 5:50 PST
From: "Casper H.S. Dik" <casper@fwi.uva.nl>
Newsgroups: comp.mail.mh
Subject: Re: Problem with building up mh on Solaris 2.3
Date: 2 Nov 1994 18:07:05 +0100
Message-ID: <398gvp$bqa@mail.fwi.uva.nl>
NNTP-Posting-Host: mail.fwi.uva.nl
To:       mh-users@ics.uci.edu

dhathwar@uncc.edu (Deepak Hathwar) writes:

>	I am trying to build mh on Solaris 2.3. I am using the example 
>	configuration file that is supposed to be applicable to Solaris.

>	While building, I get the following errors;
>	1)	"fmtcompile.c", line 238: warning: semantics of "/" change in ANSI C;
>		 use explicit cast


This is a warning you can safely ignore.

>	2) 	cd ..; ln sendmail/sendmts.a libmts.a
>		ln: libmts.a is on a different file system
>		*** Error code 2 (ignored)

Are you using AFS?  In that case you must use ln -s.
Or else some strange is going on (rm libmts.a if it exists)

>	3)	cc may also need -R/tmp/mhmime/Mh/lib -s -o date date.o dtime.o  -lnsl

Error in your configuration file (see below).

>	4)	make: Warning: Don't know how to make target `../mts/libmts.a'

Consequence of failure in 2)

>	5)	cc -DSYS5 -DSVR4 -DFCNTL -DRENAME -DVSPRINTF -DATTVIBUG -DDBMPWD -DDUMB 		-DMORE='"/usr/bin/more"' -DMSGPROT='"0600"' -DMSGID -DRPATHS -DSOCKETS -DFOLDPROT='"0711"' -DSHADOW -DSYS5DIR -DMHRC -DMHE -DMIME -DSENDMTS -DSMTP -DSPRINTFTYPE=int -DTYPESIG=void -O -g  -c  mhn.c

mhn.c needs a patch.


This expands to "may also need -R/tmp/mhmime/Mh/lib" which is wrong.
    >ldoptions may also need -R/tmp/mhmime/Mh/lib
Change to:
ldoptions -R/tmp/mhmime/Mh/lib

Diffs:

These diffs to MH 6.8.3 fix two problems: the define of si_value in one
of the system .h files makes the compiler bail out on mhn.

The second is an added feature ``CONTENT_LENGTH''.  All changes related
to this feature are isolated with #ifdef CONTENT_LENGTH.  If you wish
to use this feature, you have to add ``options CONTENT_LENGTH''
to your MH config file.

This additional feature will try to use the Content-Length: header generated
by the SVR4 mail deliverer.  This Header gives the length in bytes of the
of an e-mail message, minus the headers and the line seperating header
and body.  This feature is used to do out-of-band message boundary
detection, making escaping "From " lines unnecessary.

Casper

*** mh-6.8.3/uip/mhn.c.org	Wed Dec  1 05:01:36 1993
--- mh-6.8.3/uip/mhn.c	Fri Jun  3 12:38:04 1994
***************
*** 1014,1019 ****
--- 1014,1020 ----
  #include "../h/mhn.h"
  
  
+ #undef si_value
  struct str2init {
      char   *si_key;
      int	    si_value;
*** mh-6.8.3/sbr/m_getfld.c.org	Wed Dec  1 05:01:24 1993
--- mh-6.8.3/sbr/m_getfld.c	Tue Jun  7 10:54:14 1994
***************
*** 169,174 ****
--- 169,179 ----
  static unsigned char *edelim;
  static int  edelimlen;
  
+ #ifdef CONTENT_LENGTH
+ static int content_length = -1;
+ static long end_of_contents = -1;
+ #endif
+ 
  static int  (*eom_action) () = NULL;
  
  #ifdef _FSTDIO
***************
*** 195,200 ****
--- 200,216 ----
      register int    i;
      register int    j;
  
+ #ifdef CONTENT_LENGTH
+     /*
+      * When starting to read from a new file, we have to reset the state,
+      * but only if the state wasn't reset.  That may save us a number of
+      * lseeks.
+      */
+     if (state == FLD &&
+ 	(content_length != -1 || end_of_contents != -1) &&
+ 	ftell(iob) == 0)
+ 	    end_of_contents = content_length = -1;
+ #endif
      if ((c = Getc(iob)) < 0) {
  	msg_count = 0;
  	*buf = 0;
***************
*** 222,227 ****
--- 238,276 ----
  		while (c != '\n' && (c = Getc(iob)) >= 0)
  		    ;
  
+ #ifdef CONTENT_LENGTH
+ 		/*
+ 		 * When we've found a content-length header, we're
+ 		 * going to use it to tell where the message boundary
+ 		 * is, if it is a valid mesage boundary.
+ 		 * There can be a number of cases:
+ 		 * - no bytes after <content-length> bytes: the usual format
+ 		 *   of a message in an MH folder.
+ 		 * - only a newline - last message in mail drop.
+ 		 * - "\nFrom "	- beginning of next message
+ 		 * - other - ignore Content-Length header, but issue warning
+ 		 */
+ 		if (content_length != -1) {
+ 		    long here = ftell(iob);
+ 		    static char delim[] = "\nFrom ";
+ 		    char buf[sizeof(delim)-1];
+ 		    int cnt;
+ 
+ 		    /* compute position of character after file */
+ 		    end_of_contents = here + content_length + 1;
+ 		    content_length = -1;
+ 		    /* And see whether this is a From header or eof. */
+ 		    fseek(iob, end_of_contents - 1, 0);
+ 		    cnt = fread(buf, sizeof(char), sizeof(buf), iob);
+ 		    if (cnt != 0 && (cnt != 1 || buf[0] != '\n') &&
+ 			(cnt != sizeof(buf) ||
+ 			  strncmp(buf,delim, sizeof(buf)) != 0)) {
+ 			    advise (NULLCP, "invalid Content-Length: header\n");
+ 			    end_of_contents = -1;
+ 		    }
+ 		    fseek(iob, here, 0);
+ 		}
+ #endif
  		if (c < 0 || (c = Getc(iob)) < 0 || eom (c, iob)) {
  		    if (! eom_action) {
  			/* flush null messages */
***************
*** 425,430 ****
--- 474,489 ----
  finish:;
      *cp = 0;
      msg_count = cp - buf;
+ 
+ #ifdef CONTENT_LENGTH
+     /* Check whether this was a Content-Length header */
+     if (state == FLD &&
+ 	    strcasecmp((char*)"content-length", (char*) name) == 0) {
+ 	content_length = atoi(buf);
+ 	/* This value is computed when end-of-headers is detected */
+ 	end_of_contents = -1;
+     }
+ #endif
      return (state);
  }
  
***************
*** 544,549 ****
--- 603,626 ----
  #endif /* RPATHS */
  
      pos = ftell (iob);
+ 
+ #ifdef CONTENT_LENGTH
+     if (end_of_contents != -1) {
+ 	if (end_of_contents == pos) {
+ 	    end_of_contents = -1;
+ 	    return 1;
+ 	}
+ 	/* we've read past the end of a message, this should never happen
+ 	 * because of the other checks we do */
+ 	if (end_of_contents < pos) {
+ 	    end_of_contents = -1;
+ 	    adios(NULLCP,
+ 		    "Content-Length: header broken, can't read mailbox\n");
+ 	}
+ 	return 0;
+     }
+ #endif
+     
      if ((i = fread (text, sizeof *text, edelimlen, iob)) != edelimlen
  	    || strncmp (text, (char *)edelim, edelimlen)) {
  	if (i == 0 && msg_style == MS_UUCP)
***************
*** 560,565 ****
--- 637,654 ----
  #endif /* !notdef */
  	return 0;
      }
+ 
+ #ifdef CONTENT_LENGTH
+     /* There's one extra special case to be considered here:
+      * content_length > 0.  That we got here is because the
+      * message body starts with "From "
+      */
+     if (content_length > 0) {
+ 	(void) fseek (iob, (long)(pos-1), 0);
+ 	(void) getc (iob);		/* should be OK */
+ 	return 0;
+     }
+ #endif
  
      if (msg_style == MS_UUCP) {
  #ifndef	RPATHS

From Casper.Dik@holland.sun.com Mon Jun 26 14:55:39 1995
Received: from binky.ics.uci.edu by q2.ics.uci.edu id aa17349;
          26 Jun 95 8:21 PDT
Received: from ics.uci.edu by binky.ics.uci.edu id aa15428; 26 Jun 95 8:21 PDT
Received: from ics.uci.edu by binky.ics.uci.edu id aa15422; 26 Jun 95 8:20 PDT
Received: from USENET by q2.ics.uci.edu id aa17318; 26 Jun 95 8:20 PDT
From: "Casper H.S. Dik - Network Security Engineer" <Casper.Dik@holland.sun.com>
Newsgroups: comp.mail.mh
Subject: Re: 'inc' splitting mail stream incorrectly
Date: 26 Jun 1995 14:55:39 GMT
Message-ID: <3smhpb$bh1@engnews2.Eng.Sun.COM>
NNTP-Posting-Host: room101.holland.sun.com
To:       mh-users@ics.uci.edu

mckim@mildred.lerc.nasa.gov (Jim McKim) writes:

>We recently installed mh and exmh on some workstations in my area.
>Everything works great except for one small problem.

>The 'inc' function sometimes incorrectly breaks a single letter into
>separate letters when an empty line followed by a line starting
>'From ...' (^From .*$) occurs in the middle of the letter. Can anybody
>suggest a way to work around this problem?


This is an incompatibility between the way MH is configured to split
messages and how your system generates messages.  E.g., on Solaris 2.x
the mail should be split after Content-Length: bytes of body have been read.

To enable this in MH, you need ftp.fwi.uva.nl:/pub/solaris/mh-6.8.3*

Casper
--
Expressed in this posting are my opinions.  They are in no way related
to opinions held by my employer, Sun Microsystems.


From mathew@mantis.co.uk Wed Jun 15 14:24:31 1994
Received: from binky.ics.uci.edu by q2.ics.uci.edu id aa12280;
          15 Jun 94 6:31 PDT
Received: from ics.uci.edu by binky.ics.uci.edu id aa19346; 15 Jun 94 6:31 PDT
Received: from ics.uci.edu by binky.ics.uci.edu id aa19342; 15 Jun 94 6:30 PDT
Received: from USENET by q2.ics.uci.edu id aa12239; 15 Jun 94 6:30 PDT
From: mathew <mathew@mantis.co.uk>
Newsgroups: comp.mail.mh
Subject: MH and Content-Length
Date: 15 Jun 1994 14:24:31 +0100
Message-ID: <2tmvef$lqo@sunforest.mantis.co.uk>
NNTP-Posting-Host: sunforest.mantis.co.uk
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
To:       mh-users@ics.uci.edu

Encouraged by the recent patches for Content-Length header support in
MH, I have moved over to using that header and removing the ">From"
hack from all local mailers.

I just thought I'd point out two potential problems to anyone else
planning on doing this:

1. If you're using smail, you need to carry on appending a blank line
   between messages, or else the posted patches don't work.

2. If you use slocal, you'll want to comment out the >From hackery
   from uip/dropsbr.c, line 379, with a #ifndef CONTENT_LENGTH.
   I spent ages trying to work out why I was still getting '>' signs,
   until I remembered slocal.


mathew
[ Now a happy bunny with POP, Elm, MH and no >From ]
-- 
http://www.mantis.co.uk/~mathew/
Looking for: Bug-tracking systems for UNIX, DOS and Windows

