even older 1.X API define it to 11. */
#ifndef FUSE_USE_VERSION
+#warning FUSE_USE_VERSION not defined, defaulting to 21
#define FUSE_USE_VERSION 21
#endif
# define fuse_new _fuse_new_compat2
# define __fuse_setup _fuse_setup_compat2
# else
-# undef FUSE_MAJOR_VERSION
# define FUSE_MAJOR_VERSION 1
# define FUSE_MINOR_VERSION 1
# define fuse_statfs _fuse_statfs_compat1
# define fuse_mount _fuse_mount_compat1
# define FUSE_DEBUG _FUSE_DEBUG_COMPAT1
# endif
-#elif FUSE_USE_VERSION != 22
-# error API version other than 22, 21 and 11 not supported
+#elif FUSE_USE_VERSION < 22
+# error Compatibility with API version other than 21 and 11 not supported
#endif
#ifdef __cplusplus
static void usage(const char *progname)
{
- fprintf(stderr,
- "usage: %s mountpoint [options]\n"
- "Options:\n"
+ if (progname)
+ fprintf(stderr,
+ "usage: %s mountpoint [FUSE options]\n\n", progname);
+
+ fprintf(stderr,
+ "FUSE options:\n"
" -d enable debug output (implies -f)\n"
" -f foreground operation\n"
" -s disable multithreaded operation\n"
" max_read=N set maximum size of read requests\n"
" hard_remove immediate removal (don't hide files)\n"
" debug enable debug output\n"
- " fsname=NAME set filesystem name in mtab\n",
- progname);
+ " fsname=NAME set filesystem name in mtab\n");
}
static void invalid_option(const char *argv[], int argctr)
{
fprintf(stderr, "fuse: invalid option: %s\n\n", argv[argctr]);
- usage(argv[0]);
+ fprintf(stderr, "see '%s -h' for usage\n", argv[0]);
}
static void exit_handler()
switch (argv[argctr][1]) {
case 'o':
if (argctr + 1 == argc || argv[argctr+1][0] == '-') {
- fprintf(stderr, "missing option after -o\n\n");
- usage(argv[0]);
+ fprintf(stderr, "missing option after -o\n");
+ fprintf(stderr, "see '%s -h' for usage\n", argv[0]);
goto err;
}
argctr ++;
res = add_options(lib_opts, kernel_opts, &argv[argctr][2]);
if (res == -1)
goto err;
- }
- else {
+ } else if(strcmp(argv[argctr], "-ho") == 0) {
+ usage(NULL);
+ goto err;
+ } else {
invalid_option(argv, argctr);
goto err;
}
}
if (*mountpoint == NULL) {
- fprintf(stderr, "missing mountpoint\n\n");
- usage(argv[0]);
+ fprintf(stderr, "missing mountpoint\n");
+ fprintf(stderr, "see '%s -h' for usage\n", argv[0]);
goto err;
}
return 0;
return 0;
}
-int __fuse_main(int argc, char *argv[],const struct fuse_operations *op,
+int __fuse_main(int argc, char *argv[], const struct fuse_operations *op,
size_t op_size)
{
return fuse_main_common(argc, argv, op, op_size, 0);