From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 24-MAY-1991 18:40:49.02
To:	ARISIA::EVERHART
CC:	
Subj:	Important TESTED patch for dxrn/mxrn

From:	RELAY-INFO-VAX@CRVAX.SRI.COM@SMTP@CRDGW2
To:	Everhart@Arisia@MRGATE

Received:  by crdgw1.ge.com (5.57/GE 1.97)
	 id AA25403; Fri, 24 May 91 16:38:15 EDT
Received: From UCBVAX.BERKELEY.EDU by CRVAX.SRI.COM with TCP; Fri, 24 MAY 91 09:18:28 PDT
Received: by ucbvax.Berkeley.EDU (5.63/1.42)
	id AA22595; Fri, 24 May 91 09:07:20 -0700
Received: from USENET by ucbvax.Berkeley.EDU with netnews
	for info-vax@kl.sri.com (info-vax@kl.sri.com)
	(contact usenet@ucbvax.Berkeley.EDU if you have questions)
Date: 24 May 91 13:27:57 GMT
From: agate!spool.mu.edu!think.com!zaphod.mps.ohio-state.edu!maverick.ksu.ksu.edu!deimos.cis.ksu.edu!mccall!tp@ucbvax.Berkeley.EDU  (Terry Poot)
Organization: The McCall Pattern Co., Manhattan, KS, USA
Subject: Important TESTED patch for dxrn/mxrn
Message-Id: <1991May24.082757@mccall.com>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com

Sorry about the last one, this patch produces RFC822 compatible dates as 
best I can tell, and hopefully this will statisfy C news.

In case you don't know by now, a recent change to C news causes it to
discard all postings and followups from dxrn or mxrn if they are built
with GENERATE_EXTRA_FIELDS defined. The format of the Date: header is not
acceptable to the recent version of C news. This probably mostly affects
those ysing dxrn or mxrn to connect to an ANU News nntp server, as it
requires the message to contain Date: headers, whereas most unix based
nntp servers do not.

If you run dxrn or mxrn with GENERATE_EXTRA_FILEDS defined, I strongly
suggest you apply this pastch, as your articles are not being propagated
to the whole net, and will be dropped by even more sites as more of them
upgrade theif version of C news.

Please do not assume that you are unaffected if nobody has told you there
is a problem. The messages printed by C news when it encounters one of
these messages does not give enough information for the C news
administrator to contact you about the problem without doing a fair bit of
work to locate the offending article. Also, there is a great deal of
"somebody else probably told him by now" going on. C news does not attempt
to contact the offending site, but simply prints a message in a log file
and discards the article (meaning, of course, that many sites never receive
it at all, and thus can not warn you about it).

This patch is for dxrn/mxrn version 6.14-4, and assumes that you have
applied the "ANU-NEWS" patch included with that version, and which is 
needed to get the correct time in the first place, and has nothing
particularly to do with ANU News. Rick will be including it as a standard
part of the code in the future. That patch must be applied if your gmtime()
returns NULL, as it does with VAX C, and you define GENERATE_EXTRA_FIELDS.
You will also need to define TIMEZONE_ENV in config.h to be the name of
an environment variable (logical name or DCL symbol) that will contain a
valid timezone. As given, it sets it up properly for sites using DECUS
uucp.

If you have applied that patch (which applies correctly with an offset
(I think it was 38 lines) on 6.14-4), then apply this one to get the
Date: header formatted to C news' liking. If you have some other version
of dxrn/mxrn, and you build it with GENERATE_EXTRA_FIELDS defined, I'd
suggest you look at the patch and make similar changes. It shouldn't be
hard.

