You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "defs.h"
#include "serial.h"
+#include "gdb_string.h"
/* Linked list of serial I/O handlers */
static serial_t last_serial_opened = NULL;
+/* Pointer to list of scb's. */
+
+static serial_t scb_base;
+
static struct serial_ops *
serial_interface_lookup (name)
char *name;
}
void
-serial_close(scb)
+serial_close(scb, really_close)
serial_t scb;
+ int really_close;
{
serial_t tmp_scb;
if (scb->refcnt > 0)
return;
- scb->ops->close (scb);
+ if (really_close)
+ scb->ops->close (scb);
if (scb->name)
free (scb->name);
}
#endif /* 0 */
+/* VARARGS */
+void
+#ifdef ANSI_PROTOTYPES
+serial_printf (serial_t desc, const char *format, ...)
+#else
+serial_printf (va_alist)
+ va_dcl
+#endif
+{
+ va_list args;
+ char *buf;
+#ifdef ANSI_PROTOTYPES
+ va_start (args, format);
+#else
+ serial_t desc;
+ char *format;
+
+ va_start (args);
+ desc = va_arg (args, serial_t);
+ format = va_arg (args, char *);
+#endif
+
+ vasprintf (&buf, format, args);
+ SERIAL_WRITE (desc, buf, strlen (buf));
+
+ free (buf);
+ va_end (args);
+}
+
void
_initialize_serial ()
{