]> Sergey Matveev's repositories - nnn.git/commitdiff
Get rid of getchar()
authorArun Prakash Jana <engineerarun@gmail.com>
Sat, 29 May 2021 09:28:55 +0000 (14:58 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Sat, 29 May 2021 09:45:27 +0000 (15:15 +0530)
src/nnn.c

index 9360854924872c930ed31786341f9eb37824a935..e7852d116a8b07b0867f966e4cd8ce9297232fd0 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -567,7 +567,7 @@ static char * const utils[] = {
 #define MSG_NEW_PATH 19
 #define MSG_LINK_PREFIX 20
 #define MSG_COPY_NAME 21
-#define MSG_CONTINUE 22
+#define MSG_RETURN 22
 #define MSG_SEL_MISSING 23
 #define MSG_ACCESS 24
 #define MSG_EMPTY_FILE 25
@@ -2084,10 +2084,10 @@ static int spawn(char *file, char *arg1, char *arg2, char *arg3, uchar_t flag)
                DPRINTF_D(pid);
 
                if ((flag & F_CONFIRM) || ((flag & F_CHKRTN) && retstatus)) {
-                       status = write(STDOUT_FILENO, messages[MSG_CONTINUE],
-                                       xstrlen(messages[MSG_CONTINUE]));
+                       status = write(STDOUT_FILENO, messages[MSG_RETURN], xstrlen(messages[MSG_RETURN]));
+                       (void)status;
+                       status = read(STDIN_FILENO, g_buf, PATH_MAX);
                        (void)status;
-                       while (getchar() != '\n') {};
                }
 
                if (flag & F_NORMAL)