* cp-valprint.c (static_field_print): New variable, controls
[deliverable/binutils-gdb.git] / gdb / ser-mac.c
index f8a2291413fe16d3597b17c528038f8ed31b2450..95c2481cf54e5ee888cb303e32fc6415ad47dfec 100644 (file)
@@ -1,5 +1,6 @@
 /* Remote serial interface for local (hardwired) serial ports for Macintosh.
    Copyright 1994 Free Software Foundation, Inc.
+   Contributed by Cygnus Support.  Written by Stan Shebs.
 
    This file is part of GDB.
 
@@ -22,7 +23,9 @@
 
 #include <Types.h>
 #include <Devices.h>
-#include <Serial.h>
+/* This is the regular Mac Serial.h, but copied to a different name
+   so as not to get confused with the GDB serial.h above.  */
+#include "MacSerial.h"
 
 /* This is unused for now.  We just return a placeholder. */
 
@@ -92,6 +95,7 @@ mac_open (scb, name)
     }
   else
     {
+      error ("You must specify a port.  Choices are `modem' or `printer'.");
       errno = ENOENT;
       return (-1);
     }
@@ -150,7 +154,7 @@ mac_readchar (scb, timeout)
      int timeout;
 {
   int status, n;
-  /* time_t */ unsigned long starttime, now;
+  /* time_t */ unsigned long start_time, now;
   OSErr err;
   CntrlParam cb;
   IOParam pb;
@@ -158,7 +162,7 @@ mac_readchar (scb, timeout)
   if (scb->bufcnt-- > 0)
     return *scb->bufp++;
 
-  time (&starttime);
+  time (&start_time);
 
   while (1)
     {
@@ -188,10 +192,8 @@ mac_readchar (scb, timeout)
       else
        {
          time (&now);
-         if (now > starttime + timeout) {
-           printf_unfiltered ("start %u, now %u, timeout %d\n", starttime, now, timeout);
+         if (now > start_time + timeout)
            return SERIAL_TIMEOUT;
-         }
        }
     }
 }
@@ -244,6 +246,8 @@ mac_set_baud_rate (scb, rate)
   return 0;
 }
 
+int first_mac_write = 0;
+
 static int
 mac_write (scb, str, len)
      serial_t scb;
@@ -253,6 +257,10 @@ mac_write (scb, str, len)
   OSErr err;
   IOParam pb;
 
+  if (first_mac_write++ < 4)
+    {
+      sec_sleep (1);
+    }
   pb.ioRefNum = output_refnum;
   pb.ioBuffer = (Ptr) str;
   pb.ioReqCount = len;
@@ -264,9 +272,22 @@ mac_write (scb, str, len)
   return 0;
 }
 
+sec_sleep (int timeout)
+{
+  unsigned long start_time, now;
+
+  time (&start_time);
+
+  while (1)
+    {
+      time (&now);
+      if (now > start_time + timeout)
+       return;
+    }
+}
+
 static void
-mac_close (scb)
-     serial_t scb;
+mac_close (serial_t scb)
 {
   if (input_refnum)
     {
This page took 0.024833 seconds and 4 git commands to generate.