add help text and update README with similar info

This commit is contained in:
Iris Lightshard 2021-10-17 18:09:22 -06:00
parent 6314c755a4
commit 9f1ddd0300
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
2 changed files with 25 additions and 2 deletions

View file

@ -78,13 +78,20 @@ or expose a service on the network (uses `9pserve` to support multiple users and
./xrxs-srv.sh start
```
Add the `-d` option to the above command to enable 9p debugging output.
Similarly, you can stop the service with:
```
./xrxs-srv.sh stop
```
You can add `-d` to either the `xrxs` command line or the `xrxs-srv.sh` command line to enable chatty `9p` debug output.
The executable itself supports the following options, one of which is required (no options prints the help text):
* `-m MOUNTPOINT`: mount the 9p filesystem locally at MOUNTPOINT
* `-s SOCKET`: serve the 9p filesystem over a socket named SOCKET
* `-v`: print the version information
* `-h | --help`: show the help text
### client

View file

@ -25,6 +25,18 @@ static Tree* tree;
static UserInfo users_table[MAX_USERS];
void helpme(char* arg0) {
printf("usage: %s [-m MOUNTPOINT | -s SOCKET | -v | -h|--help]\n", arg0);
printf("Serve xrxs game infrastructure over 9p.\n\n");
printf(" -m MOUNTPOINT: mount the 9p filesystem locally at MOUNTPOINT\n");
printf(" -s SOCKET: create a socket for the 9p filesystem with the "
"namespace SOCKET\n");
printf(" -v: print version information\n");
printf(" -h | --help: print this help text\n\n");
threadexits(0);
}
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
@ -626,6 +638,10 @@ void threadmain(int argc, char* argv[]) {
printf("xrxs v%s\n", version);
threadexits(0);
}
if (scmp(argv[i], "-h") || scmp(argv[i], "--help")) {
helpme(argv[0]);
}
}
fs.foreground = 1;
@ -676,6 +692,6 @@ void threadmain(int argc, char* argv[]) {
threadpostmountsrv(&fs, usocket, mtpt, MREPL | MCREATE);
threadexits(0);
} else {
srv(&fs);
helpme(argv[0]);
}
}