prom_printf.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1995-1996, by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/promimpl.h>
/*
* Emit character functions...
*/
static void
{
while (prom_write(prom_stdout_ihandle(),
;
}
static void
_sput(char c, char **p)
{
**p = c;
*p += 1;
}
/*VARARGS1*/
void
prom_printf(const char *fmt, ...)
{
}
void
{
}
/*VARARGS2*/
char *
prom_sprintf(char *s, const char *fmt, ...)
{
char *bp = s;
*bp++ = (char)0;
return (s);
}
char *
{
char *bp = s;
*bp++ = (char)0;
return (s);
}
static void
{
char *s, *start;
int64_t l;
if (bp == 0) {
}
loop:
width = 0;
while ((c = *fmt++) != '%') {
if (c == '\0')
goto out;
if (c == '\n') {
}
} else
}
}
c = *fmt++;
pad = '0';
ells++;
switch (c) {
case 'd':
case 'D':
b = 10;
if (ells == 0)
else if (ells == 1)
else
if (l < 0) {
width--;
ul = -l;
} else
ul = l;
goto number;
case 'p':
ells = 1;
/*FALLTHROUGH*/
case 'x':
case 'X':
b = 16;
goto u_number;
case 'u':
b = 10;
goto u_number;
case 'o':
case 'O':
b = 8;
if (ells == 0)
else if (ells == 1)
else
break;
case 'c':
for (i = 24; i >= 0; i -= 8)
if ((c = ((b >> i) & 0x7f)) != 0) {
if (c == '\n')
}
break;
case 's':
while ((c = *s++) != 0) {
if (c == '\n')
}
}
break;
case '%':
break;
}
}
goto loop;
out:
}
/*
* Printn prints a number n in base b.
* We don't use recursion to avoid deep kernel stacks.
*/
static void
{
char prbuf[40];
char *cp;
do {
*cp++ = "0123456789abcdef"[n%b];
n /= b;
width--;
} while (n);
while (width-- > 0)
do {
}