nmh-workers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] GNU readline whatnowproc (was tab completion)


From: Peter Maydell
Subject: Re: [Nmh-workers] GNU readline whatnowproc (was tab completion)
Date: Sun, 19 Dec 2010 17:14:03 +0000

address@hidden wrote:
>Okay then, "made it work for me" patch enclosed.  I'm outa time
>for now.  I'll contribute one that uses an autoconf probe soon--I'm
>assuming even troglodytes won't vote for a ./configure flag.
 
>+#include <readline/readline.h>
>+#include <readline/history.h>

NB that the GNU readline library is GPL, not LGPL. That means
that any binary linked against it is distributable only under
GPL rules. (That's possible because nmh's license is 3-clause
BSD, which is compatible.) 

If we care about that there are some BSD-ish licensed equivalents
available, google tells me.

>@@ -54,6 +57,7 @@
>           continue;
>       }
>       cpp = brkstring (ansbuf, " ", NULL);
>+printf("brkstring said \"%s\"\n", *cpp);

...we can lose the debug tracing :-)

>@@ -69,6 +73,39 @@
> }
> 
> 
>+char **
>+getans_via_readline (char *prompt, struct swit *ansp)
>+{
>+    SIGNAL_HANDLER istat = NULL;

I think you can drop all the signal handling here.

>+    char *ans, **cpp;
>+
>+    for (;;) {
>+        ans = readline (prompt);
>+        if (ans[0] == '?' || ans[0] == 0 ) {
>+            printf ("Options are:\n");
>+            print_sw (ALL, ansp, "");
>+            free(ans);
>+          continue;
>+        }
>+      strcpy (ansbuf,ans); /* not sure why--but it makes brkstring() work */
>+        cpp = brkstring (ansbuf, " ", NULL);

...so what happens if you don't strcpy but just pass ans to
brkstring()? I can't see anything in brkstring() that cares,
and it would be nice to avoid the fixed ansbuf[] buffer.

-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]