diff options
author | lulf@carrot.studby.ntnu.no <lulf@carrot.studby.ntnu.no> | 2008-04-20 15:14:43 +0200 |
---|---|---|
committer | lulf@carrot.studby.ntnu.no <lulf@carrot.studby.ntnu.no> | 2008-04-20 15:14:43 +0200 |
commit | 5e3271e962b13138fe3273f743a65d58c0c8356a (patch) | |
tree | 399844067f3f8aa7d2b2a149f94cd10500b17020 /src/mp3fs.c | |
parent | 44b39b3039b1e65dae3238943e52ae185413881e (diff) |
- Include option parsing in main file.
- Put initialization routine in vnops.
Diffstat (limited to 'src/mp3fs.c')
-rwxr-xr-x | src/mp3fs.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/mp3fs.c b/src/mp3fs.c index f8e4cba..ebc1c27 100755 --- a/src/mp3fs.c +++ b/src/mp3fs.c @@ -4,13 +4,11 @@ #include <stdlib.h> #include <stdio.h> #include <fuse.h> +#include <fuse_opt.h> +#include <mp3fs.h> -#include "mp3_vnops.c" -#include "mp3_opt_parse.c" - -/* static struct fuse_module mp3_mod { */ -/* .name = "MP3FS" */ -/* }; */ +/* Prototypes. */ +static int mp3fs_opt_proc (void *, const char *, int, struct fuse_args *); /* Just for testing the argument parsing. TODO: fix something better */ char *sourcedir = NULL; @@ -23,5 +21,18 @@ main(int argc, char **argv) if (fuse_opt_parse(&args, NULL, NULL, mp3fs_opt_proc) != 0) exit (1); - return (fuse_main (args.argc, args.argv, &mp3_oper, NULL)); + printf("Starting up mp3fs\n"); + mp3_run(&args); + printf("Shutting down mp3fs\n"); +} + +static int mp3fs_opt_proc (void *data, const char *arg, int key, + struct fuse_args *outargs) +{ + if (key == FUSE_OPT_KEY_NONOPT && !sourcedir) { + /* The source directory isn't already set, let's do it */ + sourcedir = arg; + return (0); + } + return (-1); } |