*/
#include <stdarg.h>
+#include <stdint.h>
#include <unistd.h>
#include "fprintf.h"
int _fdout = STDOUT_FILENO;
int _fderr = STDERR_FILENO;
-inline unsigned int nextpow (unsigned int x, int base) {
+unsigned int nextpow (unsigned int x, int base) {
unsigned int n = 0;
while (x) {
n++;
case 'x': /* integer hexa */
if (!p) {
u = va_arg (ap, unsigned int);
- p = (void *)u;
if (sz == 0) {
sz = nextpow (u, 16);
}
+ } else {
+ u = (uintptr_t)p;
}
for (i = sz, t = 1; i > 0; i--) {
- char x = (char)(((uintptr_t)p >> (i * 4 - 4)) & 0xf);
+ char x = (char)((u >> (i * 4 - 4)) & 0xf);
if ((t == 1) && (x == 0)) {
*str++ = w;
} else {
/* output string */
int n = str - buffer;
if (n < (int)sizeof (buffer) - 1) {
- write (fd, buffer, n);
- return n;
+ return write (fd, buffer, n);
}
return 0;
}