From 49effcc1b5b673fcdfc14e21801bd2f7786d589c Mon Sep 17 00:00:00 2001 From: fredb Date: Wed, 15 Aug 2001 06:09:01 +0000 Subject: Bump version to 1.0nb7 for a couple of gratuitious changes: Implement percent ('%') filename expansion in the "pipe" widget of the save/pipe dialog. Especially useful for setting Knews*shellfield.buffer in ${XENVIRONMENT}. Count articles for save/pipe command as "1 of N", "2 of N", and so on. --- news/knews/Makefile | 4 +- news/knews/distinfo | 5 +- news/knews/patches/patch-be | 138 ++++++++++++++++++++++++++++++++++++++++++++ news/knews/patches/patch-bf | 10 ++++ news/knews/patches/patch-bg | 68 ++++++++++++++++++++++ 5 files changed, 222 insertions(+), 3 deletions(-) create mode 100644 news/knews/patches/patch-be create mode 100644 news/knews/patches/patch-bf create mode 100644 news/knews/patches/patch-bg (limited to 'news/knews') diff --git a/news/knews/Makefile b/news/knews/Makefile index 59b05fb384c..70fca840e6c 100644 --- a/news/knews/Makefile +++ b/news/knews/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.34 2001/05/22 09:32:24 wiz Exp $ +# $NetBSD: Makefile,v 1.35 2001/08/15 06:09:01 fredb Exp $ DISTNAME= knews-1.0b.1 -PKGNAME= knews-1.0nb6 +PKGNAME= knews-1.0nb7 CATEGORIES= news x11 MASTER_SITES= http://www.matematik.su.se/~kjj/ diff --git a/news/knews/distinfo b/news/knews/distinfo index e7f9ca33336..e9f28a943ec 100644 --- a/news/knews/distinfo +++ b/news/knews/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.4 2001/07/25 07:17:06 tron Exp $ +$NetBSD: distinfo,v 1.5 2001/08/15 06:09:01 fredb Exp $ SHA1 (knews-1.0b.1.tar.gz) = b56046036d4c6688439e6730b8ae2a2eade922db Size (knews-1.0b.1.tar.gz) = 392225 bytes @@ -32,3 +32,6 @@ SHA1 (patch-ba) = a46041cc02ec99379d1c7a69534ca4574a1d8b77 SHA1 (patch-bb) = 05963335420741b8ce5658ad43cbfa83379fe289 SHA1 (patch-bc) = 74b0c0ee543f3753886dc75ea7d32a61256eb5b5 SHA1 (patch-bd) = 6ed34d15ce86336e280f39fc0903d0bd84e93e4c +SHA1 (patch-be) = 3cf47af64e7865f3336b0549b78e3f56bbff2252 +SHA1 (patch-bf) = 5d51af81738c227de3ec6d23bbfe33c593410614 +SHA1 (patch-bg) = 84e4daf47ca111831661448c4411da4d9c803d27 diff --git a/news/knews/patches/patch-be b/news/knews/patches/patch-be new file mode 100644 index 00000000000..6bed07ac54a --- /dev/null +++ b/news/knews/patches/patch-be @@ -0,0 +1,138 @@ +$NetBSD: patch-be,v 1.1 2001/08/15 06:09:02 fredb Exp $ + +--- src/expand.c.orig Fri Jan 9 11:16:29 1998 ++++ src/expand.c +@@ -110,49 +110,46 @@ + return dest; + } + +-char *expand_path(char *file_name) ++char *expand_save_text(char *src) + { +- char *path = NULL; ++ char *dest = NULL; + long len = 0, pos = 0; + char ch; + +- if (file_name[0] == '~' && file_name[1] == '/') +- file_name += 2; +- +- for (ch = *file_name++ ; ch != '\0' ; ch = *file_name++) { ++ for (ch = *src++ ; ch != '\0' ; ch = *src++) { + if (pos + 8 > len) { + len = pos + 256; +- path = XtRealloc(path, len); ++ dest = XtRealloc(dest, len); + } + + if (ch != '%') +- path[pos++] = ch; ++ dest[pos++] = ch; + else { + char *p, *c = NULL; + int cap = False; + int slash = False; + int clen = 0; + +- ch = *file_name++; ++ ch = *src++; + switch (ch) { + case '%': +- path[pos++] = '%'; ++ dest[pos++] = '%'; + continue; /* don't fall through */ + case 'a': + case 'A': + if (global.mode != NewsModeGroup && + global.mode != NewsModeThread) { + fputs("knews: Not in a newsgroup!\n", stderr); +- XtFree(path); ++ XtFree(dest); + return NULL; + } + if (!global.curr_art) { + fputs("knews: No selected article!\n", stderr); +- XtFree(path); ++ XtFree(dest); + return NULL; + } +- sprintf(path + pos, "%ld", global.curr_art->no); +- pos += strlen(path + pos); ++ sprintf(dest + pos, "%ld", global.curr_art->no); ++ pos += strlen(dest + pos); + continue; + case 'g': + slash = True; +@@ -180,7 +177,7 @@ + c = global.nntp_server; + if (!c) { + fputs("knews: nntp_server is NULL!\n", stderr); +- XtFree(path); ++ XtFree(dest); + return NULL; + } + p = strchr(c, ':'); +@@ -192,7 +189,7 @@ + default: + fprintf(stderr, + "knews: %%%c: Unknown format specifier.\n", ch); +- XtFree(path); ++ XtFree(dest); + return NULL; + } + +@@ -202,7 +199,7 @@ + clen = strlen(c); + } else { + fputs("knews: Not in a newsgroup.\n", stderr); +- XtFree(path); ++ XtFree(dest); + return NULL; + } + +@@ -210,7 +207,7 @@ + continue; + if (pos + clen + 8 > len) { + len = pos + clen + 256; +- path = XtRealloc(path, len); ++ dest = XtRealloc(dest, len); + } + + ch = *c++; +@@ -219,18 +216,32 @@ + if (cap && islower((unsigned char)ch)) + ch = toupper((unsigned char)ch); + +- path[pos++] = ch; ++ dest[pos++] = ch; + while (clen-- > 0) { + ch = *c++; + + if (ch == '.' && slash) + ch ='/'; +- path[pos++] = ch; ++ dest[pos++] = ch; + } +- path[pos] = '\0'; ++ dest[pos] = '\0'; + } + } +- path[pos] = '\0'; ++ dest[pos] = '\0'; ++ ++ return dest; ++} ++ ++char *expand_path(char *file_name) ++{ ++ char *path = NULL; ++ ++ if (file_name[0] == '~' && file_name[1] == '/') ++ file_name += 2; ++ ++ path = expand_save_text(file_name); ++ if (!path) ++ return NULL; + + return path; + } diff --git a/news/knews/patches/patch-bf b/news/knews/patches/patch-bf new file mode 100644 index 00000000000..7b63af01e4f --- /dev/null +++ b/news/knews/patches/patch-bf @@ -0,0 +1,10 @@ +$NetBSD: patch-bf,v 1.1 2001/08/15 06:09:02 fredb Exp $ + +--- src/expand.h.orig Fri Jan 9 11:16:29 1998 ++++ src/expand.h +@@ -7,4 +7,5 @@ + extern char *regexp_escape_string(char*, int); + extern char *expand_view_command(const char*, char*, char*, + struct MimeArg*, int, int); ++extern char *expand_save_text(char*); + extern char *expand_path(char*); diff --git a/news/knews/patches/patch-bg b/news/knews/patches/patch-bg new file mode 100644 index 00000000000..76d8a9a0e6c --- /dev/null +++ b/news/knews/patches/patch-bg @@ -0,0 +1,68 @@ +$NetBSD: patch-bg,v 1.1 2001/08/15 06:09:02 fredb Exp $ + +--- src/save.c.orig Sun Jul 8 08:31:37 2001 ++++ src/save.c +@@ -9,6 +9,7 @@ + #include "child.h" + #include "codes.h" + #include "connect.h" ++#include "expand.h" + #include "file.h" + #include "save.h" + #include "sysdeps.h" +@@ -256,6 +257,9 @@ + char *buffer; + SERVER *server; + ++ sprintf(p, "%ld of %ld", i + 1, n); ++ set_message(message, False); ++ + server = cache_get_server(arts[i]->no, False); + if (!server) { + char command[32]; +@@ -276,9 +280,6 @@ + server_free(server); + else if (!buffer) + return -1; +- +- sprintf(p, "%ld", i + 1); +- set_message(message, False); + } + + if (fflush(fp) < 0) +@@ -436,7 +437,7 @@ + XtFree(cmd); + } + +-static void do_pipe(char *command, SaveScope scope, int what) ++static void do_pipe(char *raw_command, SaveScope scope, int what) + { + FILE *file = NULL; + char *file_name; +@@ -445,6 +446,7 @@ + int status, fflush_status; + char message[128]; + pid_t pid; ++ char *command; + char *temp; + + if (global.busy) +@@ -453,11 +455,17 @@ + if (global.mode != NewsModeGroup && global.mode != NewsModeThread) { + set_message("Not in a newsgroup!", True); + return; +- } else if (!command || command[0] == '\0') { ++ } else if (!raw_command || raw_command[0] == '\0') { + set_message("No command specified!", True); + return; + } else if (!(what & (SAVE_HEAD | SAVE_BODY))) { + set_message("Nothing to pipe (neither head or body selected)!", True); ++ return; ++ } ++ ++ command = expand_save_text(raw_command); ++ if (!command) { ++ set_message("Shell command expansion failed!", True); + return; + } + -- cgit v1.2.3