home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.sources.bugs:337 news.software.b:3874
- Path: sparky!uunet!mailgate.mobil.com!dlpcbc!awful!lerami!kf5iw!wb9rxw!texsun!cronkite.Central.Sun.COM!news2me.EBay.Sun.COM!sun-barr!decwrl!ames!haven.umd.edu!darwin.sura.net!sgiblab!daver!quack!mrapple
- From: mrapple@quack.sac.ca.us (Nick Sayer)
- Newsgroups: comp.sources.bugs,news.software.b
- Subject: Re: C-news unofficial patch: freeze news batches
- Message-ID: <fYvNCtJ@quack.sac.ca.us>
- Date: 27 Jan 93 11:13:58 GMT
- References: <fYnlXJc@quack.sac.ca.us>
- Organization: The Duck Pond public unix: +1 408 249 9630, log in as 'guest'.
- Lines: 104
- Followups-to: news.software.b
-
- Since I posted my unofficial frozen-news patch for C-news, many
- folks have pointed out that gzip does even better. So I've
- applied a similar patch that allows C-news to send and receive
- gzip'd batches of news. That'll work until the next great
- compression revolution. :-)
-
- Note that as is traditional with gzip, the batches in
- $NEWSSPOOL/in.coming that are gzipped have a '.z' extension
- potentially confusing them with packed files. The solution is
- to always use gunzip on ".z" files. It will cheerfully unpack
- packed files (as well as uncompress compressed ones).
-
- Once again, here's the patch to c-news (this one makes newsspool
- and newsrun recognize freeze AND gzip) and a script to stick in
- $NEWSBIN/batch/gzipzun:
-
- -----
- #! /bin/sh
- # Invoke gzip, adding silly 2.11-compatible header, sort of.
- # Leave off the -9 if you have a wimpy CPU, or even replace
- # it with -1.
-
- echo "#! zunbatch"
- gzip -9
- exit $?
- -----
-
- *** newsspool.c.old Sat Jan 23 14:00:06 1993
- --- newsspool.c Tue Jan 26 08:04:52 1993
- ***************
- *** 260,265 ****
- --- 260,273 ----
- # define GOOP7LEN (sizeof(goop7)-1) /* strlen(goop7) */
- static char suf7[] = ".7";
- static char comp[2] = { 037, 0235 }; /* compress's magic no. */
- + static char goopf[] = "funbatch";
- + # define GOOPFLEN (sizeof(goopf)-1)
- + static char suff[] = ".F";
- + static char freeze[2] = { 037, 0237 }; /* freeze's magic no. */
- + static char goopz[] = "zunbatch";
- + # define GOOPZLEN (sizeof(goopz)-1)
- + static char sufz[] = ".z";
- + static char gzip[2] = { 037, 0213 }; /* gzip's magic no. */
- register char *p;
- register int nleft;
- # define MINCBATCH 5 /* one character, compressed */
- ***************
- *** 270,275 ****
- --- 278,297 ----
- if (nleft < 2) /* no room for a header */
- return(0);
-
- + if (p[0] == gzip[0] && p[1] == gzip[1]) { /* gzipped */
- + if (nleft < MINCBATCH)
- + return(count);
- + suffix = sufz;
- + return(0);
- + }
- +
- + if (p[0] == freeze[0] && p[1] == freeze[1]) { /* frozen */
- + if (nleft < MINCBATCH)
- + return(count);
- + suffix = suff;
- + return(0);
- + }
- +
- if (p[0] == comp[0] && p[1] == comp[1]) { /* compressed */
- if (nleft < MINCBATCH)
- return(count);
- ***************
- *** 296,301 ****
- --- 318,331 ----
- p += GOOP7LEN;
- nleft -= GOOP7LEN;
- suffix = suf7;
- + } else if (nleft >= GOOPFLEN+1 && STREQN(p, goopf, GOOPFLEN)) {
- + p += GOOPFLEN;
- + nleft -= GOOPFLEN;
- + suffix = suff;
- + } else if (nleft >= GOOPZLEN+1 && STREQN(p, goopz, GOOPZLEN)) {
- + p += GOOPZLEN;
- + nleft -= GOOPZLEN;
- + suffix = sufz;
- } else /* no header */
- return(0);
-
- *** newsrun.old Tue Mar 26 09:21:45 1991
- --- newsrun Tue Jan 26 08:05:49 1993
- ***************
- *** 122,127 ****
- --- 122,129 ----
- text=$tmp
- case $f in
- *.Z) uncompress <$f >$text ;;
- + *.z) gunzip <$f >$text ;;
- + *.F) unfreeze <$f >$text ;;
- *.7) c7decode <$f | uncompress >$text ;;
- *.t) >$tmp # in case compress left trash
- text=$f
- --
- Nick Sayer <mrapple@quack.sac.ca.us> | "Oh no! I know what YOU want!
- N6QQQ @ N0ARY.#NOCAL.CA.USA.NOAM | You coveteth my ice-cream bar!"
- +1 408 249 9630, log in as 'guest' |
- PGP 2.1 public key on request | -- Captain Hoek
-