]> Nishi Git Mirror - mandshurica.git/commitdiff
adding tool for html
authornishi <nishi@f982e544-4a7d-3444-ad1a-fde59a2a69f1>
Sat, 11 May 2024 00:58:24 +0000 (00:58 +0000)
committernishi <nishi@f982e544-4a7d-3444-ad1a-fde59a2a69f1>
Sat, 11 May 2024 00:58:24 +0000 (00:58 +0000)
git-svn-id: file:///raid/svn-main/nishi-mandshurica/trunk@74 f982e544-4a7d-3444-ad1a-fde59a2a69f1

GNUmakefile
Mandshurica/config.c
Mandshurica/main.c
Module/GNUmakefile [moved from Module/Makefile with 100% similarity]
Tool/GNUmakefile [new file with mode: 0644]
Tool/html-manage.c [new file with mode: 0644]
Webroot/GNUmakefile [moved from Webroot/Makefile with 100% similarity]

index fe196451a30d456f4670d82f0ad74aae86f539d5..84ce8d240aeaca55f267af903cc20ea1025e5fbc 100644 (file)
@@ -10,9 +10,9 @@ CFLAGS := -g -std=c99 -DPREFIX=\\\"$(PREFIX)\\\" -DWEBROOT_PREFIX=\\\"$(WEBROOT_
 LDFLAGS :=
 LIBS :=
 
-.PHONY: all clean format replace ./Mandshurica ./Module
+.PHONY: all clean format replace ./Mandshurica ./Module ./Tool
 
-all: ./Mandshurica ./Module
+all: ./Mandshurica ./Module ./Tool
 
 ./Mandshurica::
        $(MAKE) -C $@ CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)"
@@ -20,6 +20,9 @@ all: ./Mandshurica ./Module
 ./Module::
        $(MAKE) -C $@ CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)"
 
+./Tool::
+       $(MAKE) -C $@ CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)"
+
 
 format:
        clang-format -i $(wildcard Module/*.c Module/*.h Mandshurica/*.c Mandshurica/*.h)
@@ -35,3 +38,4 @@ replace:
 clean:
        $(MAKE) -C ./Mandshurica clean
        $(MAKE) -C ./Module clean
+       $(MAKE) -C ./Tool clean
index 7c500e60174456e9c01995df529cbfec567dd3af..00535e41f5d7199e616f9ee370a8c71025db7635 100644 (file)
@@ -49,6 +49,8 @@
 int nloaded_mods = 0;
 int nerror_mods = 0;
 
+char* loaded_config = NULL;
+
 void mandshurica_add_mod(void* lib) {
        struct mandshurica_mod** old_mods = loaded_mods;
        int i;
@@ -95,6 +97,8 @@ char* mandshurica_get_param(const char* param) {
 struct mandshurica_config config = {.mandshurica_log = mandshurica_log, .mandshurica_get_param = mandshurica_get_param, .mandshurica_parse_template = mandshurica_parse_template, .mandshurica_load = mandshurica_load, .mandshurica_sha512 = mandshurica_sha512};
 
 int mandshurica_load_config(const char* path) {
+       if(loaded_config != NULL) free(loaded_config);
+       loaded_config = mandshurica_strdup(path);
        if(server_root == NULL) {
                server_root = mandshurica_strdup(PREFIX);
        }
index 2b844b40d229ba94462f670b4ffa301c4b7c3916..b0c113b9a6168b87a0a2ab45952ea4d3fd7fd75c 100644 (file)
@@ -59,7 +59,7 @@ int main(int argc, char** argv) {
                                if(argv[i] == NULL) {
                                        fprintf(stderr, "%s: %s: needs argument\n", argv[0], argv[i - 1]);
                                        return 1;
-                               } else {
+                               } else if(!loaded_config) {
                                        int ret = mandshurica_load_config(argv[i]);
                                        if(ret != 0) return ret;
                                        loaded_config = true;
similarity index 100%
rename from Module/Makefile
rename to Module/GNUmakefile
diff --git a/Tool/GNUmakefile b/Tool/GNUmakefile
new file mode 100644 (file)
index 0000000..da09fae
--- /dev/null
@@ -0,0 +1,24 @@
+# $Id$
+
+EXTRA_CFLAGS =
+EXTRA_LDFLAGS =
+EXTRA_LIBS =
+
+.PHONY: all clean
+
+all: ./html-manage
+
+./html-manage: ./html-manage.o ./util.o ./db.o
+       $(CC) $(LDFLAGS) $(EXTRA_LDFLAGS) -o $@ $^ $(LIBS) $(EXTRA_LIBS)
+
+./html-manage.o: ./html-manage.c
+       $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+
+./util.o: ../Mandshurica/util.c
+       $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+
+./db.o: ../Mandshurica/db.c
+       $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+       
+clean:
+       rm -f ./html-manage *.o
diff --git a/Tool/html-manage.c b/Tool/html-manage.c
new file mode 100644 (file)
index 0000000..fae0cbc
--- /dev/null
@@ -0,0 +1,12 @@
+/* $Id$ */
+/* --- START LICENSE --- */
+/* --- END LICENSE --- */
+
+#include <stdio.h>
+
+int main(int argc, char** argv){
+       if(argc < 2){
+               printf("invalid usage\n");
+       }
+       printf("%s\n", argv[1]);
+}
similarity index 100%
rename from Webroot/Makefile
rename to Webroot/GNUmakefile