diff --git a/README.md b/README.md index 0b8e8bc..8a7983f 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/server/xrxs.c b/server/xrxs.c index b5b9da3..3da5e11 100644 --- a/server/xrxs.c +++ b/server/xrxs.c @@ -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]); } }