2 * Copyright (c) 1998 Robert Nordier
4 * Copyright (c) 2006 M. Warner Losh
7 * Redistribution and use in source and binary forms are freely
8 * permitted provided that the above copyright notice and this
9 * paragraph and the following disclaimer are duplicated in all
12 * This software is provided "AS IS" and without any express or
13 * implied warranties, including, without limitation, the implied
14 * warranties of merchantability and fitness for a particular
24 printf(const char *fmt,...)
27 const char *hex = "0123456789abcdef";
29 const char *fmt_orig = fmt;
35 while ((c = *fmt++)) {
40 xputchar(va_arg(ap, int));
43 for (s = va_arg(ap, char *); *s; s++)
46 case 'd': /* A lie, always prints unsigned */
48 u = va_arg(ap, unsigned);
58 u = va_arg(ap, unsigned);
70 return (int)(fmt - fmt_orig);