]> andersk Git - moira.git/commitdiff
fix bug with -nomenu and one-character input fields ([15776] in bugs)
authordanw <danw>
Sun, 8 Feb 1998 20:16:38 +0000 (20:16 +0000)
committerdanw <danw>
Sun, 8 Feb 1998 20:16:38 +0000 (20:16 +0000)
clients/moira/menu.c

index b0a9a18528c4060c23594e4ef8381097db920c3f..b04ed17cc198b26ae4726489cb486937747d888c 100644 (file)
@@ -524,12 +524,15 @@ int Prompt_input(char *prompt, char *buf, int buflen)
       refresh_ms(cur_ms);
       *p = '\0';
       Start_paging();
-      goto gotit;
+      strcpy(buf, strtrim(buf));
+      return 1;
     }
   else
     {
+      char bigbuf[BUFSIZ];
+
       printf("%s", prompt);
-      if (!fgets(buf, buflen, stdin))
+      if (!fgets(bigbuf, BUFSIZ, stdin))
        return 0;
       if (interrupt)
        {
@@ -537,11 +540,13 @@ int Prompt_input(char *prompt, char *buf, int buflen)
          return 0;
        }
       Start_paging();
-      goto gotit;
+      strncpy(buf, strtrim(bigbuf), buflen);
+      if (strchr(buf, '\n'))
+       *strchr(buf, '\n') = '\0';
+      else
+       buf[buflen - 1] = '\0';
+      return 1;
     }
-gotit:
-  strcpy(buf, strtrim(buf));
-  return 1;
 }
 
 int lines_left;
This page took 0.041571 seconds and 5 git commands to generate.