Article View: news.software.readers
Article #68720Re: [slrn] slrnpull & compressing files
From: Johannes Zellner
Date: Thu, 07 Dec 2000 01:56
Date: Thu, 07 Dec 2000 01:56
173 lines
5339 bytes
5339 bytes
In article <GGyX5.119116$U46.3961944@news1.sttls1.wa.home.com>, Keith wrote:
>On 6 Dec 2000 15:00:06 GMT, Johannes Zellner <johannes@zellner.org> wrote:
>> Hi,
>>
>> using slrnpull (on Linux), is it possible to have all the
>> files gzipped ? -- I guess I'd
>>
>> 1) first tell slrn how to unzip the files when reading
>> 2) tell slrnpull not to download 5370 if 5370.gz is already there
>>
>> does anybody know if (and how) this is possible ?
>>
>> --
>> Johannes
>
>slrnpull keeps a record in the .minmax files so if you don't remove those then
>you will not have problems.
so it was just patching slrn to handle ".gz" or ".bz2". The
patch is attached if someone is interested. Applies to a
vanilla 0.9.6.3. You've to define WITH_LOCAL_COMPRESSION
somwhere, I tried to make it an configure switch, but
obviously some m4 files are missing so I couldn't use
autoconf.
Comments are welcome.
#v +
*** ./spool.c.orig Thu Dec 7 02:10:49 2000
--- ./spool.c Thu Dec 7 01:57:50 2000
***************
*** 85,90 ****
--- 85,98 ----
static int spool_fakeactive_read_line(char *, int);
static int Spool_fakeactive_newsgroups=0;
+ #if defined(WITH_LOCAL_COMPRESSION) && defined(HAVE_UNISTD_H)
+ # define ALLOW_LOCAL_COMPRESSED
+ #endif
+
+ #ifdef ALLOW_LOCAL_COMPRESSED
+ static int (*Spool_close)(FILE*) = fclose;
+ #endif
+
#if DEBUG_SPOOL
# include <stdarg.h>
static void spool_debug (char *fmt, ...)
***************
*** 128,134 ****
--- 136,147 ----
if (Spool_fh_local != NULL)
{
if (Spool_fh_local != Spool_fh_nov)
+ #ifdef ALLOW_LOCAL_COMPRESSED
+ res = Spool_close(Spool_fh_local);
+ Spool_close = fclose;
+ #else
res = fclose(Spool_fh_local);
+ #endif
Spool_fh_local=NULL;
}
return res;
***************
*** 364,377 ****
return -1;
}
-
static FILE *spool_open_article_num (int num)
{
char buf [SLRN_MAX_PATH_LEN];
sprintf (buf, "%s/%d", Spool_Group, num);
! return fopen (buf,"r");
}
static int spool_article_num_exists (int num)
--- 377,424 ----
return -1;
}
static FILE *spool_open_article_num (int num)
{
char buf [SLRN_MAX_PATH_LEN];
+ FILE* fp = (FILE*)0;
+
+ #if defined(ALLOW_LOCAL_COMPRESSED)
+ struct cmd_suffix_s {
+ char* cmd;
+ char* suffix;
+ };
+
+ static struct cmd_suffix_s table[] = {
+ {"gzip -d -c ", ".gz"},
+ {"bunzip2 -c ", ".bz2"},
+ {(char*)0, (char*)0} /* terminate */
+ };
+ #endif
sprintf (buf, "%s/%d", Spool_Group, num);
! fp = fopen (buf,"r");
! #if defined(ALLOW_LOCAL_COMPRESSED)
! if (!fp) {
! char shell_cmd[32 + SLRN_MAX_PATH_LEN];
! struct cmd_suffix_s* entry;
! for (entry = table; entry->cmd; entry++) {
! strcpy(shell_cmd, buf);
! strcat(shell_cmd, entry->suffix);
! if (!access(shell_cmd, R_OK)) {
! strcpy(shell_cmd, entry->cmd);
! strcat(shell_cmd, buf);
! strcat(shell_cmd, entry->suffix);
! fp = popen(shell_cmd, "r");
! if (fp) {
! Spool_close = pclose;
! }
! break;
! }
! }
! }
! #endif
! return fp;
}
static int spool_article_num_exists (int num)
***************
*** 905,911 ****
--- 952,963 ----
if (Spool_fh_nov != NULL)
{
+ #ifdef ALLOW_LOCAL_COMPRESSED
+ Spool_close (Spool_fh_nov);
+ Spool_close = fclose;
+ #else
fclose (Spool_fh_nov);
+ #endif
Spool_fh_nov = NULL;
}
***************
*** 952,958 ****
if (NULL != Spool_fh_nov)
{
! fclose (Spool_fh_nov);
Spool_fh_nov = NULL;
}
Spool_Server_Inited = 0;
--- 1004,1015 ----
if (NULL != Spool_fh_nov)
{
! #ifdef ALLOW_LOCAL_COMPRESSED
! Spool_close(Spool_fh_nov);
! Spool_close = fclose;
! #else
! fclose(Spool_fh_nov);
! #endif
Spool_fh_nov = NULL;
}
Spool_Server_Inited = 0;
#v -
--
Johannes
Technical Details
Message-ID:
<slrn92trj1.rs8.johannes@kristine.zellner.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!supernews.google.com!sn-xit-02!supernews.com!peer.news.opaltelecom.net!news.inweb.net.uk!ayres.ftech.net!news.ftech.net!newsfeed.icl.net!newsfeed00.sul.t-online.de!t-online.de!newscore.gigabell.net!news-fra.pop.de!schlund.de!rz.uni-karlsruhe.de!news.rz.uni-karlsruhe.de!johannesReferences:
<slrn92skm1.h81.johannes@kristine.zellner.org> <GGyX5.119116$U46.3961944@news1.sttls1.wa.home.com>Show Full Headers
Complete Article Headers
Message-ID: <slrn92trj1.rs8.johannes@kristine.zellner.org> Subject: Re: [slrn] slrnpull & compressing files Date: Thu, 07 Dec 2000 01:56:50 +0000 From: johannes@zellner.org (Johannes Zellner) References: <slrn92skm1.h81.johannes@kristine.zellner.org> <GGyX5.119116$U46.3961944@news1.sttls1.wa.home.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!supernews.google.com!sn-xit-02!supernews.com!peer.news.opaltelecom.net!news.inweb.net.uk!ayres.ftech.net!news.ftech.net!newsfeed.icl.net!newsfeed00.sul.t-online.de!t-online.de!newscore.gigabell.net!news-fra.pop.de!schlund.de!rz.uni-karlsruhe.de!news.rz.uni-karlsruhe.de!johannes Newsgroups: news.software.readers Supersedes: <slrn92tp6n.815.johannes@kristine.zellner.org> Organization: University of Karlsruhe, Germany Lines: 172 NNTP-Posting-Host: isdn216-242.rz.uni-karlsruhe.de Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: news.rz.uni-karlsruhe.de 976154210 21773 129.13.216.242 X-Complaints-To: usenet@rz.uni-karlsruhe.de User-Agent: slrn/0.9.6.3 (Linux)