Thread View: news.software.readers
1 messages
1 total messages
Started by Ian T Zimmerman
Wed, 26 Feb 1997 00:00
slrn patches (mostly for header display)
Author: Ian T Zimmerman
Date: Wed, 26 Feb 1997 00:00
Date: Wed, 26 Feb 1997 00:00
311 lines
10414 bytes
10414 bytes
Hello,
here's a diff vers. 0.9.3 that serves a couple of purposes.
The most important one, and the only one that makes me go public with
this, is the fix to some annoyances in header display.
Before, you would get authors' real names or net handles displayed,
depending on the order of fields in the header (ie. the author_display
setting). Unfortunately, with the fixed width of the fields, that
meant in author_display mode 2 the real name was most often off the
screen. My fix makes real name display orthogonal to the field order:
it now depends only on the new show_real_name setting.
Similarly, author_display = 2 used to mean that you got all the
subject lines, regardless of show_thread_subject. My patch makes
these two, likewise, orthogonal: if show_thread_subject = 0, the >
shorthand for followups is used no matter what author_display is.
Thirdly, I found that for my usage the automatic move to next article
after a [du*] command was more annoying than useful (because I often
want to do two of these on the same article, and on the other hand
it's a single keystroke to get me to the next article if I _want
to_). So I added a new setting move_after_article_delete, which, if
set to 0, disables this move.
Next, I made slrn add a "Fwd: " prefix to the subject line when
forwarding an article by mail to a third party. I think this is more
or less standard for newsreaders/posters; anyways, I needed this to
alert my editor what's going on (because the file name is the same as
for replies, it didn't have much else to guess by).
And lastly, I discovered that the system() routine of my standard C
library is not up to POSIX code! Namely, it returns an error if the
wait() system call is interrupted by a signal. I added a replacement
system() routine in src/misc.c. It won't get compiled in unless the
macro BROKEN_SYSTEM is defined; I also added a check for this
situation to the configure.in file, but of course to put that into
effect, one must first rerun autoconf (which means jed's acsite.m4 is
needed), then re-configure, and finally re-make. Bottom line: you
don't have to worry about this unless you're into hacking slrn
yourself.
Here it goes, enjoy (and I await comments from jed):
--- autoconf/configure.in Sun Feb 23 17:07:35 1997
+++ autoconf/configure.in Mon Feb 24 17:48:42 1997
@@ -44,6 +44,53 @@
siglongjmp
)
+#itz 02-07-97 Linux system() is broken :-(
+AC_C_CONST
+AC_TYPE_SIGNAL
+AC_CACHE_CHECK([if your system() routine is broken by signals],
+ itz_cv_func_system_broken,[AC_TRY_RUN(
+[
+#include <stdlib.h>
+#include <signal.h>
+#include <unistd.h>
+#include <limits.h>
+#include <stdio.h>
+
+static $ac_cv_type_signal handle_usr1 (int signo)
+{
+ return;
+}
+
+int main (int argc, char** argv)
+{
+ if (argc > 1) {
+ int ppid = atoi(argv[1]);
+ kill(ppid, SIGUSR1);
+ sleep(5);
+ exit(0);
+ } else {
+ int status;
+ char cmd [PATH_MAX+10];
+ static char logmsg [] = "system() returned nonzero status\n";
+ signal(SIGUSR1, handle_usr1);
+ sprintf(cmd, "%s %d", argv[0], getpid());
+ status = system(cmd);
+ if (status) {
+ write(5, logmsg, sizeof(logmsg)-1);
+ }
+ exit(status);
+ } /*if*/
+}
+],
+[itz_cv_func_system_broken=no],
+[itz_cv_func_system_broken=yes],
+[itz_cv_func_system_broken=yes])
+])
+
+if test "$itz_cv_func_system_broken" = "yes"; then
+ AC_DEFINE(BROKEN_SYSTEM)
+fi
+
AC_CACHE_CHECK(for domain in /etc/resolv.conf, slrn_cv_domain,
[if test -f /etc/resolv.conf; then
slrn_cv_domain=`(grep "^domain" /etc/resolv.conf ||
--- src/misc.c.orig Sun Feb 23 17:07:38 1997
+++ src/misc.c Mon Feb 24 19:27:19 1997
@@ -803,8 +803,75 @@
/*}}}*/
-
/*}}}*/
+
+/* itz 02-07-97 to avoid further complications, I only try to fix this
+ on otherwise POSIX systems. Other users will have to put up with
+ their library system() behaviour. */
+
+#ifdef SLRN_POSIX_SIGNALS
+#ifdef BROKEN_SYSTEM
+/* itz 02-07-97 this version is from APUE (W R Stevens, Addison Wesley
+ 1992, p.314 */
+static int system (const char* cmd) /* {{{ */
+{
+ pid_t pid;
+ int status;
+ struct sigaction ignore, saveintr, savequit;
+ sigset_t chldmask, savemask;
+
+ if (cmd == 0) {
+ return 1;
+ } /*if*/
+ ignore.sa_handler = SIG_IGN; /* ignore SIGINT and SIGQUIT */
+ sigemptyset(&ignore.sa_mask);
+ ignore.sa_flags = 0;
+ if (sigaction(SIGINT, &ignore, &saveintr) < 0) {
+ return -1;
+ } /*if*/
+ if (sigaction(SIGQUIT, &ignore, &savequit) < 0) {
+ return -1;
+ } /*if*/
+ sigemptyset(&chldmask); /* now block SIGCHLD */
+ sigaddset(&chldmask, SIGCHLD);
+ if (sigprocmask(SIG_BLOCK, &chldmask, &savemask) < 0) {
+ return -1;
+ } /*if*/
+ if ((pid = fork ()) < 0) {
+ status = -1; /* probably out of processes */
+ } else if (pid == 0) { /* child */
+ /* restore previous signal actions and reset signal mask */
+ sigaction(SIGINT, &saveintr, 0);
+ sigaction(SIGQUIT, &savequit, 0);
+ sigprocmask(SIG_SETMASK, &savemask, 0);
+
+ execl("/bin/sh", "sh", "-c", cmd, (char*)(0));
+ _exit(127); /* shouldn't get here */
+ } else { /* parent */
+ while (waitpid(pid, &status, 0) < 0) {
+ /* itz 02-07-97 !!! this is where my library's system() fails */
+ if (errno != EINTR) {
+ status = -1;
+ break;
+ } /*if*/
+ } /*while*/
+ } /*if*/
+ /* restore previous signal actions and reset signal mask */
+ if (sigaction(SIGINT, &saveintr, 0) < 0) {
+ return -1;
+ } /*if*/
+ if (sigaction(SIGQUIT, &savequit, 0) < 0) {
+ return -1;
+ } /*if*/
+ if (sigprocmask(SIG_SETMASK, &savemask, 0) < 0) {
+ return -1;
+ } /*if*/
+
+ return status;
+}
+ /* }}} */
+#endif /* BROKEN_SYSTEM */
+#endif /* SLRN_POSIX_SIGNALS */
int slrn_posix_system (char *cmd, int reset) /*{{{*/
{
--- src/startup.c 1997/02/25 18:28:02 1.1
+++ src/startup.c 1997/02/25 19:24:29
@@ -322,6 +322,8 @@
{"use_tmpdir", &Slrn_Use_Tmpdir},
{"sorting_method", &Slrn_Sorting_Mode},
{"uncollapse_threads", &Slrn_Threads_Visible},
+ {"move_after_article_delete", &Slrn_Move_After_Article_Delete},
+ {"show_real_name", &Slrn_Show_Real_Name},
{"read_active", &Slrn_List_Active_File},
{"use_metamail", &Slrn_Use_Meta_Mail},
{"group_dsc_start_column", &Slrn_Group_Description_Column},
--- src/art.h 1997/02/25 18:26:24 1.1
+++ src/art.h 1997/02/25 19:22:47
@@ -37,6 +37,11 @@
extern int Slrn_Use_Tildes;
#endif
extern int Slrn_New_Subject_Breaks_Threads;
+
+/* itz Tue Feb 25 10:26:56 PST 1997 */
+extern int Slrn_Move_After_Article_Delete;
+extern int Slrn_Show_Real_Name;
+
extern int Slrn_Sig_Is_End_Of_Article;
#endif /* NOT SLRNPULL_CODE */
--- src/art.c 1997/02/25 18:08:19 1.1
+++ src/art.c 1997/02/25 22:32:35
@@ -105,6 +105,10 @@
#endif
int Slrn_New_Subject_Breaks_Threads = 0;
+/* itz Tue Feb 25 10:16:13 PST 1997 */
+int Slrn_Move_After_Article_Delete = 0;
+int Slrn_Show_Real_Name = 1;
+
char *Slrn_Current_Group_Name;
Slrn_Header_Type *Slrn_First_Header;
Slrn_Header_Type *Slrn_Current_Header;
@@ -1508,7 +1512,8 @@
{
for_this_tree (Slrn_Current_Header, toggle_one_header_tag);
}
- (void) slrn_header_down_n (1, 0);
+ if (Slrn_Move_After_Article_Delete)
+ (void) slrn_header_down_n (1, 0);
Slrn_Full_Screen_Update = 1;
}
@@ -2432,7 +2437,7 @@
subject = slrn_extract_header ("Subject: ", 9);
- fprintf (fp, "To: %s\nSubject: %s\n",
+ fprintf (fp, "To: %s\nSubject: Fwd: %s\n",
to, subject == NULL ? "" : subject);
#ifdef __os2__
@@ -5833,7 +5838,8 @@
{
for_this_tree (Slrn_Current_Header, undelete_header);
}
- slrn_header_down_n (1, 0);
+ if (Slrn_Move_After_Article_Delete)
+ slrn_header_down_n (1, 0);
Slrn_Full_Screen_Update = 1;
}
@@ -5852,7 +5858,8 @@
{
for_this_tree (Slrn_Current_Header, delete_header);
}
- slrn_next_unread_header ();
+ if (Slrn_Move_After_Article_Delete)
+ slrn_next_unread_header ();
Slrn_Full_Screen_Update = 1;
}
@@ -6899,9 +6906,12 @@
SLsmg_write_char ('[');
slrn_set_color (AUTHOR_COLOR);
- SLsmg_write_nchars (h->realname,
- (h->realname_len > 15) ?
- 15 : h->realname_len);
+ if (Slrn_Show_Real_Name)
+ SLsmg_write_nchars (h->realname,
+ (h->realname_len > 15) ?
+ 15 : h->realname_len);
+ else
+ SLsmg_printf ("%-15.15s", h->from);
SLsmg_set_color (0);
SLsmg_gotorc (row, 24 + UPDATE_COLUMN_OFFSET);
@@ -6952,12 +6962,24 @@
}
slrn_set_color (SUBJECT_COLOR);
- SLsmg_write_string (h->subject);
+ if ((Slrn_Show_Thread_Subject)
+ /* || (0 == h->num_children) */
+ || (h->parent == NULL)
+ || (row == 1)
+ || check_subject (h))
+ SLsmg_write_string (h->subject);
+ else
+ SLsmg_write_string (">"); /* subthread */
if (Slrn_Show_Author)
{
SLsmg_gotorc (row, 50 + UPDATE_COLUMN_OFFSET);
slrn_set_color (AUTHOR_COLOR);
- SLsmg_printf (" %s", h->from);
+ if (Slrn_Show_Real_Name) {
+ SLsmg_write_nchars (" ",2);
+ SLsmg_write_nchars (h->realname, h->realname_len);
+ } /*if*/
+ else
+ SLsmg_printf (" %s", h->from);
SLsmg_erase_eol ();
}
}
--
Ian T Zimmerman <itz@rahul.net>
I fully support the President's proposal to test driver's license
applicants for drugs. Any plan to reduce driving is worth a try.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads