Unified · Split
| @@ -31,7 +31,7 @@ typedef struct C9aux C9aux; · 30 unmodified lines | |||
| 31 | typedef struct REntry REntry; | 31 | typedef struct REntry REntry; |
| 32 | 32 | ||
| 33 | struct C9aux { | 33 | struct C9aux { |
| 34 | C9ctx; | 34 | C9ctx c; |
| 35 | int f; | 35 | int f; |
| 36 | int flags; | 36 | int flags; |
| 37 | uint8_t rdbuf[Msize]; | 37 | uint8_t rdbuf[Msize]; |
| @@ -238,14 +238,15 @@ ctxregistryR(C9ctx *ctx, C9r *r) · 200 unmodified lines | |||
| 238 | b++; | 238 | b++; |
| 239 | if ((s = strchr(s, '\n')) == NULL) | 239 | if ((s = strchr(s, '\n')) == NULL) |
| 240 | s = (char*)&r->read.data[r->read.size]; | 240 | s = (char*)&r->read.data[r->read.size]; |
| 241 | *s++ = 0; | 241 | else |
| 242 | *s++ = 0; | ||
| 242 | if (strstr(b, "tlssrv") == NULL && (s = strchr(b, ' ')) != NULL) { | 243 | if (strstr(b, "tlssrv") == NULL && (s = strchr(b, ' ')) != NULL) { |
| 243 | *s = 0; | 244 | *s = 0; |
| 244 | close(a->f); | 245 | close(a->f); |
| 245 | if ((a->f = dial(b)) < 0) | 246 | if ((a->f = dial(b)) < 0) |
| 246 | exit(1); | 247 | exit(1); |
| 247 | a->flags = 0; | 248 | a->flags = 0; |
| 248 | a->r = ctxchatR; | 249 | ctx->r = ctxchatR; |
| 249 | a->wroff = 0; | 250 | a->wroff = 0; |
| 250 | c9version(ctx, &tag, Msize); | 251 | c9version(ctx, &tag, Msize); |
| 251 | if (wrsend(a) != 0) | 252 | if (wrsend(a) != 0) |
| @@ -289,11 +290,11 @@ srv(char *s) · 37 unmodified lines | |||
| 289 | return NULL; | 290 | return NULL; |
| 290 | c = calloc(1, sizeof(*c)); | 291 | c = calloc(1, sizeof(*c)); |
| 291 | c->f = f; | 292 | c->f = f; |
| 292 | c->read = ctxread; | 293 | c->c.read = ctxread; |
| 293 | c->begin = ctxbegin; | 294 | c->c.begin = ctxbegin; |
| 294 | c->end = ctxend; | 295 | c->c.end = ctxend; |
| 295 | c->error = ctxerror; | 296 | c->c.error = ctxerror; |
| 296 | c->aux = c; | 297 | c->c.aux = c; |
| 297 | 298 | ||
| 298 | return c; | 299 | return c; |
| 299 | } | 300 | } |
| @@ -313,10 +314,10 @@ registry(void) · 13 unmodified lines | |||
| 313 | if (a == NULL) | 314 | if (a == NULL) |
| 314 | return NULL; | 315 | return NULL; |
| 315 | 316 | ||
| 316 | a->r = ctxregistryR; | 317 | a->c.r = ctxregistryR; |
| 317 | c9version((C9ctx*)a, &tag, Msize); | 318 | c9version(&a->c, &tag, Msize); |
| 318 | wrsend(a); | 319 | wrsend(a); |
| 319 | while (c9proc((C9ctx*)a) == 0 && a->r == ctxregistryR) | 320 | while (c9proc(&a->c) == 0 && a->c.r == ctxregistryR) |
| 320 | wrsend(a); | 321 | wrsend(a); |
| 321 | 322 | ||
| 322 | return a; | 323 | return a; |
| @@ -350,7 +351,7 @@ chatrw(C9aux *a) · 27 unmodified lines | |||
| 350 | break; | 351 | break; |
| 351 | } | 352 | } |
| 352 | 353 | ||
| 353 | ctx = (C9ctx*)a; | 354 | ctx = &a->c; |
| 354 | if (FD_ISSET(a->f, &r)) { | 355 | if (FD_ISSET(a->f, &r)) { |
| 355 | c9proc(ctx); | 356 | c9proc(ctx); |
| 356 | } else if (FD_ISSET(0, &r)) { | 357 | } else if (FD_ISSET(0, &r)) { |