now generate a separate sonicfs binary
This commit is contained in:
parent
1d2271c1f6
commit
a733ee3fdb
|
@ -4,3 +4,4 @@ httpdirfs
|
|||
.depend
|
||||
doc/html
|
||||
.vscode
|
||||
sonicfs
|
||||
|
|
19
Makefile
19
Makefile
|
@ -23,7 +23,7 @@ endif
|
|||
|
||||
prefix ?= /usr/local
|
||||
|
||||
all: httpdirfs
|
||||
all: httpdirfs sonicfs
|
||||
|
||||
%.o: src/%.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -c -o $@ $<
|
||||
|
@ -31,18 +31,18 @@ all: httpdirfs
|
|||
httpdirfs: httpdirfs.o $(COBJS)
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||
|
||||
# sonicfs: sonicfs.o $(COBJS)
|
||||
# $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||
sonicfs: sonicfs.o $(COBJS)
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||
|
||||
install:
|
||||
ifeq ($(OS),Linux)
|
||||
install -m 755 -D httpdirfs \
|
||||
install -m 755 -D httpdirfs sonicfs \
|
||||
$(DESTDIR)$(prefix)/bin/httpdirfs
|
||||
install -m 644 -D doc/man/httpdirfs.1 \
|
||||
$(DESTDIR)$(prefix)/share/man/man1/httpdirfs.1
|
||||
endif
|
||||
ifeq ($(OS),FreeBSD)
|
||||
install -m 755 httpdirfs \
|
||||
install -m 755 httpdirfs sonicfs\
|
||||
$(DESTDIR)$(prefix)/bin/httpdirfs
|
||||
gzip -f -k doc/man/httpdirfs.1
|
||||
install -m 644 doc/man/httpdirfs.1.gz \
|
||||
|
@ -50,7 +50,7 @@ ifeq ($(OS),FreeBSD)
|
|||
endif
|
||||
ifeq ($(OS),Darwin)
|
||||
install -d $(DESTDIR)$(prefix)/bin
|
||||
install -m 755 httpdirfs \
|
||||
install -m 755 httpdirfs sonicfs\
|
||||
$(DESTDIR)$(prefix)/bin/httpdirfs
|
||||
install -d $(DESTDIR)$(prefix)/share/man/man1
|
||||
install -m 644 doc/man/httpdirfs.1 \
|
||||
|
@ -62,19 +62,22 @@ doc:
|
|||
|
||||
clean:
|
||||
-rm -f *.o
|
||||
-rm -f httpdirfs
|
||||
-rm -rf doc/html
|
||||
-rm -f httpdirfs sonicfs
|
||||
|
||||
distclean: clean
|
||||
|
||||
uninstall:
|
||||
-rm -f $(DESTDIR)$(prefix)/bin/httpdirfs
|
||||
-rm -f $(DESTDIR)$(prefix)/bin/sonicfs
|
||||
ifeq ($(OS),Linux)
|
||||
-rm -f $(DESTDIR)$(prefix)/share/man/man1/httpdirfs.1
|
||||
endif
|
||||
ifeq ($(OS),FreeBSD)
|
||||
-rm -f $(DESTDIR)$(prefix)/man/man1/httpdirfs.1.gz
|
||||
endif
|
||||
ifeq ($(OS),Darwin)
|
||||
-rm -f $(DESTDIR)$(prefix)/share/man/man1/httpdirfs.1
|
||||
endif
|
||||
|
||||
depend: .depend
|
||||
.depend: src/*.c
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
|
||||
#include "main.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
return common_main(&argc, &argv);
|
||||
}
|
||||
|
||||
}
|
41
src/main.c
41
src/main.c
|
@ -202,7 +202,13 @@ void print_help(char *program_name, int long_help)
|
|||
|
||||
void print_version()
|
||||
{
|
||||
fprintf(stderr, "HTTPDirFS version " VERSION "\n");
|
||||
char *fs_name;
|
||||
if (!CONFIG.sonic_mode) {
|
||||
fs_name = "HTTPDirFS";
|
||||
} else {
|
||||
fs_name = "SonicFS";
|
||||
}
|
||||
fprintf(stderr, "%s version " VERSION "\n", fs_name);
|
||||
/* --------- Print off SSL engine version --------- */
|
||||
curl_version_info_data *data = curl_version_info(CURLVERSION_NOW);
|
||||
fprintf(stderr, "libcurl SSL engine: %s\n", data->ssl_version);
|
||||
|
@ -212,7 +218,7 @@ void print_long_help()
|
|||
{
|
||||
fprintf(stderr,
|
||||
"\n\
|
||||
general options:\n\
|
||||
General options:\n\
|
||||
--config Specify a configuration file \n\
|
||||
-o opt,[opt...] Mount options\n\
|
||||
-h --help Print help\n\
|
||||
|
@ -246,13 +252,16 @@ HTTPDirFS options:\n\
|
|||
--insecure_tls Disable licurl TLS certificate verification by\n\
|
||||
setting CURLOPT_SSL_VERIFYHOST to 0\n\
|
||||
\n");
|
||||
if (CONFIG.sonic_mode) {
|
||||
print_sonic_help();
|
||||
}
|
||||
}
|
||||
|
||||
void print_sonic_help()
|
||||
{
|
||||
fprintf(stderr,
|
||||
"\n\
|
||||
For mounting a Airsonic / Subsonic server:\n\
|
||||
Airsonic / Subsonic server specific options:\n\
|
||||
--sonic-username The username for your Airsonic / Subsonic server\n\
|
||||
--sonic-password The password for your Airsonic / Subsonic server\n\
|
||||
--sonic-id3 Enable ID3 mode - this present the server content in\n\
|
||||
|
@ -322,19 +331,19 @@ int common_main(int *argc_in, char ***argv_in)
|
|||
fprintf(stderr, "Error: Please supply a valid URL.\n");
|
||||
print_help(argv[0], 0);
|
||||
exit(EXIT_FAILURE);
|
||||
} else {
|
||||
if (CONFIG.sonic_username && CONFIG.sonic_password) {
|
||||
CONFIG.sonic_mode = 1;
|
||||
} else if (CONFIG.sonic_username || CONFIG.sonic_password) {
|
||||
fprintf(stderr,
|
||||
"Error: You have to supply both username and password to \
|
||||
activate Sonic mode.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if(!LinkSystem_init(base_url)) {
|
||||
fprintf(stderr, "Error: Network initialisation failed.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
if (CONFIG.sonic_mode &&
|
||||
!(CONFIG.sonic_username && CONFIG.sonic_password)) {
|
||||
fprintf(stderr,
|
||||
"Error: You have to supply both username and password for your\
|
||||
Sonic server account.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if(!LinkSystem_init(base_url)) {
|
||||
fprintf(stderr, "Error: Network initialisation failed.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
fuse_start:
|
||||
|
|
|
@ -42,5 +42,8 @@ void print_long_help();
|
|||
*/
|
||||
void print_sonic_help();
|
||||
|
||||
/**
|
||||
* @brief The old main function that is common to both HTTPDirFS and SonicFS
|
||||
*/
|
||||
int common_main(int *argc_in, char ***argv_in);
|
||||
#endif
|
|
@ -0,0 +1,9 @@
|
|||
#include "main.h"
|
||||
|
||||
#include "util.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
CONFIG.sonic_mode = 1;
|
||||
return common_main(&argc, &argv);
|
||||
}
|
|
@ -86,8 +86,6 @@ void Config_init(void)
|
|||
CONFIG.max_segbc = DEFAULT_MAX_SEGBC;
|
||||
|
||||
/*-------------- Sonic related -------------*/
|
||||
CONFIG.sonic_mode = 0;
|
||||
|
||||
CONFIG.sonic_username = NULL;
|
||||
|
||||
CONFIG.sonic_password = NULL;
|
||||
|
|
|
@ -26,11 +26,6 @@
|
|||
*/
|
||||
#define DEFAULT_USER_AGENT "HTTPDirFS-" VERSION
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief configuration data structure
|
||||
* \note The opening curly bracket should be at line 39, so the code belong
|
||||
|
|
Loading…
Reference in New Issue