Differences From Artifact [6570f4dc53]:
- File src/file.c — part of check-in [999088161e] at 2012-09-29 22:50:49 on branch trunk — Add cfw_std{in,out,err}. (user: js, size: 4621) [annotate] [blame] [check-ins using]
To Artifact [222c0e621d]:
- File
src/file.c
— part of check-in
[2cee5ea2d5]
at
2012-09-30 01:01:37
on branch trunk
— Add cfw_stream_read_line().
This also adds a caching infrastructure to cfw_stream. (user: js, size: 4622) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
140 141 142 143 144 145 146 | ctor(void *ptr, va_list args) { CFWFile *file = ptr; const char *path = va_arg(args, const char*); const char *mode = va_arg(args, const char*); int flags; | | | | | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | ctor(void *ptr, va_list args) { CFWFile *file = ptr; const char *path = va_arg(args, const char*); const char *mode = va_arg(args, const char*); int flags; /* Make sure we have a valid file in case we error out */ cfw_stream->ctor(ptr, args); file->eof = false; if ((flags = parse_mode(mode)) == -1) return false; if ((file->fd = open(path, flags, DEFAULT_MODE)) == -1) return false; file->stream.ops = &stream_ops; return true; } static void dtor(void *ptr) { cfw_stream->dtor(ptr); } static CFWClass class = { .name = "CFWFile", .size = sizeof(CFWFile), .ctor = ctor, .dtor = dtor |
︙ | ︙ |