From 5e3271e962b13138fe3273f743a65d58c0c8356a Mon Sep 17 00:00:00 2001 From: "lulf@carrot.studby.ntnu.no" Date: Sun, 20 Apr 2008 15:14:43 +0200 Subject: - Include option parsing in main file. - Put initialization routine in vnops. --- src/mp3fs.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'src/mp3fs.c') 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 #include #include +#include +#include -#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); } -- cgit v1.2.3