From f3ea83bac4cc55033a1db39a109bbf70b87f0578 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Wed, 7 Nov 2001 14:55:16 +0000 Subject: build and install fixes --- example/.cvsignore | 1 + example/Makefile.am | 2 +- example/fusexmp.c | 40 +++++++++++++++++++++++++++++++++++----- 3 files changed, 37 insertions(+), 6 deletions(-) (limited to 'example') diff --git a/example/.cvsignore b/example/.cvsignore index e440faf..bcfd8b2 100644 --- a/example/.cvsignore +++ b/example/.cvsignore @@ -1,3 +1,4 @@ Makefile.in Makefile .deps +fusexmp diff --git a/example/Makefile.am b/example/Makefile.am index 0e666b5..4d89206 100644 --- a/example/Makefile.am +++ b/example/Makefile.am @@ -4,4 +4,4 @@ bin_PROGRAMS = fusexmp fusexmp_SOURCES = fusexmp.c -fusexmp_LDADD = ../lib/libfuse.a +fusexmp_LDADD = ../lib/libfuse.a -lpthread diff --git a/example/fusexmp.c b/example/fusexmp.c index b00039d..4c831dc 100644 --- a/example/fusexmp.c +++ b/example/fusexmp.c @@ -388,22 +388,52 @@ static struct fuse_operations xmp_oper = { int main(int argc, char *argv[]) { int res; - if(argc != 2) { - fprintf(stderr, "usage: %s mount_dir\n", argv[0]); + int argctr; + char *mnt; + int flags; + + if(argc < 2) { + fprintf(stderr, + "usage: %s [options] mount_dir\n" + "Options:\n" + " -d enable debug output\n" + " -s disable multithreaded operation\n", + argv[0]); exit(1); } + flags = FUSE_MULTITHREAD; + for(argctr = 1; argctr < argc && argv[argctr][0] == '-'; argctr ++) { + switch(argv[argctr][1]) { + case 'd': + flags |= FUSE_DEBUG; + break; + + case 's': + flags &= ~FUSE_MULTITHREAD; + break; + + default: + fprintf(stderr, "invalid option: %s\n", argv[argctr]); + exit(1); + } + } + if(argctr != argc - 1) { + fprintf(stderr, "missing or surplus argument\n"); + exit(1); + } + mnt = argv[argctr]; + set_signal_handlers(); atexit(cleanup); setgroups(0, NULL); - xmp_fuse = fuse_new(0,0); - res = fuse_mount(xmp_fuse, argv[1]); + xmp_fuse = fuse_new(flags, 0); + res = fuse_mount(xmp_fuse, mnt); if(res == -1) exit(1); fuse_set_operations(xmp_fuse, &xmp_oper); - fuse_loop(xmp_fuse); return 0; -- cgit v1.2.3