Enclosed is a patch to provide "hit any key" prompts when displaying multipart
mime messages. In certain contexts, which have become common now that I use
-attach, I really don't like the default "Press <return> to show content"
behavior.
If someone is willing to fold this into the source, please let me know and
I'll add --enable-noncanonical-prompts-for-multipart-mime-messages or somesuch.
steve
--
--- termsbr.c.orig 2008-04-11 09:12:55.000000000 -0500
+++ termsbr.c 2010-12-19 08:11:30.000000000 -0600
@@ -234,3 +234,23 @@
return HC;
}
+
+/*
+ * read one character
+ */
+int
+noncanonical_getchar(void)
+{
+ struct termios o, n;
+ char c;
+
+ ioctl(0,TCGETS,&o);
+ n = o;
+ n.c_lflag &= ~ECHO;
+ n.c_lflag &= ~ICANON;
+ ioctl(0,TCSETS,&n);
+ read(0,&c,1);
+ ioctl(0,TCSETS,&o);
+ return (int)c;
+}
+
--- mhshowsbr.c.orig 2008-04-11 09:12:55.000000000 -0500
+++ mhshowsbr.c 2010-12-19 08:51:18.000000000 -0600
@@ -55,6 +55,7 @@
/* termsbr.c */
int SOprintf (char *, ...);
+int noncanonical_getchar (void);
/* mhparse.c */
int pidcheck (int);
@@ -555,6 +556,7 @@
else
list_switch (ct, -1, 1, 0, 0);
+#ifndef NONCANONICAL_PROMPT
if (xpause && SOprintf ("Press <return> to show content..."))
printf ("Press <return> to show content...");
@@ -574,7 +576,31 @@
return (alternate ? DONE : NOTOK);
}
if (prompt[0] == 'q') done(OK);
+ }
+#else
+ if (xpause && SOprintf ("Press any key to show content..."))
+ printf ("Press any key to show content...");
+
+ if (xpause) {
+ int intr, i;
+ SIGNAL_HANDLER istat;
+
+ istat = SIGNAL (SIGINT, intrser);
+ if ((intr = sigsetjmp (intrenv, 1)) == OK) {
+ fflush (stdout);
+ i = noncanonical_getchar();
+ }
+ SIGNAL (SIGINT, istat);
+ if (intr != OK ) {
+ (*ct->c_ceclosefnx) (ct);
+ return (alternate ? DONE : NOTOK);
+ }
+ if (i == 113) { /* 'q' for quit */
+ printf("\n");
+ done(OK);
+ }
}
+#endif
}
snprintf (exec, sizeof(exec), "exec %s", buffer);
_______________________________________________
Nmh-workers mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/nmh-workers