Xref: utzoo news.software.b:8365 news.admin:15395 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!pacbell.com!iggy.GW.Vitalink.COM!widener!brendan From: brendan@cs.widener.edu (Brendan Kehoe) Newsgroups: news.software.b,news.admin Subject: A fix for non-compliant Message-ID's Message-ID: Date: 20 Jun 91 18:08:41 GMT Reply-To: brendan@cs.widener.edu Organization: Widener CS Dept Lines: 324 This is a patch to the CNews extensions that I wrote; among other things, it fixes the problem of having '.' at the beginning or end of a Message-ID. (It also fixes a couple of things with spacefor; a small bug and support for Ultrix.) The full set is on ftp.cs.widener.edu in pub/cnews.set.shar.Z, or by writing to archive-server@cs.widener.edu with a `Subject:' line of: send widener cnews.set.shar The kit includes rewrites (in C, rather than shell scripts) for anne.jones, tear, and spacefor. Enjoy. Any bugs, suggestions, etc, should go to me. -- cut -- diff -rc ../old/Makefile ./Makefile *** ../old/Makefile Thu Jun 20 13:48:44 1991 --- ./Makefile Thu Jun 20 13:36:32 1991 *************** *** 2,8 **** # # This is available via anon FTP at 192.55.239.132 (ftp.cs.widener.edu) # ! # Last Updated: 03/26/91 # # Step 1 - Edit anne.h, spacefor.h, and to customize them for your site. # Step 2 - Set up BINDIR, CC, CFLAGS, and CNEWSLIB for your configuration. --- 2,8 ---- # # This is available via anon FTP at 192.55.239.132 (ftp.cs.widener.edu) # ! # Last Updated: 06/20/91 # # Step 1 - Edit anne.h, spacefor.h, and to customize them for your site. # Step 2 - Set up BINDIR, CC, CFLAGS, and CNEWSLIB for your configuration. *************** *** 27,32 **** --- 27,33 ---- # If you're running AIX 2.2.1 on an IBM RT use -DAIX # If you're on an Altos system, use -DALTOS (note only spacefor uses this) # If you're using System V/386, use -DSysV386 + # If you're using Ultrix, use -DULTRIX # Note for SunOS 4.1: I expressly didn't use -O2 or higher because of # the many bugreports that are logged discounting their accuracy. (Most # notable is -O2, generally accepted, even in the Gnu Project.) diff -rc ../old/anne.jones.c ./anne.jones.c *** ../old/anne.jones.c Thu Jun 20 13:48:45 1991 --- ./anne.jones.c Thu Jun 20 13:48:17 1991 *************** *** 113,121 **** } } else { ! /* ! if gecos has '&', use capitalized login name ! */ if ((strchr(pent->pw_gecos, '&') != (char *) NULL)) { name = safemalloc(strlen(pent->pw_name) + 1); strcpy(name, pent->pw_name); --- 113,119 ---- } } else { ! /* if gecos has '&', use capitalized login name */ if ((strchr(pent->pw_gecos, '&') != (char *) NULL)) { name = safemalloc(strlen(pent->pw_name) + 1); strcpy(name, pent->pw_name); diff -rc ../old/anne.misc.c ./anne.misc.c *** ../old/anne.misc.c Thu Jun 20 13:48:46 1991 --- ./anne.misc.c Thu Jun 20 13:47:36 1991 *************** *** 1,5 **** /* ! * anne.jones - anne.misc.c - 03/26/91 * * Miscellaneous routines used by anne.jones */ --- 1,5 ---- /* ! * anne.jones - anne.misc.c - 06/20/91 * * Miscellaneous routines used by anne.jones */ *************** *** 180,185 **** --- 180,191 ---- * (zeeff@b-tech.ann-arbor.mi.us). Palkovic@linac.fnal.gov, 3/22/91. * * A string of some valid message id characters + * + * 06/20/91 - changed the string to be RFC1036-compliant (no '.'s; they + * could end up at the front or back of the local part of + * the Message-ID, which is a nono; also put the lowercase + * letters in, since according to the RFC AaA and aAa should + * qualify as unique id's */ void *************** *** 186,192 **** rand_id(s) char *s; { ! static char string[] = "!#._+-=ABCDFGHJKLMNPQRSTVWXYZ1234567890"; register int size = sizeof(string) - 1; long num; --- 192,198 ---- rand_id(s) char *s; { ! static char string[] = "!#_+-=ABCDFGHJKLMNPQRSTVWXYZ1234567890abcdefghijklmnopqrstuvwxyz"; register int size = sizeof(string) - 1; long num; diff -rc ../old/spacefor.c ./spacefor.c *** ../old/spacefor.c Thu Jun 20 13:48:47 1991 --- ./spacefor.c Thu Jun 20 13:57:55 1991 *************** *** 1,5 **** /* ! * spacefor - spacefor.c - 04/29/91 - Brendan Kehoe * * a replacement for the spacefor shell script * --- 1,5 ---- /* ! * spacefor - spacefor.c - 06/20/91 - Brendan Kehoe * * a replacement for the spacefor shell script * *************** *** 10,15 **** --- 10,18 ---- * * NEWSCTL and NEWSARTS have to be exported into the environment before * this is called for it to work + * + * v1.1a - 05/27/91 - fixed the desire for non-1024 blks (vato@warwick.ac.uk) + * v1.1b - 06/20/91 - added Ultrix (thanks to stealth@engin.umich.edu) */ #include *************** *** 16,35 **** #include #include #include "spacefor.h" #ifdef HAVE_STATFS #include /* note: ALTOS & SysV386 need this */ ! #if defined(ALTOS) || defined(SysV386) ! #include ! #else /* !ALTOS && !SysV386 */ ! #include ! #endif #else /* !HAVE_STATFS */ ! #include ! #include #endif /* HAVE_STATFS */ #ifdef SysV386 ! #define f_bavail f_bfree /* SysV386 uses f_bfree instead: john@jwt.uucp */ #endif /* SysV386 */ int --- 19,45 ---- #include #include #include "spacefor.h" + #ifdef HAVE_STATFS #include /* note: ALTOS & SysV386 need this */ ! # if defined(ALTOS) || defined(SysV386) ! # include ! # else /* !ALTOS && !SysV386 */ ! # ifdef ULTRIX ! # include ! # include ! # define f_bavail fd_req.bfreen ! # else /* !ULTRIX */ ! # include ! # endif /* ULTRIX */ ! # endif /* ALTOS || SysV386 */ #else /* !HAVE_STATFS */ ! # include ! # include #endif /* HAVE_STATFS */ #ifdef SysV386 ! # define f_bavail f_bfree /* SysV386 uses f_bfree instead: john@jwt.uucp */ #endif /* SysV386 */ int *************** *** 38,48 **** --- 48,64 ---- char **argv; { #ifdef HAVE_STATFS + #ifdef ULTRIX + struct fs_data b; + #else /* !ULTRIX */ struct statfs b; + #endif /* ULTRIX */ + #else /* !HAVESTATFS */ struct stat b; struct ustat device; #endif /* HAVESTATFS */ + int nb, desire = 0, num_items; char *arg, path_buf[100], *news_arts, *news_ctl; extern char *getenv(); *************** *** 107,127 **** * Beware: with all of the dependancies included, this is MESSY as HELL */ #ifdef HAVE_STATFS ! # if defined(ALTOS) || defined(SysV386) /* this is for an Altos 2000/386 ! and System V/386 */ if (statfs(arg, &b, sizeof(struct statfs), 0) < 0) { ! # else /* !ALTOS && !SysV386 */ if (statfs(arg, &b) < 0) { ! # endif /* ALTOS && !SysV386 */ nb = 0; fprintf(stderr, "%s: Can't statfs() `%s'\n", *argv, arg); } else ! nb = ((int)b.f_bavail - desire) * BLK_SIZE / num_items; #ifdef DEBUG printf("nb = (b.f_bavail - desire) * BLK_SIZE / num_items;\n"); printf("%d = (%ld - %d) * %d / %d;\n", nb, b.f_bavail, desire, BLK_SIZE, num_items); #endif /* DEBUG */ #else /* !HAVESTATFS */ if (stat(arg,&b)) { nb = 0; /* can't stat arg */ --- 123,157 ---- * Beware: with all of the dependancies included, this is MESSY as HELL */ #ifdef HAVE_STATFS ! ! /* this is for an Altos 2000/386, System V/386, and Ultrix */ ! # if defined(ALTOS) || defined(SysV386) || defined(ULTRIX) ! ! #ifdef ULTRIX ! if (statfs(arg, &b, sizeof(struct fs_data), 0) < 0) { ! #else /* !ULTRIX -> ALTOS || SysV386 */ if (statfs(arg, &b, sizeof(struct statfs), 0) < 0) { ! #endif /* ULTRIX */ ! ! # else /* !ALTOS && !SysV386 && !ULTRIX */ if (statfs(arg, &b) < 0) { ! # endif /* ALTOS || SysV386 || ULTRIX*/ ! nb = 0; fprintf(stderr, "%s: Can't statfs() `%s'\n", *argv, arg); } else ! /* thanks to Ian Dickinson (vato@warwick.ac.uk) for spotting this bug; ! now the desire (in blocks) is converted to kilobytes; it hadn't ! been noticed cuz BLKSIZE was == 1024; once it wasn't 1024, the ! bug appeared */ ! nb = (((int)b.f_bavail * (int)b.f_bsize) - (desire * 1024)) / num_items; ! #ifdef DEBUG printf("nb = (b.f_bavail - desire) * BLK_SIZE / num_items;\n"); printf("%d = (%ld - %d) * %d / %d;\n", nb, b.f_bavail, desire, BLK_SIZE, num_items); #endif /* DEBUG */ + #else /* !HAVESTATFS */ if (stat(arg,&b)) { nb = 0; /* can't stat arg */ *************** *** 132,142 **** --- 162,174 ---- fprintf(stderr, "%s: Can't ustat() `%s'\n", *argv, b.st_dev); } else nb = (device.f_tfree - desire) * BLK_SIZE / num_items; + #ifdef DEBUG printf("nb = (device.f_tfree - desire) * BLK_SIZE / num_items;\n"); printf("%d = (%d - %d) * %d / %d;\n", nb, device.f_tfree, desire, BLK_SIZE, num_items); #endif /* DEBUG */ + #endif /* HAVESTATFS */ if (nb > 10000) diff -rc ../old/spacefor.h ./spacefor.h *** ../old/spacefor.h Thu Jun 20 13:48:47 1991 --- ./spacefor.h Thu Jun 20 13:51:29 1991 *************** *** 3,11 **** */ #define UUCP_DIR "/usr/spool/uucp" /* Your uucp spool directory */ - /* - * #undef HAVE_STATFS for Ultrix; it's got one, but not what we want to use - */ #define HAVE_STATFS /* have the statfs() call? */ /* --- 3,8 ---- *************** *** 13,18 **** --- 10,19 ---- * with 512-byte blocks, you don't have to do anything. If you've got a * special case, go below and do as directed. */ + #ifdef ULTRIX + #define BSD + #endif + #ifdef BSD #define BLK_SIZE 1024 #else /* !BSD */ -- cut -- -- Brendan Kehoe - Widener Sun Network Manager - brendan@cs.widener.edu Widener University in Chester, PA A Bloody Sun-Dec War Zone "Ya know, kitten tacos are really better than anything you've ever tasted before!" "Oh, really." -- Rush Limbaugh