/*-
* Copyright (c) 1998 Robert Nordier
* Copyright (c) 2010 Pawel Jakub Dawidek <pjd@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms are freely
* permitted provided that the above copyright notice and this
* paragraph and the following disclaimer are duplicated in all
* such forms.
*
* This software is provided "AS IS" and without any express or
* implied warranties, including, without limitation, the implied
* warranties of merchantability and fitness for a particular
* purpose.
*/
__FBSDID("$FreeBSD$");
#include <stdarg.h>
#include "cons.h"
#include "util.h"
void
{
const char *s = src;
char *d = dst;
while (len--)
*d++ = *s++;
}
void
{
char *bp = b;
while (len--)
*bp++ = (unsigned char)c;
}
int
{
}
return (0);
}
int
{
;
}
int
{
;
}
void
{
while (*src != '\0')
*dst = '\0';
}
void
{
while (*dst != '\0')
dst++;
while (*src != '\0')
*dst = '\0';
}
char *
{
for (; *s != '\0'; s++) {
if (*s == ch)
return ((char *)(uintptr_t)(const void *)s);
}
return (NULL);
}
strlen(const char *s)
{
while (*s++ != '\0')
len++;
return (len);
}
int
{
unsigned long long u;
int c, l;
while ((c = *fmt++) != '\0') {
if (c != '%') {
putchar(c);
continue;
}
l = 0;
c = *fmt++;
switch (c) {
case 'l':
l++;
goto nextfmt;
case 'c':
break;
case 's':
putchar(*s);
break;
case 'd': /* A lie, always prints unsigned */
case 'u':
case 'x':
switch (l) {
case 2:
break;
case 1:
break;
default:
break;
}
s = buf;
if (c == 'd' || c == 'u') {
do
*s++ = '0' + (u % 10U);
while (u /= 10);
} else {
do
*s++ = hex[u & 0xfu];
while (u >>= 4);
}
while (--s >= buf)
putchar(*s);
break;
}
}
return (0);
}