diff --git a/xrxs.c b/xrxs.c index 2ea0ea8..9205ce3 100644 --- a/xrxs.c +++ b/xrxs.c @@ -160,6 +160,7 @@ void write_scope(Req* r) { s_putc(scope, *c++); } s_terminate(scope); + fprintf(stderr, scope->base); if (u != nil && u->realm != nil && u->realm->universe != nil) { u->scope = malloc(r->ifcall.count); @@ -182,6 +183,7 @@ void xrxs_write(Req* r) { break; case SCOPE: write_scope(r); + break; default: respond(r, nil); break; @@ -398,13 +400,14 @@ void read_scope(Req* r) { Universe* universe; Atom* a; char key[16] = {0}; - char* c = u->scope; + char* c; if (u == nil || u->scope == nil || u->realm == nil) { respond(r, nil); return; } + c = u->scope; universe = u->realm->universe; if (universe == nil) { respond(r, ENOUNI); @@ -421,6 +424,8 @@ void read_scope(Req* r) { s_putc(data, '\n'); } *key = '\0'; + if (*c == '\0') + break; c++; } @@ -435,6 +440,7 @@ void read_random(Req* r) { srand(rand()); sprintf(buf, "%d\n", rand() % 100); readstr(r, buf); + respond(r, nil); } void read_grandom(Req* r) { @@ -478,6 +484,7 @@ void read_grandom(Req* r) { sprintf(buf, "%d\n", u->random); u->random = -1; readstr(r, buf); + respond(r, nil); } void xrxs_read(Req* r) {