BTW, it has been suggested to me in email that it would be easier to fix
C news. The authors and proponents of C news don't consider this a problem,
they did it on purpose, and as far as I can tell, most of them really don't
care, since their articles aren't being dropped. The bottom line is that
they refuse to do anything about this, and since many sites run C news, 
the only practical option is to conform to their software. I would like to 
thank Kenneth Herron and Mark Davies specifically for calling this problem
to my attention (the only 2 that did, world wide, so like I said, don't
assume you don't have a problem just because nobody has told you you do).

I'll be submitting this patch to the vmsnet.sources moderator for posting
so that it will get into the archives and be available to anyone who might
later retrieve dxrn from those archives. I'll also send them to Rick Murphy
(the author) so that he can distribute them to any other places dxrn might
be made available, and include them in future releases. If you know someone
running dxrn that might not read any of these newsgroups, please forward
this to them. In fact, if you know someone not running C news, you might
let him know about the problem with it, so that he can try to find out if
his articles are being discarded. I highly doubt that dxrn/mxrn is the
only software generating things C news doesn't like.


*** compose.c_orig
--- compose.c
**************
*** 2407,2413
  
      return(genid);
  }
! #endif
  
  void
  followup()
--- 2407,2416 -----
  
      return(genid);
  }
! /*
!  *  generate a valid RFC822 date-time
!  */
! static char gendate[40];
  
  static char *gen_date()
  {
**************
*** 2409,2414
  }
  #endif
  
  void
  followup()
  {
--- 2412,2438 -----
   */
  static char gendate[40];
  
+ static char *gen_date()
+ {
+     time_t clockTime;
+     char *atime, *tz;
+     struct tm *cur_time;
+ 
+     (void) time(&clockTime);
+     cur_time = gmtime(&clockTime);
+     if(cur_time){
+         atime = asctime(cur_time);
+         tz = "GMT";
+     } else {
+         atime = asctime(localtime(&clockTime));
+         tz = getenv(TIMEZONE_ENV);
+     }
+     sprintf(gendate, "%3s, %2s %3s %2s %8s %s", atime, atime+8, atime+22, 
+         atime+11, tz);
+     return(gendate);
+ }
+ #endif
+ 
  void
  followup()
  {
**************
*** 2418,2429
      char *signature, *ptr;
      int OldPostingMode = PostingMode;
  
- #ifdef GENERATE_EXTRA_FIELDS
-     time_t clockTime;
-     char timeString[40];
-     struct tm *cur_time;
- #endif
- 
      if (ComposeActive) {
  	mesgPane(XRN_SERIOUS, "Only one composition pane at a time");
  	return;
--- 2442,2447 -----
      char *signature, *ptr;
      int OldPostingMode = PostingMode;
  
      if (ComposeActive) {
  	mesgPane(XRN_SERIOUS, "Only one composition pane at a time");
  	return;
**************
*** 2469,2490
  
  #ifdef GENERATE_EXTRA_FIELDS
      /* stuff to generate Message-ID and Date... */
!     (void) time(&clockTime);
!     cur_time = gmtime(&clockTime);
!     if(cur_time){
!         (void) strcpy(timeString, asctime(cur_time));
!         ptr = index(timeString, '\n');
!         *ptr = '\0';
!         (void) strcat(timeString, " GMT");
!     } else {
!         cur_time = localtime(&clockTime);
!         (void) strcpy(timeString, asctime(cur_time));
!         ptr = index(timeString, '\n');
!         *ptr = '\0';
!         (void) strcat(timeString, " ");
!         (void) strcat(timeString, getenv(TIMEZONE_ENV));
!     }
!     (void) sprintf(buffer, "Date: %s\n", timeString);
      (void) strcat(TempString, buffer);
      (void) sprintf(buffer, "Message-ID: %s\n", gen_id());
      (void) strcat(TempString, buffer);
--- 2487,2493 -----
  
  #ifdef GENERATE_EXTRA_FIELDS
      /* stuff to generate Message-ID and Date... */
!     (void) sprintf(buffer, "Date: %s\n", gen_date());
      (void) strcat(TempString, buffer);
      (void) sprintf(buffer, "Message-ID: %s\n", gen_id());
      (void) strcat(TempString, buffer);
**************
*** 2542,2553
      char *signature;
      int OldPostingMode = PostingMode;
  
- #ifdef GENERATE_EXTRA_FIELDS
-     time_t clockTime;
-     char *ptr, timeString[40];
-     struct tm *cur_time;
- #endif
- 
      if (ComposeActive) {
  	mesgPane(XRN_SERIOUS, "Only one composition pane at a time");
  	return;
--- 2545,2550 -----
      char *signature;
      int OldPostingMode = PostingMode;
  
      if (ComposeActive) {
  	mesgPane(XRN_SERIOUS, "Only one composition pane at a time");
  	return;
**************
*** 2589,2610
  
  #ifdef GENERATE_EXTRA_FIELDS
      /* stuff to generate Message-ID and Date... */
!     (void) time(&clockTime);
!     cur_time = gmtime(&clockTime);
!     if(cur_time){
!         (void) strcpy(timeString, asctime(cur_time));
!         ptr = index(timeString, '\n');
!         *ptr = '\0';
!         (void) strcat(timeString, " GMT");
!     } else {
!         cur_time = localtime(&clockTime);
!         (void) strcpy(timeString, asctime(cur_time));
!         ptr = index(timeString, '\n');
!         *ptr = '\0';
!         (void) strcat(timeString, " ");
!         (void) strcat(timeString, getenv(TIMEZONE_ENV));
!     }
!     (void) sprintf(buffer, "Date: %s\n", timeString);
      (void) strcat(TempString, buffer);
      (void) sprintf(buffer, "Message-ID: %s\n", gen_id());
      (void) strcat(TempString, buffer);
--- 2586,2592 -----
  
  #ifdef GENERATE_EXTRA_FIELDS
      /* stuff to generate Message-ID and Date... */
!     (void) sprintf(buffer, "Date: %s\n", gen_date());
      (void) strcat(TempString, buffer);
      (void) sprintf(buffer, "Message-ID: %s\n", gen_id());
      (void) strcat(TempString, buffer);
**************
*** 2657,2667
      art_num current = newsgroup->current;
      char buffer[10000];
      char *bufptr;
- #ifdef GENERATE_EXTRA_FIELDS
-     time_t clockTime;
-     char *ptr, timeString[40];
-     struct tm *cur_time;
- #endif
  
      if (ComposeActive) {
  	mesgPane(XRN_SERIOUS, "Only one composition pane at a time");
--- 2639,2644 -----
      art_num current = newsgroup->current;
      char buffer[10000];
      char *bufptr;
  
      if (ComposeActive) {
  	mesgPane(XRN_SERIOUS, "Only one composition pane at a time");
**************
*** 2722,2743
      (void) strcat(TempString, buffer);
  #ifdef GENERATE_EXTRA_FIELDS
      /* stuff to generate Message-ID and Date... */
!     (void) time(&clockTime);
!     cur_time = gmtime(&clockTime);
!     if(cur_time){
!         (void) strcpy(timeString, asctime(cur_time));
!         ptr = index(timeString, '\n');
!         *ptr = '\0';
!         (void) strcat(timeString, " GMT");
!     } else {
!         cur_time = localtime(&clockTime);
!         (void) strcpy(timeString, asctime(cur_time));
!         ptr = index(timeString, '\n');
!         *ptr = '\0';
!         (void) strcat(timeString, " ");
!         (void) strcat(timeString, getenv(TIMEZONE_ENV));
!     }
!     (void) sprintf(buffer, "Date: %s\n", timeString);
      (void) strcat(TempString, buffer);
      (void) sprintf(buffer, "Message-ID: %s\n", gen_id());
      (void) strcat(TempString, buffer);
--- 2699,2705 -----
      (void) strcat(TempString, buffer);
  #ifdef GENERATE_EXTRA_FIELDS
      /* stuff to generate Message-ID and Date... */
!     (void) sprintf(buffer, "Date: %s\n", gen_date());
      (void) strcat(TempString, buffer);
      (void) sprintf(buffer, "Message-ID: %s\n", gen_id());
      (void) strcat(TempString, buffer);



--
Terry Poot <tp@mccall.com>                   The McCall Pattern Company
(uucp: ...!rutgers!ksuvax1!deimos!mccall!tp) 615 McCall Road
(800)255-2762, in KS (913)776-4041           Manhattan, KS 66502, USA

