summaryrefslogtreecommitdiff
path: root/src/mp3fs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mp3fs.c')
-rwxr-xr-xsrc/mp3fs.c25
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);
}