Unified · Split
| @@ -54,6 +54,7 @@ static Dirlist bootlist = · 53 unmodified lines | |||
| 54 | Nbootfiles | 54 | Nbootfiles |
| 55 | }; | 55 | }; |
| 56 | 56 | ||
| 57 | static uchar *mntdata[Nmntfiles]; | ||
| 57 | static Dirtab mntdir[Nmntfiles] = { | 58 | static Dirtab mntdir[Nmntfiles] = { |
| 58 | "mnt", {Qmnt, 0, QTDIR}, 0, DMDIR|0555, | 59 | "mnt", {Qmnt, 0, QTDIR}, 0, DMDIR|0555, |
| 59 | "factotum", {Qfactotum, 0, QTDIR}, 0, DMDIR|0555, | 60 | "factotum", {Qfactotum, 0, QTDIR}, 0, DMDIR|0555, |
| @@ -62,7 +63,7 @@ static Dirlist mntlist = · 2 unmodified lines | |||
| 62 | { | 63 | { |
| 63 | Qmnt, | 64 | Qmnt, |
| 64 | mntdir, | 65 | mntdir, |
| 65 | nil, | 66 | mntdata, |
| 66 | 2, | 67 | 2, |
| 67 | Nmntfiles | 68 | Nmntfiles |
| 68 | }; | 69 | }; |
| @@ -1158,7 +1158,7 @@ werrstr(char *f, ...) · 1157 unmodified lines | |||
| 1158 | } | 1158 | } |
| 1159 | 1159 | ||
| 1160 | int | 1160 | int |
| 1161 | errfmt(Fmt *fmt) | 1161 | __errfmt(Fmt *fmt) |
| 1162 | { | 1162 | { |
| 1163 | if(up->nerrlab) | 1163 | if(up->nerrlab) |
| 1164 | return fmtstrcpy(fmt, up->errstr); | 1164 | return fmtstrcpy(fmt, up->errstr); |
| @@ -22,6 +22,7 @@ OFILES=\ · 21 unmodified lines | |||
| 22 | fltfmt.$O\ | 22 | fltfmt.$O\ |
| 23 | fmt.$O\ | 23 | fmt.$O\ |
| 24 | fmtfd.$O\ | 24 | fmtfd.$O\ |
| 25 | fmtfdflush.$O\ | ||
| 25 | fmtlock.$O\ | 26 | fmtlock.$O\ |
| 26 | fmtprint.$O\ | 27 | fmtprint.$O\ |
| 27 | fmtquote.$O\ | 28 | fmtquote.$O\ |
| @@ -1,28 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * The authors of this software are Rob Pike and Ken Thompson. | ||
| 3 | * Copyright (c) 2002 by Lucent Technologies. | ||
| 4 | * Permission to use, copy, modify, and distribute this software for any | ||
| 5 | * purpose without fee is hereby granted, provided that this entire notice | ||
| 6 | * is included in all copies of any software which is or includes a copy | ||
| 7 | * or modification of this software and in all copies of the supporting | ||
| 8 | * documentation for such software. | ||
| 9 | * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED | ||
| 10 | * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE | ||
| 11 | * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY | ||
| 12 | * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. | ||
| 13 | */ | ||
| 14 | #include <stdarg.h> | ||
| 15 | #include <errno.h> | ||
| 16 | #include <string.h> | ||
| 17 | #include "plan9.h" | ||
| 18 | #include "fmt.h" | ||
| 19 | #include "fmtdef.h" | ||
| 20 | |||
| 21 | int | ||
| 22 | __errfmt(Fmt *f) | ||
| 23 | { | ||
| 24 | char *s; | ||
| 25 | |||
| 26 | s = strerror(errno); | ||
| 27 | return fmtstrcpy(f, s); | ||
| 28 | } | ||
| @@ -1,4 +1,8 @@ | |||
| 1 | 1 | #ifndef _FMT_H_ | |
| 2 | #define _FMT_H_ 1 | ||
| 3 | #if defined(__cplusplus) | ||
| 4 | extern "C" { | ||
| 5 | #endif | ||
| 2 | /* | 6 | /* |
| 3 | * The authors of this software are Rob Pike and Ken Thompson. | 7 | * The authors of this software are Rob Pike and Ken Thompson. |
| 4 | * Copyright (c) 2002 by Lucent Technologies. | 8 | * Copyright (c) 2002 by Lucent Technologies. |
| @@ -13,14 +17,8 @@ · 8 unmodified lines | |||
| 13 | * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. | 17 | * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. |
| 14 | */ | 18 | */ |
| 15 | 19 | ||
| 16 | #ifndef _FMTH_ | ||
| 17 | #define _FMTH_ 1 | ||
| 18 | |||
| 19 | #include <stdarg.h> | 20 | #include <stdarg.h> |
| 20 | |||
| 21 | #ifndef _UTFH_ | ||
| 22 | #include <utf.h> | 21 | #include <utf.h> |
| 23 | #endif | ||
| 24 | 22 | ||
| 25 | typedef struct Fmt Fmt; | 23 | typedef struct Fmt Fmt; |
| 26 | struct Fmt{ | 24 | struct Fmt{ |
| @@ -57,43 +55,47 @@ enum{ · 30 unmodified lines | |||
| 57 | FmtFlag = FmtLDouble << 1 | 55 | FmtFlag = FmtLDouble << 1 |
| 58 | }; | 56 | }; |
| 59 | 57 | ||
| 60 | extern int print(char*, ...); | ||
| 61 | extern char* seprint(char*, char*, char*, ...); | ||
| 62 | extern char* vseprint(char*, char*, char*, va_list); | ||
| 63 | extern int snprint(char*, int, char*, ...); | ||
| 64 | extern int vsnprint(char*, int, char*, va_list); | ||
| 65 | extern char* smprint(char*, ...); | ||
| 66 | extern char* vsmprint(char*, va_list); | ||
| 67 | extern int sprint(char*, char*, ...); | ||
| 68 | extern int fprint(int, char*, ...); | ||
| 69 | extern int vfprint(int, char*, va_list); | ||
| 70 | |||
| 71 | extern int runesprint(Rune*, char*, ...); | ||
| 72 | extern int runesnprint(Rune*, int, char*, ...); | ||
| 73 | extern int runevsnprint(Rune*, int, char*, va_list); | ||
| 74 | extern Rune* runeseprint(Rune*, Rune*, char*, ...); | ||
| 75 | extern Rune* runevseprint(Rune*, Rune*, char*, va_list); | ||
| 76 | extern Rune* runesmprint(char*, ...); | ||
| 77 | extern Rune* runevsmprint(char*, va_list); | ||
| 78 | |||
| 79 | extern int fmtfdinit(Fmt*, int, char*, int); | ||
| 80 | extern int fmtfdflush(Fmt*); | ||
| 81 | extern int fmtstrinit(Fmt*); | ||
| 82 | extern char* fmtstrflush(Fmt*); | ||
| 83 | |||
| 84 | extern int quotestrfmt(Fmt *f); | ||
| 85 | extern void quotefmtinstall(void); | ||
| 86 | extern int (*fmtdoquote)(int); | 58 | extern int (*fmtdoquote)(int); |
| 87 | 59 | ||
| 60 | /* Edit .+1,/^$/ | cfn $PLAN9/src/lib9/fmt/?*.c | grep -v static |grep -v __ */ | ||
| 61 | int dofmt(Fmt *f, char *fmt); | ||
| 62 | int dorfmt(Fmt *f, const Rune *fmt); | ||
| 63 | double fmtcharstod(int(*f)(void*), void *vp); | ||
| 64 | int fmtfdflush(Fmt *f); | ||
| 65 | int fmtfdinit(Fmt *f, int fd, char *buf, int size); | ||
| 66 | int fmtinstall(int c, int (*f)(Fmt*)); | ||
| 67 | int fmtprint(Fmt *f, char *fmt, ...); | ||
| 68 | int fmtrune(Fmt *f, int r); | ||
| 69 | int fmtrunestrcpy(Fmt *f, Rune *s); | ||
| 70 | int fmtstrcpy(Fmt *f, char *s); | ||
| 71 | char* fmtstrflush(Fmt *f); | ||
| 72 | int fmtstrinit(Fmt *f); | ||
| 73 | double fmtstrtod(const char *as, char **aas); | ||
| 74 | int fmtvprint(Fmt *f, char *fmt, va_list args); | ||
| 75 | int fprint(int fd, char *fmt, ...); | ||
| 76 | int print(char *fmt, ...); | ||
| 77 | void quotefmtinstall(void); | ||
| 78 | int quoterunestrfmt(Fmt *f); | ||
| 79 | int quotestrfmt(Fmt *f); | ||
| 80 | Rune* runefmtstrflush(Fmt *f); | ||
| 81 | int runefmtstrinit(Fmt *f); | ||
| 82 | Rune* runeseprint(Rune *buf, Rune *e, char *fmt, ...); | ||
| 83 | Rune* runesmprint(char *fmt, ...); | ||
| 84 | int runesnprint(Rune *buf, int len, char *fmt, ...); | ||
| 85 | int runesprint(Rune *buf, char *fmt, ...); | ||
| 86 | Rune* runevseprint(Rune *buf, Rune *e, char *fmt, va_list args); | ||
| 87 | Rune* runevsmprint(char *fmt, va_list args); | ||
| 88 | int runevsnprint(Rune *buf, int len, char *fmt, va_list args); | ||
| 89 | char* seprint(char *buf, char *e, char *fmt, ...); | ||
| 90 | char* smprint(char *fmt, ...); | ||
| 91 | int snprint(char *buf, int len, char *fmt, ...); | ||
| 92 | int sprint(char *buf, char *fmt, ...); | ||
| 93 | int vfprint(int fd, char *fmt, va_list args); | ||
| 94 | char* vseprint(char *buf, char *e, char *fmt, va_list args); | ||
| 95 | char* vsmprint(char *fmt, va_list args); | ||
| 96 | int vsnprint(char *buf, int len, char *fmt, va_list args); | ||
| 88 | 97 | ||
| 89 | extern int fmtinstall(int, int (*)(Fmt*)); | 98 | #if defined(__cplusplus) |
| 90 | extern int dofmt(Fmt*, char*); | 99 | } |
| 91 | extern int fmtprint(Fmt*, char*, ...); | 100 | #endif |
| 92 | extern int fmtvprint(Fmt*, char*, va_list); | ||
| 93 | extern int fmtrune(Fmt*, int); | ||
| 94 | extern int fmtstrcpy(Fmt*, char*); | ||
| 95 | |||
| 96 | extern double fmtstrtod(const char *, char **); | ||
| 97 | extern double fmtcharstod(int(*)(void*), void*); | ||
| 98 | |||
| 99 | #endif | 101 | #endif |
| @@ -11,10 +11,9 @@ · 10 unmodified lines | |||
| 11 | * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY | 11 | * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY |
| 12 | * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. | 12 | * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. |
| 13 | */ | 13 | */ |
| 14 | #include <stdarg.h> | 14 | #include <inttypes.h> |
| 15 | #include <string.h> | 15 | #include <u.h> |
| 16 | #include "plan9.h" | 16 | #include <libc.h> |
| 17 | #include "fmt.h" | ||
| 18 | #include "fmtdef.h" | 17 | #include "fmtdef.h" |
| 19 | 18 | ||
| 20 | /* | 19 | /* |
| @@ -11,10 +11,9 @@ · 10 unmodified lines | |||
| 11 | * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY | 11 | * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY |
| 12 | * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. | 12 | * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. |
| 13 | */ | 13 | */ |
| 14 | #include <stdarg.h> | 14 | #include <inttypes.h> |
| 15 | #include <unistd.h> | 15 | #include <u.h> |
| 16 | #include "plan9.h" | 16 | #include <libc.h> |
| 17 | #include "fmt.h" | ||
| 18 | #include "fmtdef.h" | 17 | #include "fmtdef.h" |
| 19 | 18 | ||
| 20 | /* | 19 | /* |
| @@ -27,7 +26,7 @@ __fmtFdFlush(Fmt *f) · 6 unmodified lines | |||
| 27 | int n; | 26 | int n; |
| 28 | 27 | ||
| 29 | n = (char*)f->to - (char*)f->start; | 28 | n = (char*)f->to - (char*)f->start; |
| 30 | if(n && write((uintptr)f->farg, f->start, n) != n) | 29 | if(n && write((uintptr_t)f->farg, f->start, n) != n) |
| 31 | return 0; | 30 | return 0; |
| 32 | f->to = f->start; | 31 | f->to = f->start; |
| 33 | return 1; | 32 | return 1; |
| @@ -55,7 +55,6 @@ _memimageinit(void) · 54 unmodified lines | |||
| 55 | 55 | ||
| 56 | fmtinstall('R', Rfmt); | 56 | fmtinstall('R', Rfmt); |
| 57 | fmtinstall('P', Pfmt); | 57 | fmtinstall('P', Pfmt); |
| 58 | fmtinstall('b', _ifmt); | ||
| 59 | 58 | ||
| 60 | memones = allocmemimage(Rect(0,0,1,1), GREY1); | 59 | memones = allocmemimage(Rect(0,0,1,1), GREY1); |
| 61 | memones->flags |= Frepl; | 60 | memones->flags |= Frepl; |
| @@ -36,7 +36,6 @@ main(int argc, char **argv) · 35 unmodified lines | |||
| 36 | eve = "drawterm"; | 36 | eve = "drawterm"; |
| 37 | 37 | ||
| 38 | sizebug(); | 38 | sizebug(); |
| 39 | fmtinstall('r', errfmt); | ||
| 40 | 39 | ||
| 41 | osinit(); | 40 | osinit(); |
| 42 | procinit0(); | 41 | procinit0(); |