[815] in Zephyr_Bugs

home help back first fref pref prev next nref lref last post

readline support in zwrite

daemon@ATHENA.MIT.EDU (meem)
Thu Aug 29 23:16:50 1996

Date: Thu, 29 Aug 1996 22:17:28 -0500
From: meem <meem@[204.249.102.78]>
To: bug-zephyr@MIT.EDU
Reply-To: meem@sherilyn.wustl.edu

hi,

i found myself really wanting GNU readline support in zwrite, so i
decided to patch it in.  i'm hoping someone can integrate this in so
all users have readline enabled if their systems support it.

here's the cheapest patch i could think of:

 
--- zwrite.c~   Fri Jul  7 17:03:57 1995
+++ zwrite.c    Thu Aug 29 22:02:17 1996
@@ -19,2 +19,6 @@
 
+#ifdef HAVE_READLINE
+#include <readline/readline.h>
+#endif /* HAVE_READLINE */
+
 #ifndef lint
@@ -273,4 +277,13 @@
                unsigned int l;
+#ifdef HAVE_READLINE
+               char *rdln_buf;
+               if ((rdln_buf = readline("")) == NULL)
+                   break;
+               strncpy(bfr, rdln_buf, sizeof bfr - 1);
+               strcat(bfr, "\n");
+               free(rdln_buf);
+#else  /* not HAVE_READLINE */
                if (!fgets(bfr, sizeof bfr, stdin))
                    break;
+#endif /* HAVE_READLINE */
                if (!nodot && bfr[0] == '.' &&


then ./configure would need to #define HAVE_READLINE if appropriate,
and zwrite's Makefile.in would need to conditionally link with
-lreadline (and -lncurses or -ltermcap)

meem

-- 
::  meem@sherilyn.wustl.edu  ::  voice 314/935-1353 ::  pager 800/652-2699  ::
::   pgp fingerprint:   E7 E8 1A 95 F2 06 6A D6   6A 11 44 D6 6A 6B 93 9B   ::
:: GCS v3.12: a--- C+++ UL++++ US+++ UB+++ P++ L+++>++++++ E+>+++ W+ N++ K+ ::
::            w+ O@ M- V- PS+ Y+ PGP++ t+ 5 X R- tv- b DI++ D+ G h+ r- z-   ::

home help back first fref pref prev next nref lref last post