X-NEWS: acfclu vmsnet.sources: 399 Path: cmcl2!phri!rutgers!usc!samsung!olivea!decwrl!infopiz!mccall.com!tp From: tp@mccall.com (Terry Poot) Newsgroups: vmsnet.sources Subject: Corrected ANU-NEWS.PATCHES for dxrn Summary: Replaces the file in the recently posted kit. Message-ID: <1991Jan8.164549@mccall.com> Date: 8 Jan 91 22:45:49 GMT Reply-To: tp@mccall.com (Terry Poot) Organization: The McCall Pattern Co., Manhattan, KS, USA Lines: 273 Archive-name: dxrn_6_14/anu-news.patches Archive maintainers: It would be a good idea to replace the anu-news.patches file in the archives with this file. (I wrote both of them, but you can ask Rick for permission.) The ANU-NEWS.PATCHES file in the dxrn distribution just posted (6.14) was for the previous version (6.11). It won't apply to the new kit. I've "re-mastered" the patches for the new version. Feed this to patch to make dxrn compatible with ANU News based NNTP servers. You must define GENERATE_EXTRA_FIELDS and TIMEZONE_ENV in config.h. This causes dxrn to generate Message-ID: and Date: headers as required by the NNTP specs and ANU News (but not most unix NNTP implementations). *** config.h_orig --- config.h ************** *** 229,234 #define GENERATE_EXTRA_FIELDS /* * the active file of most currently used news systems has a problem: * if the first article number equals the last article number for a * newsgroup, this means that there are 0 OR 1 ARTICLES. --- 229,244 ----- #define GENERATE_EXTRA_FIELDS /* + * environment variable containing timezone name + * + * Used only with GENERATE_EXTRA_FIELDS. Since gmtime is allowed to + * return NULL, we must be prepared to use localtime and provide a + * timezone specification. This macro defines the name of the environment + * variable containing the time zone. + */ + #define TIMEZONE_ENV "UUCP_TIME_ZONE" + + /* * the active file of most currently used news systems has a problem: * if the first article number equals the last article number for a * newsgroup, this means that there are 0 OR 1 ARTICLES. *** compose.c_orig --- compose.c ************** *** 2382,2388 #ifdef GENERATE_EXTRA_FIELDS time_t clockTime; ! char timeString[30]; #endif if (ComposeActive) { --- 2382,2389 ----- #ifdef GENERATE_EXTRA_FIELDS time_t clockTime; ! char timeString[40]; ! struct tm *cur_time; #endif if (ComposeActive) { ************** *** 2430,2437 #ifdef GENERATE_EXTRA_FIELDS /* stuff to generate Message-ID and Date... */ - #ifndef VMS - /* gmtime() always returns null on VMS.. */ (void) time(&clockTime); (void) strcpy(timeString, asctime(gmtime(&clockTime))); ptr = index(timeString, '\n'); --- 2431,2436 ----- #ifdef GENERATE_EXTRA_FIELDS /* stuff to generate Message-ID and Date... */ (void) time(&clockTime); cur_time = gmtime(&clockTime); if(cur_time){ ************** *** 2433,2442 #ifndef VMS /* gmtime() always returns null on VMS.. */ (void) time(&clockTime); ! (void) strcpy(timeString, asctime(gmtime(&clockTime))); ! ptr = index(timeString, '\n'); ! *ptr = '\0'; ! (void) sprintf(buffer, "Date: %s GMT\n", timeString); (void) strcat(TempString, buffer); #endif (void) sprintf(buffer, "Message-ID: %s\n", gen_id()); --- 2432,2452 ----- #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); ************** *** 2438,2444 *ptr = '\0'; (void) sprintf(buffer, "Date: %s GMT\n", timeString); (void) strcat(TempString, buffer); - #endif (void) sprintf(buffer, "Message-ID: %s\n", gen_id()); (void) strcat(TempString, buffer); #endif --- 2448,2453 ----- } (void) sprintf(buffer, "Date: %s\n", timeString); (void) strcat(TempString, buffer); (void) sprintf(buffer, "Message-ID: %s\n", gen_id()); (void) strcat(TempString, buffer); #endif ************** *** 2497,2503 #ifdef GENERATE_EXTRA_FIELDS time_t clockTime; ! char *ptr, timeString[30]; #endif if (ComposeActive) { --- 2506,2513 ----- #ifdef GENERATE_EXTRA_FIELDS time_t clockTime; ! char *ptr, timeString[40]; ! struct tm *cur_time; #endif if (ComposeActive) { ************** *** 2541,2547 #ifdef GENERATE_EXTRA_FIELDS /* stuff to generate Message-ID and Date... */ - #ifndef VMS (void) time(&clockTime); (void) strcpy(timeString, asctime(gmtime(&clockTime))); ptr = index(timeString, '\n'); --- 2551,2556 ----- #ifdef GENERATE_EXTRA_FIELDS /* stuff to generate Message-ID and Date... */ (void) time(&clockTime); cur_time = gmtime(&clockTime); if(cur_time){ ************** *** 2543,2552 /* stuff to generate Message-ID and Date... */ #ifndef VMS (void) time(&clockTime); ! (void) strcpy(timeString, asctime(gmtime(&clockTime))); ! ptr = index(timeString, '\n'); ! *ptr = '\0'; ! (void) sprintf(buffer, "Date: %s GMT\n", timeString); (void) strcat(TempString, buffer); #endif (void) sprintf(buffer, "Message-ID: %s\n", gen_id()); --- 2552,2572 ----- #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); ************** *** 2548,2554 *ptr = '\0'; (void) sprintf(buffer, "Date: %s GMT\n", timeString); (void) strcat(TempString, buffer); - #endif (void) sprintf(buffer, "Message-ID: %s\n", gen_id()); (void) strcat(TempString, buffer); #endif --- 2568,2573 ----- } (void) sprintf(buffer, "Date: %s\n", timeString); (void) strcat(TempString, buffer); (void) sprintf(buffer, "Message-ID: %s\n", gen_id()); (void) strcat(TempString, buffer); #endif ************** *** 2600,2605 art_num current = newsgroup->current; char buffer[10000]; char *bufptr; if (ComposeActive) { mesgPane(XRN_SERIOUS, "Only one composition pane at a time"); --- 2619,2629 ----- 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"); ************** *** 2658,2663 (void) strcat(TempString, "\n"); (void) sprintf(buffer, "Control: cancel %s\n", Header.messageId); (void) strcat(TempString, buffer); switch (postArticle(TempString,XRN_NEWS)) { case POST_FAILED: --- 2682,2709 ----- (void) strcat(TempString, "\n"); (void) sprintf(buffer, "Control: cancel %s\n", Header.messageId); (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); + #endif switch (postArticle(TempString,XRN_NEWS)) { case POST_FAILED: -- Terry Poot The McCall Pattern Company (uucp: ...!rutgers!ksuvax1!mccall!tp) 615 McCall Road (800)255-2762, in KS (913)776-4041 Manhattan, KS 66502, USA