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 Enomem[] = "no memory";
|
||||||
static char Euname[] = "username is already taken";
|
static char Euname[] = "username is already taken";
|
||||||
|
|
||||||
|
static Tree* tree;
|
||||||
|
|
||||||
typedef enum { CTL = 1, USERS, CARTS, SLOT, DATA, REALMS, UNIVERSE } FileType;
|
typedef enum { CTL = 1, USERS, CARTS, SLOT, DATA, REALMS, UNIVERSE } FileType;
|
||||||
|
|
||||||
typedef struct Aux Aux;
|
typedef struct Aux Aux;
|
||||||
|
@ -61,6 +63,11 @@ struct UserInfo {
|
||||||
static UserInfo users_table[64];
|
static UserInfo users_table[64];
|
||||||
|
|
||||||
void xrxs_attach(Req* r) {
|
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;
|
static ushort id = 1;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int l = 0;
|
int l = 0;
|
||||||
|
@ -73,9 +80,10 @@ void xrxs_attach(Req* r) {
|
||||||
}
|
}
|
||||||
for (i = 0; i < 64; i++) {
|
for (i = 0; i < 64; i++) {
|
||||||
usr = users_table[i].name;
|
usr = users_table[i].name;
|
||||||
if (scmp(usr, username))
|
if (scmp(usr, username)){
|
||||||
respond(r, Euname);
|
respond(r, Euname);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (*usr == 0) {
|
if (*usr == 0) {
|
||||||
scpy(username, usr, l+1);
|
scpy(username, usr, l+1);
|
||||||
users_table[i].id = id++;
|
users_table[i].id = id++;
|
||||||
|
@ -149,16 +157,17 @@ void write_ctl(Req* r) {
|
||||||
char* c = r->ifcall.data;
|
char* c = r->ifcall.data;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < r->ifcall.count; i++) {
|
/*for (i = 0; i < r->ifcall.count; i++) {
|
||||||
ccat(cmd, *c++);
|
ccat(cmd, *c++);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long long const cmd_hashv = hash(cmd);
|
unsigned long long const cmd_hashv = hash(cmd);
|
||||||
|
|
||||||
switch (cmd_hashv) {
|
switch (cmd_hashv) {
|
||||||
default:
|
default:*/
|
||||||
break;
|
createfile(tree->root, "success", nil, 0777, nil);
|
||||||
}
|
/*break;
|
||||||
|
}*/
|
||||||
r->ofcall.count = r->ifcall.count;
|
r->ofcall.count = r->ifcall.count;
|
||||||
r->fid->file->dir.length = r->ifcall.count;
|
r->fid->file->dir.length = r->ifcall.count;
|
||||||
respond(r, nil);
|
respond(r, nil);
|
||||||
|
@ -268,13 +277,11 @@ Srv fs = {
|
||||||
.open = fsopen,
|
.open = fsopen,
|
||||||
.read = xrxs_read,
|
.read = xrxs_read,
|
||||||
.write = xrxs_write,
|
.write = xrxs_write,
|
||||||
.create = fsopen,
|
|
||||||
.wstat = wstat};
|
.wstat = wstat};
|
||||||
|
|
||||||
int threadmaybackground(void) { return 1; }
|
int threadmaybackground(void) { return 1; }
|
||||||
|
|
||||||
void threadmain(int argc, char* argv[]) {
|
void threadmain(int argc, char* argv[]) {
|
||||||
Tree* tree;
|
|
||||||
char* mtpt = nil;
|
char* mtpt = nil;
|
||||||
char* usocket = nil;
|
char* usocket = nil;
|
||||||
int i;
|
int i;
|
||||||
|
|
Loading…
Reference in a new issue