improved log out, fixed help message output, Makefile now generates man page

This commit is contained in:
Fufu Fang 2021-08-31 12:23:43 +01:00
parent 6713362a5f
commit 07603c36ba
No known key found for this signature in database
GPG Key ID: 0F6BB5EF6F8BB729
4 changed files with 48 additions and 20 deletions

View File

@ -55,15 +55,19 @@ ifeq ($(OS),Darwin)
$(DESTDIR)$(prefix)/share/man/man1/httpdirfs.1
endif
man: all
help2man --no-discard-stderr ./httpdirfs > doc/man/httpdirfs.1
doc:
doxygen Doxyfile
clean:
-rm -f *.o
-rm -f httpdirfs
-rm -rf doc/html
distclean: clean
-rm -rf doc/html
-rm -rf doc/man/httpdirfs.1
uninstall:
-rm -f $(DESTDIR)$(prefix)/bin/httpdirfs

View File

@ -1,10 +1,10 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.8.
.TH HTTPDIRFS "1" "August 2021" "HTTPDirFS version 1.2.2" "User Commands"
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.1.
.TH HTTPDIRFS "1" "August 2021" "HTTPDirFS version 1.2.3" "User Commands"
.SH NAME
HTTPDirFS \- manual page for HTTPDirFS version 1.2.2
HTTPDirFS \- manual page for HTTPDirFS version 1.2.3
.SH DESCRIPTION
usage: ./httpdirfs [options] URL mountpoint
.SS "General options:"
.SS "general options:"
.TP
\fB\-\-config\fR
Specify a configuration file
@ -72,6 +72,28 @@ for HTTP range requests
\fB\-\-insecure_tls\fR
Disable licurl TLS certificate verification by
setting CURLOPT_SSL_VERIFYHOST to 0
.TP
\fB\-\-single\-file\-mode\fR
Single file mode \- rather than mounting a whole
directory, present a single file inside a virtual
directory.
.IP
For mounting a Airsonic / Subsonic server:
.TP
\fB\-\-sonic\-username\fR
The username for your Airsonic / Subsonic server
.TP
\fB\-\-sonic\-password\fR
The password for your Airsonic / Subsonic server
.TP
\fB\-\-sonic\-id3\fR
Enable ID3 mode \- this present the server content in
Artist/Album/Song layout
.TP
\fB\-\-sonic\-insecure\fR
Authenticate against your Airsonic / Subsonic server
using the insecure username / hex encoded password
scheme
.SS "FUSE options:"
.TP
\fB\-d\fR \fB\-o\fR debug
@ -225,9 +247,9 @@ prepend this directory to all paths (mandatory)
\fB\-o\fR [no]rellinks
transform absolute symlinks to relative
.PP
libcurl SSL engine: OpenSSL/1.1.1d
libcurl SSL engine: OpenSSL/1.1.1k
FUSE library version: 2.9.9
fusermount version: 2.9.9
fusermount3 version: 3.10.3
using FUSE kernel interface version 7.19
.SH "SEE ALSO"
The full documentation for

View File

@ -20,38 +20,37 @@ void
log_printf(LogType type, const char *file, const char *func, int line,
const char *format, ...)
{
FILE *out = stderr;
if (type & CONFIG.log_type) {
switch (type) {
case fatal:
fprintf(out, "Fatal:");
fprintf(stderr, "Fatal:");
break;
case error:
fprintf(out, "Error:");
fprintf(stderr, "Error:");
break;
case warning:
fprintf(out, "Warning:");
fprintf(stderr, "Warning:");
break;
case info:
goto print_actual_message;
default:
fprintf(out, "Debug(%x):", type);
fprintf(stderr, "Debug(%x):", type);
break;
}
fprintf(out, "%s:%d:", file, line);
fprintf(stderr, "%s:%d:", file, line);
print_actual_message:
{
}
fprintf(out, "%s: ", func);
fprintf(stderr, "%s: ", func);
va_list args;
va_start(args, format);
vfprintf(out, format, args);
vfprintf(stderr, format, args);
va_end(args);
if (type == fatal) {
exit_failure();
}
}
}
}

View File

@ -324,7 +324,8 @@ void add_arg(char ***fuse_argv_ptr, int *fuse_argc, char *opt_string)
static void print_help(char *program_name, int long_help)
{
printf("usage: %s [options] URL mountpoint\n", program_name);
/* FUSE prints its help to stderr */
fprintf(stderr, "usage: %s [options] URL mountpoint\n", program_name);
if (long_help) {
print_long_help();
}
@ -332,17 +333,19 @@ static void print_help(char *program_name, int long_help)
static void print_version()
{
printf("HTTPDirFS version " VERSION "\n");
/* FUSE prints its help to stderr */
fprintf(stderr, "HTTPDirFS version " VERSION "\n");
/*
* --------- Print off SSL engine version ---------
*/
curl_version_info_data *data = curl_version_info(CURLVERSION_NOW);
printf("libcurl SSL engine: %s\n", data->ssl_version);
fprintf(stderr, "libcurl SSL engine: %s\n", data->ssl_version);
}
static void print_long_help()
{
printf("\n\
/* FUSE prints its help to stderr */
fprintf(stderr, "\n\
general options:\n\
--config Specify a configuration file \n\
-o opt,[opt...] Mount options\n\