* monitor.c (monitor_load_srec monitor_make_srec): Move all
[binutils-gdb.git] / gdb / serial.c
index 5efd5b70cef33d3f6f092b4fb3fad2bd86341646..ea886a6a3c92ec7835c453adff31dbe485ab5ff2 100644 (file)
@@ -15,10 +15,11 @@ GNU General Public License for more details.
 
 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 */
 
@@ -306,6 +307,35 @@ connect_command (args, fromtty)
 }
 #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 ()
 {