For "askfirst" don't just read one char from stdin,
authorPavel Roskin <proski@gnu.org>
Thu, 14 Sep 2000 22:47:29 +0000 (22:47 -0000)
committerPavel Roskin <proski@gnu.org>
Thu, 14 Sep 2000 22:47:29 +0000 (22:47 -0000)
read the whole line using getc(), so that everything before Enter
gets discarded.

init.c
init/init.c

diff --git a/init.c b/init.c
index 7af8c4a95178aaf9b653de944eb5f0a7c6aedf43..7e821f1102eb86213c5b7c96bab7e5b809f6832b 100644 (file)
--- a/init.c
+++ b/init.c
@@ -448,14 +448,13 @@ static pid_t run(char *command, char *terminal, int get_enter)
                         * be allowed to start a shell or whatever an init script 
                         * specifies.
                         */
-                       char c;
 #ifdef DEBUG_INIT
                        pid_t shell_pgid = getpid();
                        message(LOG, "Waiting for enter to start '%s' (pid %d, console %s)\r\n",
                                        command, shell_pgid, terminal);
 #endif
                        write(fileno(stdout), press_enter, sizeof(press_enter) - 1);
-                       read(fileno(stdin), &c, 1);
+                       getc(stdin);
                }
 
 #ifdef DEBUG_INIT
index 7af8c4a95178aaf9b653de944eb5f0a7c6aedf43..7e821f1102eb86213c5b7c96bab7e5b809f6832b 100644 (file)
@@ -448,14 +448,13 @@ static pid_t run(char *command, char *terminal, int get_enter)
                         * be allowed to start a shell or whatever an init script 
                         * specifies.
                         */
-                       char c;
 #ifdef DEBUG_INIT
                        pid_t shell_pgid = getpid();
                        message(LOG, "Waiting for enter to start '%s' (pid %d, console %s)\r\n",
                                        command, shell_pgid, terminal);
 #endif
                        write(fileno(stdout), press_enter, sizeof(press_enter) - 1);
-                       read(fileno(stdin), &c, 1);
+                       getc(stdin);
                }
 
 #ifdef DEBUG_INIT