Peter Valchev <[EMAIL PROTECTED]> wrote: > 9libs-1.0p3 totally busted wrt varargs, etc
$OpenBSD$ --- libplan9c/doprint.c.orig Sat Oct 22 14:20:16 2005 +++ libplan9c/doprint.c Sat Oct 22 16:19:03 2005 @@ -97,12 +97,14 @@ fmtinstall(int c, int (*f)(void *, Fconv char * doprint(char *s, char *es, char *format, void *argp) { - va_list ap = argp; + va_list ap; int c; int percent = 0; int dot = 0; Fconv f; + va_copy(ap, argp); + while (s < es && (c = *format++) != 0) { if (!percent && c != '%') { *s++ = c; @@ -293,10 +295,12 @@ numbconv(void *o, Fconv *fp) char buf[80]; /* arbitrary limit. enough digits, but no limit on f2 */ char *s = buf+sizeof(buf)-1; char sign = 0; - va_list ap = o; + va_list ap; int uc = 0; unsigned long u; + va_copy(ap, o); + if (fp->f3 & FL_UNSIGNED) { if (fp->f3 & FL_LONG) u = va_arg(ap, unsigned long); But this fixes only two errors. There are two more left. Both of the same type, arithmetics on va_lists (ap is va_list and r is int): return ap-(va_list)o; and ap += r; Other plan9 ports return 0 from numbconv function (this is where these two errors happen). Like this one: http://swtch.com/usr/local/plan9/9pm/src/libc/port/doprint.c which is described here: http://swtch.com/usr/local/plan9/9pm/README.html So maybe it's time to use "Plan9 from User Space": http://swtch.com/plan9port Alek -- Po tych słowach wszyscy się zgodzili, żeby nie robić na tym zebraniu wielkiej pijatyki, ale tak sobie pić, aby było przyjemnie. - Otóż wobec tego - powiedział Eryksjmachos - żeśmy uchwalili pić, ile kto zechec, a przymusu żadnego nie będzie [...] -- Platon, Dialogi