fix typos and tested writing to ctl from uxn. it works!
This commit is contained in:
parent
1b90c918bb
commit
6ea6f9be6b
1 changed files with 14 additions and 7 deletions
21
xrxs.c
21
xrxs.c
|
@ -34,6 +34,8 @@ static char Ebad[] = "something bad happened";
|
|||
static char Enomem[] = "no memory";
|
||||
static char Euname[] = "username is already taken";
|
||||
|
||||
static Tree* tree;
|
||||
|
||||
typedef enum { CTL = 1, USERS, CARTS, SLOT, DATA, REALMS, UNIVERSE } FileType;
|
||||
|
||||
typedef struct Aux Aux;
|
||||
|
@ -61,6 +63,11 @@ struct UserInfo {
|
|||
static UserInfo users_table[64];
|
||||
|
||||
void xrxs_attach(Req* r) {
|
||||
/* As it is, once the user detaches, they will stay in the table
|
||||
* until the server restarts. We have to figure out some way
|
||||
* to detect a detach to remove them... You can't delay respond()
|
||||
* or the attach will never complete.
|
||||
*/
|
||||
static ushort id = 1;
|
||||
int i = 0;
|
||||
int l = 0;
|
||||
|
@ -73,9 +80,10 @@ void xrxs_attach(Req* r) {
|
|||
}
|
||||
for (i = 0; i < 64; i++) {
|
||||
usr = users_table[i].name;
|
||||
if (scmp(usr, username))
|
||||
if (scmp(usr, username)){
|
||||
respond(r, Euname);
|
||||
return;
|
||||
}
|
||||
if (*usr == 0) {
|
||||
scpy(username, usr, l+1);
|
||||
users_table[i].id = id++;
|
||||
|
@ -149,16 +157,17 @@ void write_ctl(Req* r) {
|
|||
char* c = r->ifcall.data;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < r->ifcall.count; i++) {
|
||||
/*for (i = 0; i < r->ifcall.count; i++) {
|
||||
ccat(cmd, *c++);
|
||||
}
|
||||
|
||||
unsigned long long const cmd_hashv = hash(cmd);
|
||||
|
||||
switch (cmd_hashv) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
default:*/
|
||||
createfile(tree->root, "success", nil, 0777, nil);
|
||||
/*break;
|
||||
}*/
|
||||
r->ofcall.count = r->ifcall.count;
|
||||
r->fid->file->dir.length = r->ifcall.count;
|
||||
respond(r, nil);
|
||||
|
@ -268,13 +277,11 @@ Srv fs = {
|
|||
.open = fsopen,
|
||||
.read = xrxs_read,
|
||||
.write = xrxs_write,
|
||||
.create = fsopen,
|
||||
.wstat = wstat};
|
||||
|
||||
int threadmaybackground(void) { return 1; }
|
||||
|
||||
void threadmain(int argc, char* argv[]) {
|
||||
Tree* tree;
|
||||
char* mtpt = nil;
|
||||
char* usocket = nil;
|
||||
int i;
|
||||
|
|
Loading…
Reference in a new issue