Home | History | Annotate | Line # | Download | only in sgimips
      1 /*	$NetBSD: prom.c,v 1.1 2026/06/11 00:21:35 rumble Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 2025 Stephen M. Rumble <rumble (at) ephemeral.org>
      5  *
      6  * Permission to use, copy, modify, and distribute this software for any
      7  * purpose with or without fee is hereby granted, provided that the above
      8  * copyright notice and this permission notice appear in all copies.
      9  *
     10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     17  */
     18 
     19 #include <sys/systm.h>
     20 
     21 #include <sgimips/sgimips/prom.h>
     22 
     23 /*
     24  * Print a pre-formatted string using the PROM's printf vector. This wrapper
     25  * avoids limitations that might exist in the PROM's supported format options,
     26  * number of arguments, etc.
     27  */
     28 int
     29 sgi_prom_printf(const char *fmt, ...)
     30 {
     31 	char buf[512];
     32 	va_list ap;
     33 	va_start(ap, fmt);
     34 	vsnprintf(buf, sizeof(buf), fmt, ap);
     35 	va_end(ap);
     36 	extern int sgi_prom_printf_direct(const char*, ...);
     37 	return sgi_prom_printf_direct("%s", buf);
     38 }
     39