Teach libc5 what a sighandler_t is
[oweals/busybox.git] / shell / cmdedit.c
index 3b47504558b0dae95b83d1e2b1b2f873eab88af8..16ec2f823323491ff3cdedad97c073bb5f976d51 100644 (file)
@@ -164,6 +164,10 @@ static int my_gid;
 
 #endif /* BB_FEATURE_COMMAND_TAB_COMPLETION */
 
+/* It seems that libc5 doesn't know what a sighandler_t is... */
+#if (__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1)
+typedef void (*sighandler_t) (int);
+#endif
 
 static void cmdedit_setwidth(int w, int redraw_flg);
 
@@ -1167,25 +1171,21 @@ int cmdedit_read_input(char *prompt, char command[BUFSIZ])
        len = 0;
        command_ps = command;
 
-       if (new_settings.c_cc[VERASE] == 0) {     /* first call */
-
-               getTermSettings(0, (void *) &initial_settings);
-               memcpy(&new_settings, &initial_settings, sizeof(struct termios));
-               new_settings.c_lflag &= ~ICANON;        /* unbuffered input */
-               /* Turn off echoing and CTRL-C, so we can trap it */
-               new_settings.c_lflag &= ~(ECHO | ECHONL | ISIG);
+       getTermSettings(0, (void *) &initial_settings);
+       memcpy(&new_settings, &initial_settings, sizeof(struct termios));
+       new_settings.c_lflag &= ~ICANON;        /* unbuffered input */
+       /* Turn off echoing and CTRL-C, so we can trap it */
+       new_settings.c_lflag &= ~(ECHO | ECHONL | ISIG);
 #ifndef linux
-               /* Hmm, in linux c_cc[] not parsed if set ~ICANON */
-               new_settings.c_cc[VMIN] = 1;
-               new_settings.c_cc[VTIME] = 0;
-               /* Turn off CTRL-C, so we can trap it */
+       /* Hmm, in linux c_cc[] not parsed if set ~ICANON */
+       new_settings.c_cc[VMIN] = 1;
+       new_settings.c_cc[VTIME] = 0;
+       /* Turn off CTRL-C, so we can trap it */
 #       ifndef _POSIX_VDISABLE
 #               define _POSIX_VDISABLE '\0'
 #       endif
-               new_settings.c_cc[VINTR] = _POSIX_VDISABLE;     
+       new_settings.c_cc[VINTR] = _POSIX_VDISABLE;     
 #endif
-       }
-
        command[0] = 0;
 
        setTermSettings(0, (void *) &new_settings);
@@ -1232,7 +1232,7 @@ int cmdedit_read_input(char *prompt, char command[BUFSIZ])
                         * if the len=0 and no chars to delete */
                        if (len == 0) {
 prepare_to_die:
-#if !defined(BB_FEATURE_ASH)
+#if !defined(BB_ASH)
                                printf("exit");
                                goto_new_line();
                                /* cmdedit_reset_term() called in atexit */