Drawterm updates. [rsc] --rw-rw-r-- M 711842 rsc drawterm 493 Jan 17 07:53 sys/src/cmd/unix/drawterm/Make.irix [rsc] --rw-rw-r-- M 711842 rsc drawterm 4755 Jan 17 07:50 sys/src/cmd/unix/drawterm/kern/devroot.c /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/kern/devroot.c:54,59 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/kern/devroot.c:54,60 Nbootfiles }; + static uchar *mntdata[Nmntfiles]; static Dirtab mntdir[Nmntfiles] = { "mnt", {Qmnt, 0, QTDIR}, 0, DMDIR|0555, "factotum", {Qfactotum, 0, QTDIR}, 0, DMDIR|0555, /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/kern/devroot.c:62,68 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/kern/devroot.c:63,69 { Qmnt, mntdir, - nil, + mntdata, 2, Nmntfiles }; [rsc] --rw-rw-r-- M 711842 rsc drawterm 18037 Jan 17 07:50 sys/src/cmd/unix/drawterm/kern/sysfile.c /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/kern/sysfile.c:1158,1164 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/kern/sysfile.c:1158,1164 } int - errfmt(Fmt *fmt) + __errfmt(Fmt *fmt) { if(up->nerrlab) return fmtstrcpy(fmt, up->errstr); [rsc] --rw-rw-r-- M 711842 rsc drawterm 1113 Jan 17 07:53 sys/src/cmd/unix/drawterm/libc/Makefile /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/Makefile:22,27 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/Makefile:22,28 fltfmt.$O\ fmt.$O\ fmtfd.$O\ + fmtfdflush.$O\ fmtlock.$O\ fmtprint.$O\ fmtquote.$O\ [rsc] --rw-rw-r-- M 711842 rsc drawterm 1954 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/charstod.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 9771 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/dofmt.c [diffs elided] [rsc] --rw-rw-r-- M 711842 rsc drawterm 1542 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/dorfmt.c /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/dorfmt.c:1,3 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/dorfmt.c:1,16 + /* + * The authors of this software are Rob Pike and Ken Thompson. + * Copyright (c) 2002 by Lucent Technologies. + * Permission to use, copy, modify, and distribute this software for any + * purpose without fee is hereby granted, provided that this entire notice + * is included in all copies of any software which is or includes a copy + * or modification of this software and in all copies of the supporting + * documentation for such software. + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE + * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + */ #include #include #include "fmtdef.h" /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/dorfmt.c:5,11 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/dorfmt.c:18,24 /* format the output into f->to and return the number of characters fmted */ int - dorfmt(Fmt *f, Rune *fmt) + dorfmt(Fmt *f, const Rune *fmt) { Rune *rt, *rs; int r; /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/dorfmt.c:38,44 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/dorfmt.c:51,57 f->stop = s; } - fmt = _fmtdispatch(f, fmt, 1); + fmt = __fmtdispatch(f, (Rune*)fmt, 1); if(fmt == nil) return -1; } [rsc] --rw-rw-r-- M 711842 rsc drawterm 7053 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/fltfmt.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 4195 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/fmt.c [diffs elided] [rsc] --rw-rw-r-- M 711842 rsc drawterm 3466 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/fmtdef.h [diffs elided] [rsc] --rw-rw-r-- M 711842 rsc drawterm 1294 Jan 17 07:50 sys/src/cmd/unix/drawterm/libc/fmtfd.c /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/fmtfd.c:1,3 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/fmtfd.c:1,17 + /* + * The authors of this software are Rob Pike and Ken Thompson. + * Copyright (c) 2002 by Lucent Technologies. + * Permission to use, copy, modify, and distribute this software for any + * purpose without fee is hereby granted, provided that this entire notice + * is included in all copies of any software which is or includes a copy + * or modification of this software and in all copies of the supporting + * documentation for such software. + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE + * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + */ + #include #include #include #include "fmtdef.h" /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/fmtfd.c:9,15 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/fmtfd.c:23,29 int fmtfdflush(Fmt *f) { - if(_fmtFdFlush(f) <= 0) + if(__fmtFdFlush(f) <= 0) return -1; return f->nfmt; } /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/fmtfd.c:24,31 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/fmtfd.c:38,45 f->start = buf; f->to = buf; f->stop = buf + size; - f->flush = _fmtFdFlush; - f->farg = (void*)fd; + f->flush = __fmtFdFlush; + f->farg = (void*)(uintptr_t)fd; f->nfmt = 0; return 0; } [rsc] --rw-rw-r-- M 711842 rsc drawterm 136 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/fmtlock.c /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/fmtlock.c:4,16 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/fmtlock.c:4,16 static Lock fmtl; void - _fmtlock(void) + __fmtlock(void) { lock(&fmtl); } void - _fmtunlock(void) + __fmtunlock(void) { unlock(&fmtl); } [rsc] --rw-rw-r-- M 711842 rsc drawterm 1261 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/fmtprint.c /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/fmtprint.c:1,8 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/fmtprint.c:1,20 + /* + * The authors of this software are Rob Pike and Ken Thompson. + * Copyright (c) 2002 by Lucent Technologies. + * Permission to use, copy, modify, and distribute this software for any + * purpose without fee is hereby granted, provided that this entire notice + * is included in all copies of any software which is or includes a copy + * or modification of this software and in all copies of the supporting + * documentation for such software. + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE + * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + */ #include #include #include "fmtdef.h" - /* * format a string into the output buffer * designed for formats which themselves call fmt, /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/fmtprint.c:17,23 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/fmtprint.c:29,36 f->flags = 0; f->width = 0; f->prec = 0; - va = f->args; + VA_COPY(va, f->args); + VA_END(f->args); va_start(f->args, fmt); n = dofmt(f, fmt); va_end(f->args); /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/fmtprint.c:24,30 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/fmtprint.c:37,44 f->flags = 0; f->width = 0; f->prec = 0; - f->args = va; + VA_COPY(f->args,va); + VA_END(va); if(n >= 0) return 0; return n; [rsc] --rw-rw-r-- M 711842 rsc drawterm 5514 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/fmtquote.c [diffs elided] [rsc] --rw-rw-r-- M 711842 rsc drawterm 1079 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/fmtrune.c /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/fmtrune.c:1,3 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/fmtrune.c:1,16 + /* + * The authors of this software are Rob Pike and Ken Thompson. + * Copyright (c) 2002 by Lucent Technologies. + * Permission to use, copy, modify, and distribute this software for any + * purpose without fee is hereby granted, provided that this entire notice + * is included in all copies of any software which is or includes a copy + * or modification of this software and in all copies of the supporting + * documentation for such software. + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE + * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + */ #include #include #include "fmtdef.h" /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/fmtrune.c:10,21 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/fmtrune.c:23,34 int n; if(f->runes){ - rt = f->to; + rt = (Rune*)f->to; FMTRCHAR(f, rt, f->stop, r); f->to = rt; n = 1; }else{ - t = f->to; + t = (char*)f->to; FMTRUNE(f, t, f->stop, r); n = t - (char*)f->to; f->to = t; [rsc] --rw-rw-r-- M 711842 rsc drawterm 918 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/fmtstr.c /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/fmtstr.c:1,5 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/fmtstr.c:1,19 + /* + * The authors of this software are Rob Pike and Ken Thompson. + * Copyright (c) 2002 by Lucent Technologies. + * Permission to use, copy, modify, and distribute this software for any + * purpose without fee is hereby granted, provided that this entire notice + * is included in all copies of any software which is or includes a copy + * or modification of this software and in all copies of the supporting + * documentation for such software. + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE + * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + */ #include #include + #include "fmtdef.h" char* fmtstrflush(Fmt *f) /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/fmtstr.c:7,11 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/fmtstr.c:21,25 if(f->start == nil) return nil; *(char*)f->to = '\0'; - return f->start; + return (char*)f->start; } [rsc] --rw-rw-r-- M 711842 rsc drawterm 1270 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/fmtvprint.c /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/fmtvprint.c:1,3 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/fmtvprint.c:1,16 + /* + * The authors of this software are Rob Pike and Ken Thompson. + * Copyright (c) 2002 by Lucent Technologies. + * Permission to use, copy, modify, and distribute this software for any + * purpose without fee is hereby granted, provided that this entire notice + * is included in all copies of any software which is or includes a copy + * or modification of this software and in all copies of the supporting + * documentation for such software. + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE + * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + */ #include #include #include "fmtdef.h" /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/fmtvprint.c:17,29 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/fmtvprint.c:30,45 f->flags = 0; f->width = 0; f->prec = 0; - va = f->args; - f->args = args; + VA_COPY(va,f->args); + VA_END(f->args); + VA_COPY(f->args,args); n = dofmt(f, fmt); f->flags = 0; f->width = 0; f->prec = 0; - f->args = va; + VA_END(f->args); + VA_COPY(f->args,va); + VA_END(va); if(n >= 0) return 0; return n; [rsc] --rw-rw-r-- M 711842 rsc drawterm 945 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/fprint.c /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/fprint.c:1,5 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/fprint.c:1,19 - #include - #include + /* + * The authors of this software are Rob Pike and Ken Thompson. + * Copyright (c) 2002 by Lucent Technologies. + * Permission to use, copy, modify, and distribute this software for any + * purpose without fee is hereby granted, provided that this entire notice + * is included in all copies of any software which is or includes a copy + * or modification of this software and in all copies of the supporting + * documentation for such software. + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE + * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + */ + #include + #include + #include "fmtdef.h" int fprint(int fd, char *fmt, ...) [rsc] --rw-rw-r-- M 711842 rsc drawterm 1051 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/nan64.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 1946 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/pow10.c [diffs elided] [rsc] --rw-rw-r-- M 711842 rsc drawterm 935 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/print.c /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/print.c:1,5 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/print.c:1,19 - #include - #include + /* + * The authors of this software are Rob Pike and Ken Thompson. + * Copyright (c) 2002 by Lucent Technologies. + * Permission to use, copy, modify, and distribute this software for any + * purpose without fee is hereby granted, provided that this entire notice + * is included in all copies of any software which is or includes a copy + * or modification of this software and in all copies of the supporting + * documentation for such software. + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE + * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + */ + #include + #include + #include "fmtdef.h" int print(char *fmt, ...) [rsc] --rw-rw-r-- M 711842 rsc drawterm 915 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/runefmtstr.c /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/runefmtstr.c:1,5 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/runefmtstr.c:1,19 + /* + * The authors of this software are Rob Pike and Ken Thompson. + * Copyright (c) 2002 by Lucent Technologies. + * Permission to use, copy, modify, and distribute this software for any + * purpose without fee is hereby granted, provided that this entire notice + * is included in all copies of any software which is or includes a copy + * or modification of this software and in all copies of the supporting + * documentation for such software. + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE + * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + */ #include #include + #include "fmtdef.h" Rune* runefmtstrflush(Fmt *f) [rsc] --rw-rw-r-- M 711842 rsc drawterm 975 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/runeseprint.c /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/runeseprint.c:1,5 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/runeseprint.c:1,19 + /* + * The authors of this software are Rob Pike and Ken Thompson. + * Copyright (c) 2002 by Lucent Technologies. + * Permission to use, copy, modify, and distribute this software for any + * purpose without fee is hereby granted, provided that this entire notice + * is included in all copies of any software which is or includes a copy + * or modification of this software and in all copies of the supporting + * documentation for such software. + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE + * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + */ #include #include + #include "fmtdef.h" Rune* runeseprint(Rune *buf, Rune *e, char *fmt, ...) [rsc] --rw-rw-r-- M 711842 rsc drawterm 947 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/runesmprint.c /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/runesmprint.c:1,5 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/runesmprint.c:1,19 + /* + * The authors of this software are Rob Pike and Ken Thompson. + * Copyright (c) 2002 by Lucent Technologies. + * Permission to use, copy, modify, and distribute this software for any + * purpose without fee is hereby granted, provided that this entire notice + * is included in all copies of any software which is or includes a copy + * or modification of this software and in all copies of the supporting + * documentation for such software. + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE + * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + */ #include #include + #include "fmtdef.h" Rune* runesmprint(char *fmt, ...) [rsc] --rw-rw-r-- M 711842 rsc drawterm 974 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/runesnprint.c /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/runesnprint.c:1,5 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/runesnprint.c:1,19 + /* + * The authors of this software are Rob Pike and Ken Thompson. + * Copyright (c) 2002 by Lucent Technologies. + * Permission to use, copy, modify, and distribute this software for any + * purpose without fee is hereby granted, provided that this entire notice + * is included in all copies of any software which is or includes a copy + * or modification of this software and in all copies of the supporting + * documentation for such software. + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE + * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + */ #include #include + #include "fmtdef.h" int runesnprint(Rune *buf, int len, char *fmt, ...) [rsc] --rw-rw-r-- M 711842 rsc drawterm 963 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/runesprint.c /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/runesprint.c:1,5 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/runesprint.c:1,19 + /* + * The authors of this software are Rob Pike and Ken Thompson. + * Copyright (c) 2002 by Lucent Technologies. + * Permission to use, copy, modify, and distribute this software for any + * purpose without fee is hereby granted, provided that this entire notice + * is included in all copies of any software which is or includes a copy + * or modification of this software and in all copies of the supporting + * documentation for such software. + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE + * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + */ #include #include + #include "fmtdef.h" int runesprint(Rune *buf, char *fmt, ...) [rsc] --rw-rw-r-- M 711842 rsc drawterm 1115 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/runevseprint.c /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/runevseprint.c:1,5 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/runevseprint.c:1,19 + /* + * The authors of this software are Rob Pike and Ken Thompson. + * Copyright (c) 2002 by Lucent Technologies. + * Permission to use, copy, modify, and distribute this software for any + * purpose without fee is hereby granted, provided that this entire notice + * is included in all copies of any software which is or includes a copy + * or modification of this software and in all copies of the supporting + * documentation for such software. + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE + * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + */ #include #include + #include "fmtdef.h" Rune* runevseprint(Rune *buf, Rune *e, char *fmt, va_list args) /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/runevseprint.c:15,23 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/runevseprint.c:29,38 f.flush = nil; f.farg = nil; f.nfmt = 0; - f.args = args; + VA_COPY(f.args,args); dofmt(&f, fmt); + VA_END(f.args); *(Rune*)f.to = '\0'; - return f.to; + return (Rune*)f.to; } [rsc] --rw-rw-r-- M 711842 rsc drawterm 1854 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/runevsmprint.c [diffs elided] [rsc] --rw-rw-r-- M 711842 rsc drawterm 1125 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/runevsnprint.c /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/runevsnprint.c:1,5 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/runevsnprint.c:1,19 + /* + * The authors of this software are Rob Pike and Ken Thompson. + * Copyright (c) 2002 by Lucent Technologies. + * Permission to use, copy, modify, and distribute this software for any + * purpose without fee is hereby granted, provided that this entire notice + * is included in all copies of any software which is or includes a copy + * or modification of this software and in all copies of the supporting + * documentation for such software. + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE + * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + */ #include #include + #include "fmtdef.h" int runevsnprint(Rune *buf, int len, char *fmt, va_list args) /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/runevsnprint.c:15,22 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/runevsnprint.c:29,37 f.flush = nil; f.farg = nil; f.nfmt = 0; - f.args = args; + VA_COPY(f.args,args); dofmt(&f, fmt); + VA_END(f.args); *(Rune*)f.to = '\0'; return (Rune*)f.to - buf; } [rsc] --rw-rw-r-- M 711842 rsc drawterm 967 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/seprint.c /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/seprint.c:1,5 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/seprint.c:1,19 + /* + * The authors of this software are Rob Pike and Ken Thompson. + * Copyright (c) 2002 by Lucent Technologies. + * Permission to use, copy, modify, and distribute this software for any + * purpose without fee is hereby granted, provided that this entire notice + * is included in all copies of any software which is or includes a copy + * or modification of this software and in all copies of the supporting + * documentation for such software. + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE + * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + */ #include #include + #include "fmtdef.h" char* seprint(char *buf, char *e, char *fmt, ...) [rsc] --rw-rw-r-- M 711842 rsc drawterm 939 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/smprint.c /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/smprint.c:1,5 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/smprint.c:1,19 + /* + * The authors of this software are Rob Pike and Ken Thompson. + * Copyright (c) 2002 by Lucent Technologies. + * Permission to use, copy, modify, and distribute this software for any + * purpose without fee is hereby granted, provided that this entire notice + * is included in all copies of any software which is or includes a copy + * or modification of this software and in all copies of the supporting + * documentation for such software. + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE + * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + */ #include #include + #include "fmtdef.h" char* smprint(char *fmt, ...) [rsc] --rw-rw-r-- M 711842 rsc drawterm 966 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/snprint.c /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/snprint.c:1,5 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/snprint.c:1,19 + /* + * The authors of this software are Rob Pike and Ken Thompson. + * Copyright (c) 2002 by Lucent Technologies. + * Permission to use, copy, modify, and distribute this software for any + * purpose without fee is hereby granted, provided that this entire notice + * is included in all copies of any software which is or includes a copy + * or modification of this software and in all copies of the supporting + * documentation for such software. + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE + * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + */ #include #include + #include "fmtdef.h" int snprint(char *buf, int len, char *fmt, ...) [rsc] --rw-rw-r-- M 711842 rsc drawterm 1195 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/sprint.c /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/sprint.c:1,14 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/sprint.c:1,37 + /* + * The authors of this software are Rob Pike and Ken Thompson. + * Copyright (c) 2002 by Lucent Technologies. + * Permission to use, copy, modify, and distribute this software for any + * purpose without fee is hereby granted, provided that this entire notice + * is included in all copies of any software which is or includes a copy + * or modification of this software and in all copies of the supporting + * documentation for such software. + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE + * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + */ #include #include + #include "fmtdef.h" int sprint(char *buf, char *fmt, ...) { int n; + uint len; va_list args; + len = 1<<30; /* big number, but sprint is deprecated anyway */ + /* + * on PowerPC, the stack is near the top of memory, so + * we must be sure not to overflow a 32-bit pointer. + */ + if(buf+len < buf) + len = -(uintptr)buf-1; + va_start(args, fmt); - n = vsnprint(buf, 65536, fmt, args); /* big number, but sprint is deprecated anyway */ + n = vsnprint(buf, len, fmt, args); va_end(args); return n; } [rsc] --rw-rw-r-- M 711842 rsc drawterm 9114 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/strtod.c [diffs elided] [rsc] --rw-rw-r-- M 711842 rsc drawterm 1081 Jan 17 07:50 sys/src/cmd/unix/drawterm/libc/fmtfdflush.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 1046 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/vfprint.c [diffs elided] [rsc] --rw-rw-r-- M 711842 rsc drawterm 1109 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/vseprint.c /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/vseprint.c:1,5 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/vseprint.c:1,19 + /* + * The authors of this software are Rob Pike and Ken Thompson. + * Copyright (c) 2002 by Lucent Technologies. + * Permission to use, copy, modify, and distribute this software for any + * purpose without fee is hereby granted, provided that this entire notice + * is included in all copies of any software which is or includes a copy + * or modification of this software and in all copies of the supporting + * documentation for such software. + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE + * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + */ #include #include + #include "fmtdef.h" char* vseprint(char *buf, char *e, char *fmt, va_list args) /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/vseprint.c:12,23 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/vseprint.c:26,38 f.start = buf; f.to = buf; f.stop = e - 1; - f.flush = nil; + f.flush = 0; f.farg = nil; f.nfmt = 0; - f.args = args; + VA_COPY(f.args,args); dofmt(&f, fmt); + VA_END(f.args); *(char*)f.to = '\0'; - return f.to; + return (char*)f.to; } [rsc] --rw-rw-r-- M 711842 rsc drawterm 1754 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/vsmprint.c [diffs elided] [rsc] --rw-rw-r-- M 711842 rsc drawterm 1119 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/vsnprint.c /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/vsnprint.c:1,5 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/vsnprint.c:1,19 + /* + * The authors of this software are Rob Pike and Ken Thompson. + * Copyright (c) 2002 by Lucent Technologies. + * Permission to use, copy, modify, and distribute this software for any + * purpose without fee is hereby granted, provided that this entire notice + * is included in all copies of any software which is or includes a copy + * or modification of this software and in all copies of the supporting + * documentation for such software. + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE + * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + */ #include #include + #include "fmtdef.h" int vsnprint(char *buf, int len, char *fmt, va_list args) /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libc/vsnprint.c:12,22 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libc/vsnprint.c:26,37 f.start = buf; f.to = buf; f.stop = buf + len - 1; - f.flush = nil; + f.flush = 0; f.farg = nil; f.nfmt = 0; - f.args = args; + VA_COPY(f.args,args); dofmt(&f, fmt); + VA_END(f.args); *(char*)f.to = '\0'; return (char*)f.to - buf; } [rsc] --rw-rw-r-- M 711842 rsc drawterm 54659 Jan 17 07:50 sys/src/cmd/unix/drawterm/libmemdraw/draw.c /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/libmemdraw/draw.c:55,61 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/libmemdraw/draw.c:55,60 fmtinstall('R', Rfmt); fmtinstall('P', Pfmt); - fmtinstall('b', _ifmt); memones = allocmemimage(Rect(0,0,1,1), GREY1); memones->flags |= Frepl; [rsc] --rw-rw-r-- M 711842 rsc drawterm 2414 Jan 17 07:50 sys/src/cmd/unix/drawterm/main.c /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/main.c:36,42 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/main.c:36,41 eve = "drawterm"; sizebug(); - fmtinstall('r', errfmt); osinit(); procinit0(); [rsc] --rw-rw-r-- M 711842 rsc drawterm 7467 Jan 17 08:58 sys/src/cmd/unix/drawterm/include/lib.h /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/include/lib.h:3,10 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/include/lib.h:3,9 #define listen pm_listen #define sleep ksleep #define wakeup kwakeup - #define strtod libstrtod - #define pow10 libpow10 + #define strtod fmtstrtod /* conflicts on some os's */ #define encrypt libencrypt /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/include/lib.h:200,206 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/include/lib.h:199,206 FmtComma = FmtVLong << 1, FmtByte = FmtComma << 1, - FmtFlag = FmtByte << 1 + FmtFlag = FmtByte << 1, + FmtLDouble = FmtFlag << 1 }; extern int print(char*, ...); /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/include/lib.h:253,260 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/include/lib.h:253,262 extern int dofmt(Fmt*, char*); extern double __NaN(void); extern int __isNaN(double); - extern double strtod(char*, char**); + extern double strtod(const char*, char**); extern int utfnlen(char*, long); extern double __Inf(int); extern int __isInf(double, int); - extern double pow10(int); + + extern int (*fmtdoquote)(int); + [rsc] --rw-rw-r-- M 711842 rsc drawterm 349 Jan 17 08:58 sys/src/cmd/unix/drawterm/include/unix.h /n/sourcesdump/2006/0117/plan9/sys/src/cmd/unix/drawterm/include/unix.h:8,14 - /n/sourcesdump/2006/0118/plan9/sys/src/cmd/unix/drawterm/include/unix.h:8,17 #include #include #include + #include + #include + #include - typedef long long p9_vlong; typedef unsigned long long p9_uvlong; + typedef uintptr_t uintptr; [rsc] --rw-rw-r-- M 711842 rsc drawterm 1954 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/charstod.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 9771 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/dofmt.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 1542 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/dorfmt.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 7053 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/fltfmt.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 4195 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/fmt.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 3466 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/fmtdef.h [rsc] --rw-rw-r-- M 711842 rsc drawterm 136 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/fmtlock.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 1261 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/fmtprint.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 5514 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/fmtquote.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 1079 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/fmtrune.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 918 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/fmtstr.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 1270 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/fmtvprint.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 945 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/fprint.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 1051 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/nan64.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 1946 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/pow10.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 935 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/print.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 915 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/runefmtstr.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 975 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/runeseprint.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 947 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/runesmprint.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 974 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/runesnprint.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 963 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/runesprint.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 1115 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/runevseprint.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 1854 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/runevsmprint.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 1125 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/runevsnprint.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 967 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/seprint.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 939 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/smprint.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 966 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/snprint.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 1195 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/sprint.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 9114 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/strtod.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 1046 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/vfprint.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 1109 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/vseprint.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 1754 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/vsmprint.c [rsc] --rw-rw-r-- M 711842 rsc drawterm 1119 Jan 17 08:58 sys/src/cmd/unix/drawterm/libc/vsnprint.c