ppc64: Don't set Kp bit on SLB
[openbios/afaerber.git] / libc / extra.c
blob85731ade9861977a647de2ac27a5ef78fe9035a1
1 /*
2 * Creation Date: <2003/10/18 13:52:32 samuel>
3 * Time-stamp: <2003/10/18 13:54:24 samuel>
5 * <extra.c>
7 * Libc extras
9 * Copyright (C) 2003 Samuel Rydh (samuel@ibrium.se)
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * version 2
17 #include "config.h"
18 #include "libc/string.h"
19 #include "libc/vsprintf.h"
20 #include "libopenbios/bindings.h"
22 /* strncpy without 0-pad */
23 char *
24 strncpy_nopad( char *dest, const char *src, size_t n )
26 int len = MIN( n, strlen(src)+1 );
27 return memcpy( dest, src, len );
30 /* printf */
32 int forth_printf( const char *fmt, ... )
34 char buf[512];
35 va_list args;
36 int i;
38 va_start(args, fmt);
39 i = vsnprintf(buf, sizeof(buf), fmt, args);
40 va_end(args);
42 PUSH(pointer2cell(buf));
43 PUSH(i);
44 fword("type");
46 return i;