* remote-udi.c (udi_wait, case UDIStdinNeeded): Use a loop calling
authorJim Kingdon <jkingdon@engr.sgi.com>
Thu, 9 Sep 1993 17:58:46 +0000 (17:58 +0000)
committerJim Kingdon <jkingdon@engr.sgi.com>
Thu, 9 Sep 1993 17:58:46 +0000 (17:58 +0000)
getchar() (terminated only on '\n') instead of scanf.  Send the
'\n' which terminates it to the remote system.

gdb/remote-udi.c

index 20e8d262c570962a5ef3a9efe1803c4a8952788d..3fa2da9b9756ee8715009c356de34359ac59498f 100644 (file)
@@ -473,11 +473,22 @@ udi_wait (status)
          fwrite (sbuf, 1, CountDone, stderr);
          fflush(stderr);
          continue;
+
        case UDIStdinNeeded:
-         scanf ("%s", sbuf);
-         i = strlen (sbuf);
-         UDIPutStdin (sbuf, (UDISizeT)i, &CountDone);
-         continue;
+         {
+           int ch;
+           i = 0;
+           do
+             {
+               ch = getchar ();
+               if (ch == EOF)
+                 break;
+               sbuf[i++] = ch;
+             } while (i < SBUF_MAX && ch != '\n');
+           UDIPutStdin (sbuf, (UDISizeT)i, &CountDone);
+           continue;
+         }
+
        case UDIRunning:
          /* In spite of the fact that we told UDIWait to wait forever, it will
             return spuriously sometimes.  */