aboutsummaryrefslogtreecommitdiff
path: root/example/null.c
diff options
context:
space:
mode:
authorGravatar Miklos Szeredi <miklos@szeredi.hu>2001-11-20 19:12:28 +0000
committerGravatar Miklos Szeredi <miklos@szeredi.hu>2001-11-20 19:12:28 +0000
commitfe428120937e4c267c392e23164770377f9dfa1d (patch)
tree65f39fe747eaeb2e67252894d7ba6c9966a2f63f /example/null.c
parent33232032423dcc06716537204f1995afa5a73940 (diff)
fusermount changes
Diffstat (limited to 'example/null.c')
-rw-r--r--example/null.c32
1 files changed, 17 insertions, 15 deletions
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);