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
54 Nbootfiles54 Nbootfiles
55};55};
56 56
57static uchar *mntdata[Nmntfiles];
57static Dirtab mntdir[Nmntfiles] = {58static 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 Nmntfiles68 Nmntfiles
68};69};
kern/sysfile.c+1−1
@@ -1158,7 +1158,7 @@ werrstr(char *f, ...) · 1157 unmodified lines
1158}1158}
1159 1159
1160int1160int
1161errfmt(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);
libc/Makefile+1−0
@@ -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\
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
21int
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)
4extern "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
25typedef struct Fmt Fmt;23typedef struct Fmt Fmt;
26struct Fmt{24struct Fmt{
@@ -57,43 +55,47 @@ enum{ · 30 unmodified lines
57 FmtFlag = FmtLDouble << 155 FmtFlag = FmtLDouble << 1
58};56};
59 57
60extern int print(char*, ...);
61extern char* seprint(char*, char*, char*, ...);
62extern char* vseprint(char*, char*, char*, va_list);
63extern int snprint(char*, int, char*, ...);
64extern int vsnprint(char*, int, char*, va_list);
65extern char* smprint(char*, ...);
66extern char* vsmprint(char*, va_list);
67extern int sprint(char*, char*, ...);
68extern int fprint(int, char*, ...);
69extern int vfprint(int, char*, va_list);
70
71extern int runesprint(Rune*, char*, ...);
72extern int runesnprint(Rune*, int, char*, ...);
73extern int runevsnprint(Rune*, int, char*, va_list);
74extern Rune* runeseprint(Rune*, Rune*, char*, ...);
75extern Rune* runevseprint(Rune*, Rune*, char*, va_list);
76extern Rune* runesmprint(char*, ...);
77extern Rune* runevsmprint(char*, va_list);
78
79extern int fmtfdinit(Fmt*, int, char*, int);
80extern int fmtfdflush(Fmt*);
81extern int fmtstrinit(Fmt*);
82extern char* fmtstrflush(Fmt*);
83
84extern int quotestrfmt(Fmt *f);
85extern void quotefmtinstall(void);
86extern int (*fmtdoquote)(int);58extern int (*fmtdoquote)(int);
87 59
60/* Edit .+1,/^$/ | cfn $PLAN9/src/lib9/fmt/?*.c | grep -v static |grep -v __ */
61int dofmt(Fmt *f, char *fmt);
62int dorfmt(Fmt *f, const Rune *fmt);
63double fmtcharstod(int(*f)(void*), void *vp);
64int fmtfdflush(Fmt *f);
65int fmtfdinit(Fmt *f, int fd, char *buf, int size);
66int fmtinstall(int c, int (*f)(Fmt*));
67int fmtprint(Fmt *f, char *fmt, ...);
68int fmtrune(Fmt *f, int r);
69int fmtrunestrcpy(Fmt *f, Rune *s);
70int fmtstrcpy(Fmt *f, char *s);
71char* fmtstrflush(Fmt *f);
72int fmtstrinit(Fmt *f);
73double fmtstrtod(const char *as, char **aas);
74int fmtvprint(Fmt *f, char *fmt, va_list args);
75int fprint(int fd, char *fmt, ...);
76int print(char *fmt, ...);
77void quotefmtinstall(void);
78int quoterunestrfmt(Fmt *f);
79int quotestrfmt(Fmt *f);
80Rune* runefmtstrflush(Fmt *f);
81int runefmtstrinit(Fmt *f);
82Rune* runeseprint(Rune *buf, Rune *e, char *fmt, ...);
83Rune* runesmprint(char *fmt, ...);
84int runesnprint(Rune *buf, int len, char *fmt, ...);
85int runesprint(Rune *buf, char *fmt, ...);
86Rune* runevseprint(Rune *buf, Rune *e, char *fmt, va_list args);
87Rune* runevsmprint(char *fmt, va_list args);
88int runevsnprint(Rune *buf, int len, char *fmt, va_list args);
89char* seprint(char *buf, char *e, char *fmt, ...);
90char* smprint(char *fmt, ...);
91int snprint(char *buf, int len, char *fmt, ...);
92int sprint(char *buf, char *fmt, ...);
93int vfprint(int fd, char *fmt, va_list args);
94char* vseprint(char *buf, char *e, char *fmt, va_list args);
95char* vsmprint(char *fmt, va_list args);
96int vsnprint(char *buf, int len, char *fmt, va_list args);
88 97
89extern int fmtinstall(int, int (*)(Fmt*));98#if defined(__cplusplus)
90extern int dofmt(Fmt*, char*);99}
91extern int fmtprint(Fmt*, char*, ...);100#endif
92extern int fmtvprint(Fmt*, char*, va_list);
93extern int fmtrune(Fmt*, int);
94extern int fmtstrcpy(Fmt*, char*);
95
96extern double fmtstrtod(const char *, char **);
97extern double fmtcharstod(int(*)(void*), void*);
98
99#endif101#endif
libc/fmtfd.c+3−4
@@ -11,10 +11,9 @@ · 10 unmodified lines
11 * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY11 * 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/*
libc/fmtfdflush.c+4−5
@@ -11,10 +11,9 @@ · 10 unmodified lines
11 * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY11 * 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;
libmemdraw/draw.c+0−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;
main.c+0−1
@@ -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();

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