From fe428120937e4c267c392e23164770377f9dfa1d Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Tue, 20 Nov 2001 19:12:28 +0000 Subject: fusermount changes --- example/null.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'example/null.c') diff --git a/example/null.c b/example/null.c index 379ba7a..c9816f1 100644 --- a/example/null.c +++ b/example/null.c @@ -17,8 +17,6 @@ #define UNUSED __attribute__((unused)) -static char *unmount_cmd; - static int null_getattr(const char *path, struct stat *stbuf) { if(strcmp(path, "/") != 0) @@ -90,11 +88,14 @@ static struct fuse_operations null_oper = { write: null_write, }; +static void cleanup() +{ + close(0); + system(getenv("FUSE_UNMOUNT_CMD")); +} static void exit_handler() { - close(0); - system(unmount_cmd); exit(0); } @@ -129,19 +130,9 @@ int main(int argc, char *argv[]) int multithreaded; struct fuse *fuse; - if(argc < 2) { - fprintf(stderr, - "usage: %s unmount_cmd [options] \n" - "Options:\n" - " -d enable debug output\n" - " -s disable multithreaded operation\n", - argv[0]); - exit(1); - } - argctr = 1; - unmount_cmd = argv[argctr++]; + atexit(cleanup); set_signal_handlers(); flags = 0; @@ -156,6 +147,17 @@ int main(int argc, char *argv[]) multithreaded = 0; break; + case 'h': + fprintf(stderr, + "usage: %s [options] \n" + "Options:\n" + " -d enable debug output\n" + " -s disable multithreaded operation\n" + " -h print help\n", + argv[0]); + exit(1); + break; + default: fprintf(stderr, "invalid option: %s\n", argv[argctr]); exit(1); -- cgit v1.2.3