add help text and update README with similar info
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAmFsuzIACgkQO3+8IhRO Y5jx+g//egwp1pBOsGpxmCJtDZmp74aKkQTXHxYo7cTnKdG4rhvnnQpTS7Vaww9Z g8Y6ab4O0EfX/Q2AgEi+OdLx8QHIg07zj16LKSRtD+N0qm+3I0wM/7sHGeOVWTZa aBw7UbCmJfS3+P7ph3vBpqOvPbeqOYmsd7B2eT1dn/Mb2pY0jJvno61Co625d2A9 b+6zm0ePJbJnoEDTsq+WX59XyCLxPWnDbi6XMI6s7Zur8OhNSWVneBmNkz+hPJeE 1ez6P789XZf8AF8p9Kn1V8eOPg5/YttCQApuWpPXvAxdqVA8WTfUGmhiPtv9ypNT v7NEq6SmPW6yjfO9sv0PgvijefVg19oJ/bIabaKKVkajfhGnxPp18RkrnsvsoPm7 Ekp1751jetavWFNESftOaQi8TPGGc5qZxajl0DfCLuItkSrKAifuUmee1f7me/5Z yKnL3V9H86YZasQxYt2cDaHXFK3mIfekg4O4Ak7Elb71ZYy+6jQpKLVr3BkodBzt uxVlT5EdmEIW5PH21D9pXI3rEqYOzTQdpjA7iN1An2b5E0ebi+Ac3OZ2QLSDDLpE /AbExQ0eXfOKEp7LhfEq5JA7DBfJjxuWioz4C8xDHs5f8/MRdOsErKcTUXJ4qyNA LsKAm9etolFIgfMu41Y1vQvgGwgcw5/c0XG5I69ODvwjMR8mfJ4= =TFV9 -----END PGP SIGNATURE-----
2 files changed,
25 insertions(+),
2 deletions(-)
M
README.md
→
README.md
@@ -78,13 +78,20 @@ ```
./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
M
server/xrxs.c
→
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 @@ if (scmp(argv[i], "-v")) {
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 @@
threadpostmountsrv(&fs, usocket, mtpt, MREPL | MCREATE); threadexits(0); } else { - srv(&fs); + helpme(argv[0]); } }