home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sources / bugs / 337 < prev    next >
Encoding:
Internet Message Format  |  1993-01-27  |  3.7 KB

  1. Xref: sparky comp.sources.bugs:337 news.software.b:3874
  2. 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
  3. From: mrapple@quack.sac.ca.us (Nick Sayer)
  4. Newsgroups: comp.sources.bugs,news.software.b
  5. Subject: Re: C-news unofficial patch: freeze news batches
  6. Message-ID: <fYvNCtJ@quack.sac.ca.us>
  7. Date: 27 Jan 93 11:13:58 GMT
  8. References: <fYnlXJc@quack.sac.ca.us>
  9. Organization: The Duck Pond public unix: +1 408 249 9630, log in as 'guest'.
  10. Lines: 104
  11. Followups-to: news.software.b
  12.  
  13. Since I posted my unofficial frozen-news patch for C-news, many
  14. folks have pointed out that gzip does even better. So I've
  15. applied a similar patch that allows C-news to send and receive
  16. gzip'd batches of news. That'll work until the next great
  17. compression revolution. :-)
  18.  
  19. Note that as is traditional with gzip, the batches in
  20. $NEWSSPOOL/in.coming that are gzipped have a '.z' extension
  21. potentially confusing them with packed files. The solution is
  22. to always use gunzip on ".z" files. It will cheerfully unpack
  23. packed files (as well as uncompress compressed ones).
  24.  
  25. Once again, here's the patch to c-news (this one makes newsspool
  26. and newsrun recognize freeze AND gzip) and a script to stick in
  27. $NEWSBIN/batch/gzipzun:
  28.  
  29. -----
  30. #! /bin/sh
  31. # Invoke gzip, adding silly 2.11-compatible header, sort of.
  32. # Leave off the -9 if you have a wimpy CPU, or even replace
  33. # it with -1.
  34.  
  35. echo "#! zunbatch"
  36. gzip -9
  37. exit $?
  38. -----
  39.  
  40. *** newsspool.c.old    Sat Jan 23 14:00:06 1993
  41. --- newsspool.c    Tue Jan 26 08:04:52 1993
  42. ***************
  43. *** 260,265 ****
  44. --- 260,273 ----
  45.   #    define    GOOP7LEN    (sizeof(goop7)-1)    /* strlen(goop7) */
  46.       static char suf7[] = ".7";
  47.       static char comp[2] = { 037, 0235 };    /* compress's magic no. */
  48. +     static char goopf[] = "funbatch";
  49. + #    define GOOPFLEN (sizeof(goopf)-1)
  50. +     static char suff[] = ".F";
  51. +     static char freeze[2] = { 037, 0237 };    /* freeze's magic no. */
  52. +     static char goopz[] = "zunbatch";
  53. + #    define GOOPZLEN (sizeof(goopz)-1)
  54. +     static char sufz[] = ".z";
  55. +     static char gzip[2] = { 037, 0213 };    /* gzip's magic no. */
  56.       register char *p;
  57.       register int nleft;
  58.   #    define    MINCBATCH    5        /* one character, compressed */
  59. ***************
  60. *** 270,275 ****
  61. --- 278,297 ----
  62.       if (nleft < 2)                /* no room for a header */
  63.           return(0);
  64.   
  65. +     if (p[0] == gzip[0] && p[1] == gzip[1]) {    /* gzipped */
  66. +         if (nleft < MINCBATCH)
  67. +             return(count);
  68. +         suffix = sufz;
  69. +         return(0);
  70. +     }
  71. +     if (p[0] == freeze[0] && p[1] == freeze[1]) {    /* frozen */
  72. +         if (nleft < MINCBATCH)
  73. +             return(count);
  74. +         suffix = suff;
  75. +         return(0);
  76. +     }
  77.       if (p[0] == comp[0] && p[1] == comp[1]) {    /* compressed */
  78.           if (nleft < MINCBATCH)
  79.               return(count);
  80. ***************
  81. *** 296,301 ****
  82. --- 318,331 ----
  83.           p += GOOP7LEN;
  84.           nleft -= GOOP7LEN;
  85.           suffix = suf7;
  86. +     } else if (nleft >= GOOPFLEN+1 && STREQN(p, goopf, GOOPFLEN)) {
  87. +         p += GOOPFLEN;
  88. +         nleft -= GOOPFLEN;
  89. +         suffix = suff;
  90. +     } else if (nleft >= GOOPZLEN+1 && STREQN(p, goopz, GOOPZLEN)) {
  91. +         p += GOOPZLEN;
  92. +         nleft -= GOOPZLEN;
  93. +         suffix = sufz;
  94.       } else                    /* no header */
  95.           return(0);
  96.   
  97. *** newsrun.old    Tue Mar 26 09:21:45 1991
  98. --- newsrun    Tue Jan 26 08:05:49 1993
  99. ***************
  100. *** 122,127 ****
  101. --- 122,129 ----
  102.           text=$tmp
  103.           case $f in
  104.           *.Z)    uncompress <$f >$text    ;;
  105. +         *.z)    gunzip <$f >$text    ;;
  106. +         *.F)    unfreeze <$f >$text    ;;
  107.           *.7)    c7decode <$f | uncompress >$text    ;;
  108.           *.t)    >$tmp        # in case compress left trash
  109.               text=$f
  110. -- 
  111. Nick Sayer <mrapple@quack.sac.ca.us> | "Oh no! I know what YOU want!
  112. N6QQQ @ N0ARY.#NOCAL.CA.USA.NOAM     | You coveteth my ice-cream bar!"
  113. +1 408 249 9630, log in as 'guest'   | 
  114. PGP 2.1 public key on request        |        -- Captain Hoek
  115.