History

fixes

Russ Cox committed 20 years ago

Commit f18ed451 parent 87411459 files · +56 −84Browse files

Unified · Split

9 files
  1. kern/devroot.c +2 −1
  2. kern/sysfile.c +1 −1
  3. libc/Makefile +1 −0
  4. libc/errfmt.c +0 −28
  5. libc/fmt.h +45 −43
  6. libc/fmtfd.c +3 −4
  7. libc/fmtfdflush.c +4 −5
  8. libmemdraw/draw.c +0 −1
  9. main.c +0 −1
kern/devroot.c+2−1
@@ -54,6 +54,7 @@ static Dirlist bootlist = · 53 unmodified lines
5454 Nbootfiles
5555 };
5656
57+static uchar *mntdata[Nmntfiles];
5758 static Dirtab mntdir[Nmntfiles] = {
5859 "mnt", {Qmnt, 0, QTDIR}, 0, DMDIR|0555,
5960 "factotum", {Qfactotum, 0, QTDIR}, 0, DMDIR|0555,
@@ -62,7 +63,7 @@ static Dirlist mntlist = · 2 unmodified lines
6263 {
6364 Qmnt,
6465 mntdir,
65− nil,
66+ mntdata,
6667 2,
6768 Nmntfiles
6869 };
kern/sysfile.c+1−1
@@ -1158,7 +1158,7 @@ werrstr(char *f, ...) · 1157 unmodified lines
11581158 }
11591159
11601160 int
1161−errfmt(Fmt *fmt)
1161+__errfmt(Fmt *fmt)
11621162 {
11631163 if(up->nerrlab)
11641164 return fmtstrcpy(fmt, up->errstr);
libc/Makefile+1−0
@@ -22,6 +22,7 @@ OFILES=\ · 21 unmodified lines
2222 fltfmt.$O\
2323 fmt.$O\
2424 fmtfd.$O\
25+ fmtfdflush.$O\
2526 fmtlock.$O\
2627 fmtprint.$O\
2728 fmtquote.$O\
libc/errfmt.c+0−28
@@ -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−}
libc/fmt.h+45−43
@@ -1,4 +1,8 @@
1−
1+#ifndef _FMT_H_
2+#define _FMT_H_ 1
3+#if defined(__cplusplus)
4+extern "C" {
5+#endif
26 /*
37 * The authors of this software are Rob Pike and Ken Thompson.
48 * Copyright (c) 2002 by Lucent Technologies.
@@ -13,14 +17,8 @@ · 8 unmodified lines
1317 * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
1418 */
1519
16−#ifndef _FMTH_
17−#define _FMTH_ 1
18−
1920 #include <stdarg.h>
20−
21−#ifndef _UTFH_
2221 #include <utf.h>
23−#endif
2422
2523 typedef struct Fmt Fmt;
2624 struct Fmt{
@@ -57,43 +55,47 @@ enum{ · 30 unmodified lines
5755 FmtFlag = FmtLDouble << 1
5856 };
5957
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);
8658 extern int (*fmtdoquote)(int);
8759
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);
8897
89−extern int fmtinstall(int, int (*)(Fmt*));
90−extern int dofmt(Fmt*, char*);
91−extern int fmtprint(Fmt*, char*, ...);
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−
98+#if defined(__cplusplus)
99+}
100+#endif
99101 #endif
libc/fmtfd.c+3−4
@@ -11,10 +11,9 @@ · 10 unmodified lines
1111 * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
1212 * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
1313 */
14−#include <stdarg.h>
15−#include <string.h>
16−#include "plan9.h"
17−#include "fmt.h"
14+#include <inttypes.h>
15+#include <u.h>
16+#include <libc.h>
1817 #include "fmtdef.h"
1918
2019 /*
libc/fmtfdflush.c+4−5
@@ -11,10 +11,9 @@ · 10 unmodified lines
1111 * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
1212 * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
1313 */
14−#include <stdarg.h>
15−#include <unistd.h>
16−#include "plan9.h"
17−#include "fmt.h"
14+#include <inttypes.h>
15+#include <u.h>
16+#include <libc.h>
1817 #include "fmtdef.h"
1918
2019 /*
@@ -27,7 +26,7 @@ __fmtFdFlush(Fmt *f) · 6 unmodified lines
2726 int n;
2827
2928 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)
3130 return 0;
3231 f->to = f->start;
3332 return 1;
libmemdraw/draw.c+0−1
@@ -55,7 +55,6 @@ _memimageinit(void) · 54 unmodified lines
5555
5656 fmtinstall('R', Rfmt);
5757 fmtinstall('P', Pfmt);
58− fmtinstall('b', _ifmt);
5958
6059 memones = allocmemimage(Rect(0,0,1,1), GREY1);
6160 memones->flags |= Frepl;
main.c+0−1
@@ -36,7 +36,6 @@ main(int argc, char **argv) · 35 unmodified lines
3636 eve = "drawterm";
3737
3838 sizebug();
39− fmtinstall('r', errfmt);
4039
4140 osinit();
4241 procinit0();

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t