clean up mount option passing
diff --git a/lib/fuse.c b/lib/fuse.c
index cebca07..2b79d85 100644
--- a/lib/fuse.c
+++ b/lib/fuse.c
@@ -1550,7 +1550,36 @@
     return 0;
 }
 
-struct fuse *fuse_new(int fd, int flags, const struct fuse_operations *op)
+
+int fuse_is_lib_option(const char *opt)
+{
+    if (strcmp(opt, "debug") == 0 ||
+        strcmp(opt, "hard_remove") == 0)
+        return 1;
+    else
+        return 0;
+}
+
+static void parse_lib_opts(struct fuse *f, const char *opts)
+{
+    if (opts) {
+        char *xopts = strdup(opts);
+        char *s = xopts;
+        char *opt;
+        
+        while((opt = strsep(&s, ","))) {
+            if (strcmp(opt, "debug") == 0)
+                f->flags |= FUSE_DEBUG;
+            else if (strcmp(opt, "hard_remove") == 0)
+                f->flags |= FUSE_HARD_REMOVE;
+            else 
+                fprintf(stderr, "fuse: warning: unknown option `%s'\n", opt);
+        }
+        free(xopts);
+    }
+}
+
+struct fuse *fuse_new(int fd, const char *opts, const struct fuse_operations *op)
 {
     struct fuse *f;
     struct node *root;
@@ -1562,7 +1591,7 @@
         return NULL;
     }
 
-    f->flags = flags;
+    parse_lib_opts(f, opts);
     f->fd = fd;
     f->ctr = 0;
     f->generation = 0;