aboutsummaryrefslogtreecommitdiff
path: root/example/timefs1.c
diff options
context:
space:
mode:
Diffstat (limited to 'example/timefs1.c')
-rw-r--r--example/timefs1.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/example/timefs1.c b/example/timefs1.c
index cff9545..430e00f 100644
--- a/example/timefs1.c
+++ b/example/timefs1.c
@@ -273,6 +273,15 @@ static void* update_fs(void *data) {
return NULL;
}
+static void show_help(const char *progname)
+{
+ printf("usage: %s [options] <mountpoint>\n\n", progname);
+ printf("File-system specific options:\n"
+ " --update-interval=<secs> Update-rate of file system contents\n"
+ " --no-notify Disable kernel notifications\n"
+ "\n");
+}
+
int main(int argc, char *argv[]) {
struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
struct fuse_session *se;
@@ -284,13 +293,26 @@ int main(int argc, char *argv[]) {
opt_proc) == -1)
return 1;
- if (fuse_parse_cmdline(&args, &opts) != 0)
- return 1;
- if (opts.show_help || opts.show_version) {
+ if (fuse_parse_cmdline(&args, &opts) != 0) {
ret = 1;
goto err_out1;
}
+ if (opts.show_help) {
+ show_help(argv[0]);
+ fuse_cmdline_help();
+ fuse_lowlevel_help();
+ fuse_mount_help();
+ ret = 0;
+ goto err_out1;
+ } else if (opts.show_version) {
+ printf("FUSE library version %s\n", fuse_pkgversion());
+ fuse_lowlevel_version();
+ fuse_mount_version();
+ ret = 0;
+ goto err_out1;
+ }
+
se = fuse_session_new(&args, &tfs_oper,
sizeof(tfs_oper), NULL);
if (se == NULL)
@@ -324,8 +346,8 @@ err_out3:
err_out2:
fuse_session_destroy(se);
err_out1:
- free(opts.mountpoint);
fuse_opt_free_args(&args);
+ free(opts.mountpoint);
return ret ? 1 : 0;
}