]> git.ipfire.org Git - thirdparty/readline.git/commitdiff
fix for setting RL_STATE_EOF in callback mode
authorChet Ramey <chet.ramey@case.edu>
Wed, 4 May 2022 15:18:04 +0000 (11:18 -0400)
committerChet Ramey <chet.ramey@case.edu>
Wed, 4 May 2022 15:18:04 +0000 (11:18 -0400)
callback.c
doc/rltech.texi
examples/excallback.c
examples/fileman.c
examples/rl-callbacktest.c
examples/rl.c
examples/rlbasic.c
examples/rlcat.c
examples/rlevent.c
examples/rlptytest.c
examples/rltest.c

index 1a3235f1990eeec168bd82395ce30b31329e7ae5..69df77df709590dcbbec9f05c263d96826f0411a 100644 (file)
@@ -279,8 +279,11 @@ rl_callback_read_char (void)
        }
 
       /* Make sure application hooks can see whether we saw EOF. */
-      if (rl_eof_found = eof)
-       RL_SETSTATE(RL_STATE_EOF);
+      if (eof > 0)
+       {
+         rl_eof_found = eof;
+         RL_SETSTATE(RL_STATE_EOF);
+       }
 
       if (rl_done)
        {
index 6f7ffb931a54bc0cd74174b5e844e74d848f1d88..fe64a42cbfd1bc76d22fa615ac809b79655cb4b1 100644 (file)
@@ -2368,6 +2368,7 @@ history list.
 #include <fcntl.h>
 #include <stdio.h>
 #include <errno.h>
+#include <locale.h>
 
 #if defined (HAVE_STRING_H)
 #  include <string.h>
@@ -2448,6 +2449,8 @@ main (argc, argv)
 @{
   char *line, *s;
 
+  setlocale (LC_ALL, "");
+
   progname = argv[0];
 
   initialize_readline ();      /* Bind our completer. */
index 4206acfca4a518c8081d1e5389e2fdcb1b51bb8c..923c9238b6ecaf9d799171ec6aa9002f4089c1a5 100644 (file)
@@ -50,6 +50,8 @@ Copyright (C) 1999 Jeff Solomon
 #include <stdio.h>
 #include <termios.h>   /* xxx - should make this more general */
 
+#include <locale.h>
+
 #ifdef READLINE_LIBRARY
 #  include "readline.h"
 #else
@@ -104,6 +106,8 @@ main()
 {
     fd_set fds;
 
+    setlocale (LC_ALL, "");
+
     /* Adjust the terminal slightly before the handler is installed. Disable
      * canonical mode processing and set the input character time flag to be
      * non-blocking.
index f8d0be73eef1cba00906cb919b133783063c66a0..2a8b097ad146b74abce85369c906a6cf426280ac 100644 (file)
@@ -417,7 +417,7 @@ com_help (arg)
 
   if (!printed)
     {
-      printf ("No commands match `%s'.  Possibilties are:\n", arg);
+      printf ("No commands match `%s'.  Possibilities are:\n", arg);
 
       for (i = 0; commands[i].name; i++)
         {
index 3525ffd99935c4d3e841a1a69ca703adede08451..4373398bd84c8a0e3c5654eaf58b141c1ce407c2 100644 (file)
@@ -2,7 +2,6 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
-#include <locale.h>
 
 /* Used for select(2) */
 #include <sys/types.h>
 #include <errno.h>
 #include <stdio.h>
 
+#ifdef HAVE_LOCALE_H
+#  include <locale.h>
+#endif
+
 /* Standard readline include files. */
 #if defined (READLINE_LIBRARY)
 #  include "readline.h"
@@ -72,7 +75,6 @@ main (int c, char **v)
   fd_set fds;
   int r;
 
-
   setlocale (LC_ALL, "");
 
   /* Handle SIGWINCH */
index a5cf276cb943afcf88a12691c2d7c160dcb11262..39e5b8ebb5d1be6b748a9d8bab3d3feb190e0784 100644 (file)
 extern void exit();
 #endif
 
+#ifdef HAVE_LOCALE_H
+#  include <locale.h>
+#endif
+
 #if defined (READLINE_LIBRARY)
 #  include "posixstat.h"
 #  include "readline.h"
@@ -93,6 +97,10 @@ main (argc, argv)
   else
     progname++;
 
+#ifdef HAVE_SETLOCALE
+  setlocale (LC_ALL, "");
+#endif
+
   /* defaults */
   prompt = "readline$ ";
   fd = nch = 0;
index 6a9601f52a699caa033273abf85e9689406ad07a..1ce4da973d902005e25672cd7838fc6614e3cd9a 100644 (file)
@@ -3,6 +3,10 @@
 #include <stdio.h>
 #include <string.h>
 
+#ifdef HAVE_LOCALE_H
+#  include <locale.h>
+#endif
+
 #if defined (READLINE_LIBRARY)
 #  include "readline.h"
 #  include "history.h"
@@ -16,6 +20,10 @@ main (int c, char **v)
 {
        char *input;
 
+#ifdef HAVE_SETLOCALE
+       setlocale (LC_ALL, "");
+#endif
+
        for (;;) {
                input = readline ((char *)NULL);
                if (input == 0)
index b4942413f8bebb6d08b83e035ce7dde3a9c52bf7..aabe0ca3e98673179a77d0f647122639e3028fa9 100644 (file)
 extern void exit();
 #endif
 
+#ifdef HAVE_LOCALE_H
+#  include <locale.h>
+#endif
+
 #ifndef errno
 extern int errno;
 #endif
@@ -79,6 +83,10 @@ main (argc, argv)
   char *temp;
   int opt, Vflag, Nflag;
 
+#ifdef HAVE_SETLOCALE
+  setlocale (LC_ALL, ""):
+#endif
+
   progname = strrchr(argv[0], '/');
   if (progname == 0)
     progname = argv[0];
index 8143cb02aa0742a4dd4e040515a11bcdb6740138..1b7f4eb25a433f8bcd4a872313c99129f06d044d 100644 (file)
@@ -44,6 +44,10 @@ extern int sleep();
 extern void exit();
 #endif
 
+#ifdef HAVE_LOCALE_H
+#  include <locale.h>
+#endif
+
 #if defined (READLINE_LIBRARY)
 #  include "posixstat.h"
 #  include "readline.h"
@@ -101,6 +105,10 @@ main (argc, argv)
   int opt, fd, nch;
   FILE *ifp;
 
+#ifdef HAVE_SETLOCALE
+  setlocale (LC_ALL, "");
+#endif
+
   progname = strrchr(argv[0], '/');
   if (progname == 0)
     progname = argv[0];
index 9c42f8a2795385dc0ae49eb339264a72f77f8ead..0008dd1fca9331ed07952aceca0d5f770777e2dd 100644 (file)
 #include <util.h>
 #endif
 
+#ifdef HAVE_LOCALE_H
+#  include <locale.h>
+#endif
+
 #ifdef READLINE_LIBRARY
 #  include "readline.h"
 #else
@@ -315,6 +319,11 @@ int
 main()
 {
   int val;
+
+#ifdef HAVE_SETLOCALE
+  setlocale (LC_ALL, "");
+#endif
+
   val = openpty (&masterfd, &slavefd, NULL, NULL, NULL);
   if (val == -1)
     return -1;
index 65abe87cc044d39175d58408d60ad27674c3e8be..8b7c00c8c49a0e7f071c09f1d93d818b597afd23 100644 (file)
 extern void exit();
 #endif
 
+#ifdef HAVE_LOCALE_H
+#  include <locale.h>
+#endif
+
 #ifdef READLINE_LIBRARY
 #  include "readline.h"
 #  include "history.h"
@@ -52,6 +56,10 @@ main ()
   char *temp, *prompt;
   int done;
 
+#ifdef HAVE_SETLOCALE
+  setlocale (LC_ALL, "");
+#endif
+
   temp = (char *)NULL;
   prompt = "readline$ ";
   done = 0;