diff --git a/Makefile b/Makefile index aa006f4..bec88a3 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ CFLAGS = -I external/xemil/include -I src LDFLAGS = LIBS = -.PHONY: all clean +.PHONY: all format clean all: taiga @@ -12,5 +12,8 @@ include objs.mk taiga$(E): $(OBJS) $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) +format: + clang-format --verbose -i `find src -name "*.c" -or -name "*.h"` + clean: rm -f src/*.o taiga taiga.exe diff --git a/objs.mk b/objs.mk index d13c745..53330de 100644 --- a/objs.mk +++ b/objs.mk @@ -20,6 +20,15 @@ src/src_classic.o: src/classic.c OBJS += src/src_help.o src/src_help.o: src/help.c $(CC) $(CFLAGS) -c -o $@ src/help.c +OBJS += src/src_image_fill.o +src/src_image_fill.o: src/image/fill.c + $(CC) $(CFLAGS) -c -o $@ src/image/fill.c +OBJS += src/src_image_valid-css.o +src/src_image_valid-css.o: src/image/valid-css.c + $(CC) $(CFLAGS) -c -o $@ src/image/valid-css.c +OBJS += src/src_image_valid-html401.o +src/src_image_valid-html401.o: src/image/valid-html401.c + $(CC) $(CFLAGS) -c -o $@ src/image/valid-html401.c OBJS += src/src_main.o src/src_main.o: src/main.c $(CC) $(CFLAGS) -c -o $@ src/main.c diff --git a/objs.sh b/objs.sh index 3defe80..be0c674 100755 --- a/objs.sh +++ b/objs.sh @@ -1,6 +1,6 @@ #!/bin/sh echo > objs.mk -ls src/*.c external/xemil/src/*.c | while read a; do +ls src/*.c src/image/*.c external/xemil/src/*.c | while read a; do O="src/`echo "$a" | sed 's/.c$/.o/' | sed 's/\//_/g'`" echo "OBJS += $O" >> objs.mk echo "$O: $a" >> objs.mk diff --git a/src/classic.c b/src/classic.c index 81e17b7..d89f033 100644 --- a/src/classic.c +++ b/src/classic.c @@ -1,6 +1,25 @@ #include -void classic_stylesheet(FILE* out){ +#include "image/fill.h" + +void classic_stylesheet(FILE* out, const char* top) { + FILE* f; + char path[128]; + char* breadcrumb_bgcolor = NULL; + xl_node_t** nodes; + + sprintf(path, "%sfill.gif", top); + f = fopen(path, "wb"); + fwrite(image_fill, 1, image_fill_len, f); + fclose(f); + + if((nodes = xl_get_path(skinconf->root, "breadcrumb")) != NULL) { + breadcrumb_bgcolor = xl_get_attribute(nodes[0], "color"); + + free(nodes); + } + if(breadcrumb_bgcolor == NULL) breadcrumb_bgcolor = "#003366"; + fprintf(out, "body {\n"); fprintf(out, " padding: 0;\n"); fprintf(out, " margin: 0;\n"); @@ -8,13 +27,20 @@ void classic_stylesheet(FILE* out){ fprintf(out, "}\n"); fprintf(out, "\n"); fprintf(out, "#breadcrumb {\n"); - fprintf(out, " background-color: #600000;\n"); + fprintf(out, " background-color: %s;\n", breadcrumb_bgcolor); fprintf(out, " font-weight: bold;\n"); fprintf(out, " color: #fff;\n"); fprintf(out, " padding-left: 8px;\n"); fprintf(out, " padding-top: 2px;\n"); fprintf(out, " padding-bottom: 2px;\n"); fprintf(out, "}\n"); + fprintf(out, "form {\n"); + fprintf(out, " margin-top: 0;\n"); + fprintf(out, " margin-bottom: 0;\n"); + fprintf(out, "}\n"); + fprintf(out, "#breadcrumb, #breadcrumb *, #copyright, #nav {\n"); + fprintf(out, " font-size: x-small;\n"); + fprintf(out, "}\n"); fprintf(out, "\n"); fprintf(out, "#nav {\n"); fprintf(out, " background-color: #eeeeee;\n"); @@ -75,9 +101,107 @@ void classic_stylesheet(FILE* out){ fprintf(out, "}\n"); } -void classic_head(FILE* out, const char* top, xl_node_t* header){ +void classic_head(FILE* out, const char* top, xl_node_t* header) { fprintf(out, " \n", top); } -void classic_body(FILE* out, const char* top, const char* title, xl_node_t* body){ +void classic_body(FILE* out, const char* top, const char* title, xl_node_t* body) { + char year[4 + 1 + 4 + 1]; /* no one would use our software in year 10000... right? :) */ + char* holder = "Unknown people"; + char* sitesearch = NULL; + xl_node_t** nodes; + + strcpy(year, "Some year"); + + if((nodes = xl_get_path(skinconf->root, "copyright.holder")) != NULL) { + holder = nodes[0]->text; + + free(nodes); + } + + if((nodes = xl_get_path(skinconf->root, "copyright.year")) != NULL) { + time_t t = time(NULL); + struct tm* tm = localtime(&t); + int cyear = tm->tm_year + 1900; + int xyear = atoi(nodes[0]->text); + + if(cyear == xyear) { + sprintf(year, "%d", cyear); + } else { + int low = cyear < xyear ? cyear : xyear; + int high = cyear > xyear ? cyear : xyear; + + sprintf(year, "%d-%d", low, high); + } + + free(nodes); + } + + if((nodes = xl_get_path(skinconf->root, "search")) != NULL) { + sitesearch = xl_get_attribute(nodes[0], "domain"); + + free(nodes); + } + if(sitesearch == NULL) sitesearch = "https://invalid.link"; + + fprintf(out, " \n"); + fprintf(out, " \n"); + fprintf(out, " \n"); + fprintf(out, " \n"); + fprintf(out, " \n"); + fprintf(out, "
\n"); + if((nodes = xl_get_path(skinconf->root, "breadcrumb.link")) != NULL) { + int i; + + for(i = 0; nodes[i] != NULL; i++) { + char* link = xl_get_attribute(nodes[i], "href"); + char* name = xl_get_attribute(nodes[i], "name"); + + if(link == NULL) link = "https://invalid.link"; + if(title == NULL) title = link; + + if(i > 0) fprintf(out, " |\n"); + fprintf(out, " %s\n", link, name); + } + + free(nodes); + } + fprintf(out, " \n"); + fprintf(out, "
\n"); + fprintf(out, " Search\n"); + fprintf(out, " \n", sitesearch); + fprintf(out, " \n"); + fprintf(out, " \n"); + fprintf(out, "
\n"); + fprintf(out, "
\n"); + fprintf(out, " \n"); + fprintf(out, " \n"); + fprintf(out, " \n"); + fprintf(out, " \n"); + fprintf(out, " \n"); + fprintf(out, "
\n"); + fprintf(out, "
\n"); + fprintf(out, "
\n"); + fprintf(out, "
\n"); + fprintf(out, "
\n"); + fprintf(out, "
\n"); + fprintf(out, "
\n"); + fprintf(out, "
\n"); + fprintf(out, " Copyright © %s %s%s All rights reserved.\n", year, holder, (strlen(holder) > 0 && holder[strlen(holder) - 1] == '.') ? "" : "."); + fprintf(out, "
\n"); + fprintf(out, " \n"); } diff --git a/src/classic.c~ b/src/classic.c~ new file mode 100644 index 0000000..5d29dc5 --- /dev/null +++ b/src/classic.c~ @@ -0,0 +1,151 @@ +#include + +#include "image/fill.h" + +void classic_stylesheet(FILE* out, const char* top) { + FILE* f; + char path[128]; + + sprintf(path, "%sfill.gif", top); + f = fopen(path, "wb"); + fwrite(image_fill, 1, image_fill_len, f); + fclose(f); + + fprintf(out, "body {\n"); + fprintf(out, " padding: 0;\n"); + fprintf(out, " margin: 0;\n"); + fprintf(out, " font-family: Arial, sans-serif;\n"); + fprintf(out, "}\n"); + fprintf(out, "\n"); + fprintf(out, "#breadcrumb {\n"); + fprintf(out, " background-color: #600000;\n"); + fprintf(out, " font-weight: bold;\n"); + fprintf(out, " color: #fff;\n"); + fprintf(out, " padding-left: 8px;\n"); + fprintf(out, " padding-top: 2px;\n"); + fprintf(out, " padding-bottom: 2px;\n"); + fprintf(out, "}\n"); + fprintf(out, "\n"); + fprintf(out, "#nav {\n"); + fprintf(out, " background-color: #eeeeee;\n"); + fprintf(out, " border-right: solid 1px #aaaaaa;\n"); + fprintf(out, " border-bottom: solid 1px #aaaaaa;\n"); + fprintf(out, " padding: 8px;\n"); + fprintf(out, "}\n"); + fprintf(out, "\n"); + fprintf(out, "#content {\n"); + fprintf(out, " padding: 8px;\n"); + fprintf(out, "}\n"); + fprintf(out, "\n"); + fprintf(out, ".section {\n"); + fprintf(out, " background-color: #eeeeee;\n"); + fprintf(out, " padding-left: 8px;\n"); + fprintf(out, " font-weight: bold;\n"); + fprintf(out, " color: #000088;\n"); + fprintf(out, "}\n"); + fprintf(out, "\n"); + fprintf(out, "a {\n"); + fprintf(out, " text-decoration: none;\n"); + fprintf(out, "}\n"); + fprintf(out, "\n"); + fprintf(out, "#breadcrumb a {\n"); + fprintf(out, " color: #ffff44;\n"); + fprintf(out, "}\n"); + fprintf(out, "\n"); + fprintf(out, "a:link {\n"); + fprintf(out, " color: #003366;\n"); + fprintf(out, "}\n"); + fprintf(out, "\n"); + fprintf(out, "a:visited {\n"); + fprintf(out, " color: blue;\n"); + fprintf(out, "}\n"); + fprintf(out, "\n"); + fprintf(out, "a:hover, #breadcrumb a:hover {\n"); + fprintf(out, " color: #ff3300;\n"); + fprintf(out, "}\n"); + fprintf(out, "\n"); + fprintf(out, ".linkgroup {\n"); + fprintf(out, " padding-left: 16px;\n"); + fprintf(out, "}\n"); + fprintf(out, "\n"); + fprintf(out, ".linkgrouptitle {\n"); + fprintf(out, " font-weight: bold;\n"); + fprintf(out, "}\n"); + fprintf(out, "\n"); + fprintf(out, "#content p {\n"); + fprintf(out, " padding-left: 8px;\n"); + fprintf(out, "}\n"); + fprintf(out, "\n"); + fprintf(out, "tr.even {\n"); + fprintf(out, " background-color: #eeeeee;\n"); + fprintf(out, "}\n"); + fprintf(out, "\n"); + fprintf(out, "tr.odd {\n"); + fprintf(out, " background-color: #dddddd;\n"); + fprintf(out, "}\n"); +} + +void classic_head(FILE* out, const char* top, xl_node_t* header) { + fprintf(out, " \n", top); +} + +void classic_body(FILE* out, const char* top, const char* title, xl_node_t* body) { + char year[4 + 1 + 4 + 1]; /* no one would use our software in year 10000... right? :) */ + char* holder = "Unknown people"; + xl_node_t** nodes; + + strcpy(year, "Some year"); + + if((nodes = xl_get_path(skinconf->root, "copyright.holder")) != NULL) { + holder = nodes[0]->text; + + free(nodes); + } + + if((nodes = xl_get_path(skinconf->root, "copyright.year")) != NULL) { + time_t t = time(NULL); + struct tm* tm = localtime(&t); + int cyear = tm->tm_year + 1900; + int xyear = atoi(nodes[0]->text); + + if(cyear == xyear){ + sprintf(year, "%d", cyear); + }else{ + int low = cyear < xyear ? cyear : xyear; + int high = cyear > xyear ? cyear : xyear; + + sprintf(year, "%d-%d", low, high); + } + + free(nodes); + } + + fprintf(out, " \n"); + fprintf(out, " \n"); + fprintf(out, " \n"); + fprintf(out, " \n"); + fprintf(out, " \n"); + fprintf(out, " \n"); + fprintf(out, " \n"); + fprintf(out, "
\n"); + fprintf(out, "
\n"); + fprintf(out, "
\n"); + fprintf(out, "
\n"); + fprintf(out, " Copyright © %s %s%s All rights reserved.\n", year, holder, (strlen(holder) > 0 && holder[strlen(holder) - 1] == '.') ? "" : "."); + fprintf(out, "
\n"); + fprintf(out, " \n"); +} diff --git a/src/help.c b/src/help.c index 17e3d3d..b3d7fcb 100644 --- a/src/help.c +++ b/src/help.c @@ -1,6 +1,6 @@ #include -int action_help(int argc, char** argv){ +int action_help(int argc, char** argv) { printf("Actions:\n"); printf(" help Show this help\n"); printf(" seed Creates a new website\n"); diff --git a/src/image/fill.c b/src/image/fill.c new file mode 100644 index 0000000..2a1b13e --- /dev/null +++ b/src/image/fill.c @@ -0,0 +1,6 @@ +unsigned char image_fill[] = { + 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00, 0xf0, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0xf9, 0x04, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, + 0x00, 0x02, 0x02, 0x44, 0x01, 0x00, 0x3b}; +unsigned int image_fill_len = 43; diff --git a/src/image/fill.gif b/src/image/fill.gif new file mode 100644 index 0000000..3c51d74 Binary files /dev/null and b/src/image/fill.gif differ diff --git a/src/image/fill.h b/src/image/fill.h new file mode 100644 index 0000000..afe2e87 --- /dev/null +++ b/src/image/fill.h @@ -0,0 +1,2 @@ +extern unsigned char image_fill[]; +extern unsigned int image_fill_len; diff --git a/src/image/gen.sh b/src/image/gen.sh new file mode 100755 index 0000000..9a94d23 --- /dev/null +++ b/src/image/gen.sh @@ -0,0 +1,13 @@ +#!/bin/sh +if [ -d src ]; then + cd src +fi +if [ -d image ]; then + cd image +fi +for i in *.gif *.png; do + NAME="`echo "$i" | rev | cut -d/ -f1 | rev | cut -d. -f1`" + xxd -i -n image_$NAME $i > $NAME.c + echo "extern unsigned char image_$NAME[];" > $NAME.h + echo "extern unsigned int image_${NAME}_len;" >> $NAME.h +done diff --git a/src/image/valid-css.c b/src/image/valid-css.c new file mode 100644 index 0000000..d0a9c31 --- /dev/null +++ b/src/image/valid-css.c @@ -0,0 +1,97 @@ +unsigned char image_valid_css[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, + 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x1f, + 0x08, 0x03, 0x00, 0x00, 0x00, 0x54, 0x16, 0xfa, 0xd2, 0x00, 0x00, 0x01, + 0x29, 0x50, 0x4c, 0x54, 0x45, 0x00, 0x00, 0x00, 0x23, 0x23, 0x1f, 0x0c, + 0x47, 0x9d, 0x59, 0x55, 0x4a, 0x80, 0x76, 0x59, 0x9d, 0x9d, 0x9d, 0xde, + 0x8c, 0x45, 0x8b, 0x0c, 0x0b, 0x8d, 0x8d, 0x8d, 0x64, 0x88, 0xc1, 0xb4, + 0x9f, 0x67, 0x7d, 0x7d, 0x7d, 0x7d, 0x1a, 0x17, 0xeb, 0xa7, 0x51, 0x6d, + 0x6d, 0x6d, 0xf2, 0xdf, 0xdf, 0xb7, 0x3e, 0x1e, 0xa5, 0x21, 0x13, 0x5d, + 0x5d, 0x5d, 0xaa, 0x24, 0x11, 0x5c, 0x55, 0x48, 0x5c, 0x55, 0x48, 0x4f, + 0x4f, 0x4f, 0xdd, 0xb2, 0x6a, 0x54, 0x7c, 0xba, 0xf9, 0xef, 0xef, 0xee, + 0xee, 0xee, 0x3f, 0x3c, 0x35, 0x99, 0x00, 0x00, 0x99, 0x00, 0x00, 0xce, + 0xa7, 0x51, 0x9d, 0x1b, 0x11, 0xbe, 0x4b, 0x24, 0xe0, 0xbe, 0x73, 0x5d, + 0x4b, 0x24, 0xb3, 0x93, 0x5e, 0xbe, 0x9a, 0x4b, 0xb1, 0xc3, 0xe0, 0x4e, + 0x4b, 0x40, 0x4e, 0x4b, 0x40, 0xce, 0xce, 0xce, 0xcc, 0xcc, 0xcc, 0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e, 0x53, 0xff, 0xf3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xff, + 0xff, 0xff, 0xff, 0xa2, 0xff, 0xff, 0xf3, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xff, 0xff, 0xd3, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xa2, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x30, 0xff, 0xff, 0xff, 0xff, 0xa2, 0x00, + 0xff, 0x10, 0x20, 0x30, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xf3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x30, 0xd3, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xb3, 0x7a, 0x17, 0x9b, 0x00, 0x00, 0x02, + 0x91, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0xed, 0x95, 0x7d, 0x53, 0xd3, + 0x40, 0x10, 0xc6, 0xd7, 0xd5, 0x6a, 0x0b, 0xa2, 0xd8, 0xfa, 0x52, 0xab, + 0x44, 0x8c, 0x45, 0x41, 0xa1, 0x52, 0x04, 0xfb, 0x92, 0xbe, 0x10, 0x4f, + 0x17, 0xc4, 0x88, 0x51, 0x92, 0xb6, 0x27, 0x96, 0x1a, 0xbf, 0xff, 0x87, + 0x70, 0xef, 0x2e, 0x65, 0xd2, 0xea, 0x4c, 0x2b, 0x14, 0xfe, 0x72, 0xa7, + 0xc9, 0x6c, 0x2f, 0x93, 0x5f, 0xee, 0x9e, 0x7b, 0x76, 0x0f, 0xd6, 0x66, + 0x1f, 0xef, 0x3f, 0x70, 0xc0, 0x1a, 0x4d, 0x11, 0x72, 0xfa, 0x78, 0x3a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f3, 0x15, 0xe0, 0x2e, 0xb5, 0xf8, 0xca, 0xf3, 0xdc, 0x7d, 0x96, + 0x22, 0x69, 0xb7, 0x01, 0x38, 0x96, 0xac, 0x08, 0xb0, 0x65, 0x15, 0x9c, + 0x50, 0x0e, 0x44, 0x8f, 0x87, 0x60, 0x20, 0x43, 0x31, 0x0e, 0xfe, 0xb2, + 0xc4, 0x71, 0xdc, 0x36, 0xe0, 0x2e, 0xb6, 0x78, 0xef, 0xd8, 0x76, 0x75, + 0x35, 0xeb, 0xb2, 0x72, 0x85, 0x4f, 0x87, 0x49, 0xb0, 0x0b, 0xcd, 0xf8, + 0xcd, 0x90, 0xbd, 0x02, 0x8e, 0x5d, 0x91, 0x96, 0x4a, 0xc0, 0xb5, 0x46, + 0xc1, 0x3f, 0x96, 0x74, 0xbc, 0x34, 0x60, 0xe6, 0x75, 0xb1, 0xa1, 0x24, + 0x50, 0x3a, 0x13, 0xf9, 0x01, 0x96, 0x29, 0x9d, 0x04, 0xdb, 0x1a, 0x5c, + 0xac, 0xf6, 0xa4, 0x55, 0x6d, 0x8a, 0x5f, 0x0c, 0x94, 0xb5, 0x81, 0x2d, + 0x94, 0x40, 0x23, 0xdc, 0x65, 0xc3, 0xfd, 0xf6, 0x30, 0xae, 0xbc, 0x80, + 0x75, 0xe8, 0xb2, 0x1a, 0xa8, 0x9d, 0x41, 0x2c, 0x35, 0x7a, 0xab, 0x49, + 0x70, 0x0f, 0x1c, 0x66, 0xae, 0x33, 0x5e, 0xa8, 0x4f, 0xb8, 0x20, 0x58, + 0x13, 0x57, 0xca, 0x26, 0x38, 0x7f, 0xe5, 0x7e, 0x8c, 0xc1, 0x19, 0xbd, + 0x73, 0x6c, 0x5f, 0xed, 0x65, 0x5d, 0x2d, 0xfe, 0x68, 0x49, 0xdb, 0x7a, + 0xe1, 0xeb, 0x15, 0x23, 0x05, 0x40, 0x28, 0x2d, 0x47, 0x27, 0x6a, 0x25, + 0x8b, 0xcb, 0xe3, 0xdc, 0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 0xe9, 0xb2, 0x4e, 0xe9, 0x9f, 0x93, + 0x63, 0x6e, 0xfa, 0x78, 0x7d, 0xed, 0x6e, 0x0c, 0xbe, 0xff, 0x79, 0x72, + 0xdc, 0x9b, 0x3e, 0xae, 0x3e, 0xba, 0xa2, 0xc1, 0xbf, 0x01, 0x5e, 0x61, + 0xb6, 0x06, 0x90, 0xf5, 0x27, 0x91, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, + 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82}; +unsigned int image_valid_css_len = 1134; diff --git a/src/image/valid-css.h b/src/image/valid-css.h new file mode 100644 index 0000000..cd564b2 --- /dev/null +++ b/src/image/valid-css.h @@ -0,0 +1,2 @@ +extern unsigned char image_valid - css[]; +extern unsigned int image_valid - css_len; diff --git a/src/image/valid-css.png b/src/image/valid-css.png new file mode 100644 index 0000000..9b2f596 Binary files /dev/null and b/src/image/valid-css.png differ diff --git a/src/image/valid-html401.c b/src/image/valid-html401.c new file mode 100644 index 0000000..6c1c0f0 --- /dev/null +++ b/src/image/valid-html401.c @@ -0,0 +1,188 @@ +unsigned char image_valid_html401[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, + 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x1f, + 0x08, 0x03, 0x00, 0x00, 0x00, 0x54, 0x16, 0xfa, 0xd2, 0x00, 0x00, 0x00, + 0x04, 0x67, 0x41, 0x4d, 0x41, 0x00, 0x00, 0xb1, 0x8f, 0x0b, 0xfc, 0x61, + 0x05, 0x00, 0x00, 0x00, 0x20, 0x63, 0x48, 0x52, 0x4d, 0x00, 0x00, 0x7a, + 0x26, 0x00, 0x00, 0x80, 0x84, 0x00, 0x00, 0xfa, 0x00, 0x00, 0x00, 0x80, + 0xe8, 0x00, 0x00, 0x75, 0x30, 0x00, 0x00, 0xea, 0x60, 0x00, 0x00, 0x3a, + 0x98, 0x00, 0x00, 0x17, 0x70, 0x9c, 0xba, 0x51, 0x3c, 0x00, 0x00, 0x02, + 0x7c, 0x50, 0x4c, 0x54, 0x45, 0xff, 0xff, 0xff, 0xf7, 0xf7, 0xf7, 0xff, + 0xef, 0xef, 0xce, 0xce, 0xce, 0xce, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0xde, + 0xde, 0xde, 0xff, 0xff, 0xff, 0xff, 0xef, 0xd6, 0xff, 0xce, 0x6b, 0xde, + 0xb5, 0x5a, 0x94, 0x73, 0x39, 0x9c, 0x94, 0x7b, 0xff, 0xce, 0x63, 0x94, + 0x6b, 0x29, 0x94, 0x8c, 0x73, 0x94, 0x73, 0x31, 0x94, 0x8c, 0x7b, 0xff, + 0xf7, 0xd6, 0xff, 0xc6, 0x63, 0xf7, 0xc6, 0x63, 0xf7, 0xbd, 0x5a, 0xde, + 0xad, 0x52, 0xf7, 0xff, 0xff, 0xff, 0xd6, 0x6b, 0xc6, 0x9c, 0x4a, 0x18, + 0x10, 0x08, 0x84, 0x63, 0x31, 0xbd, 0x94, 0x4a, 0x9c, 0x7b, 0x39, 0xce, + 0xa5, 0x52, 0x21, 0x18, 0x08, 0xd6, 0xad, 0x5a, 0x84, 0x6b, 0x31, 0x31, + 0x29, 0x10, 0xef, 0xbd, 0x63, 0x29, 0x21, 0x10, 0xff, 0xe7, 0x73, 0x8c, + 0x73, 0x39, 0xb5, 0x94, 0x4a, 0xce, 0xde, 0xe7, 0x21, 0x52, 0x94, 0x73, + 0x9c, 0xbd, 0xb5, 0xce, 0xde, 0x8c, 0xad, 0xce, 0xe7, 0xef, 0xf7, 0x31, + 0x6b, 0xa5, 0x29, 0x63, 0x9c, 0x4a, 0x7b, 0xad, 0xf7, 0xf7, 0xf7, 0x94, + 0x94, 0x94, 0x7b, 0x7b, 0x7b, 0xd6, 0xd6, 0xd6, 0xde, 0xe7, 0xe7, 0x00, + 0x00, 0x00, 0x73, 0x5a, 0x31, 0x7b, 0x63, 0x31, 0xef, 0xc6, 0x63, 0x9c, + 0x84, 0x42, 0x63, 0x52, 0x29, 0x6b, 0x5a, 0x29, 0xff, 0xef, 0x73, 0xa5, + 0x84, 0x42, 0xef, 0xef, 0xf7, 0x00, 0x4a, 0x8c, 0x21, 0x5a, 0x9c, 0xd6, + 0xde, 0xef, 0x00, 0x39, 0x84, 0x39, 0x73, 0xa5, 0x00, 0x42, 0x8c, 0x00, + 0x42, 0x84, 0x00, 0x31, 0x84, 0x6b, 0x6b, 0x6b, 0xb5, 0xb5, 0xb5, 0x52, + 0x42, 0x21, 0x4a, 0x39, 0x18, 0xff, 0xde, 0x6b, 0x63, 0x4a, 0x21, 0xe7, + 0xb5, 0x5a, 0x08, 0x08, 0x08, 0xad, 0x84, 0x42, 0x5a, 0x84, 0xb5, 0xc6, + 0xd6, 0xe7, 0x42, 0x7b, 0xad, 0xde, 0xe7, 0xef, 0x00, 0x31, 0x7b, 0x52, + 0x84, 0xb5, 0xd6, 0xe7, 0xef, 0xa5, 0xbd, 0xd6, 0x08, 0x4a, 0x8c, 0xce, + 0xd6, 0xe7, 0xef, 0xef, 0xef, 0x29, 0x29, 0x29, 0x42, 0x42, 0x42, 0x18, + 0x18, 0x18, 0x10, 0x10, 0x10, 0xef, 0xbd, 0x5a, 0x42, 0x31, 0x18, 0x08, + 0x08, 0x00, 0xad, 0x8c, 0x42, 0x84, 0xa5, 0xc6, 0x73, 0x9c, 0xc6, 0x94, + 0xb5, 0xce, 0x63, 0x94, 0xbd, 0x8c, 0x8c, 0x8c, 0x63, 0x63, 0x63, 0x39, + 0x39, 0x39, 0x6b, 0x52, 0x29, 0xe7, 0xbd, 0x63, 0xc6, 0x9c, 0x52, 0x18, + 0x5a, 0x94, 0x10, 0x52, 0x94, 0x7b, 0x5a, 0x31, 0xe7, 0xbd, 0x5a, 0x39, + 0x31, 0x18, 0x5a, 0x42, 0x21, 0x94, 0x94, 0x7b, 0xde, 0xa5, 0xa5, 0xd6, + 0x8c, 0x8c, 0x08, 0x4a, 0x94, 0xad, 0xc6, 0xde, 0x31, 0x31, 0x31, 0xd6, + 0xa5, 0x52, 0x39, 0x29, 0x18, 0x73, 0x5a, 0x29, 0x84, 0x39, 0x29, 0x9c, + 0x00, 0x00, 0x94, 0x00, 0x00, 0xc6, 0x6b, 0x6b, 0x00, 0x29, 0x7b, 0x7b, + 0x9c, 0xc6, 0x6b, 0x94, 0xbd, 0xef, 0xf7, 0xf7, 0x52, 0x52, 0x52, 0xff, + 0xd6, 0x63, 0xa5, 0x52, 0x29, 0xbd, 0x5a, 0x5a, 0x42, 0x73, 0xad, 0x10, + 0x4a, 0x8c, 0xce, 0x7b, 0x39, 0xde, 0xad, 0xad, 0xde, 0x84, 0x42, 0xc6, + 0x73, 0x73, 0x39, 0x6b, 0xa5, 0x84, 0xad, 0xce, 0xbd, 0xce, 0xde, 0xf7, + 0xf7, 0xff, 0xce, 0xa5, 0x5a, 0xb5, 0x94, 0x5a, 0xd6, 0xad, 0x63, 0xe7, + 0xb5, 0x63, 0xa5, 0x8c, 0x5a, 0x8c, 0x7b, 0x52, 0xce, 0xad, 0x63, 0xd6, + 0x73, 0x39, 0xef, 0xad, 0x52, 0x42, 0x4a, 0x4a, 0x39, 0x39, 0x4a, 0xc6, + 0xa5, 0x5a, 0x52, 0x52, 0x4a, 0x42, 0x42, 0x4a, 0x39, 0x42, 0x4a, 0xd6, + 0xb5, 0x63, 0x7b, 0x6b, 0x52, 0xce, 0x63, 0x31, 0xad, 0x21, 0x10, 0xe7, + 0x94, 0x4a, 0x9c, 0x08, 0x08, 0xce, 0x7b, 0x7b, 0x63, 0x8c, 0xbd, 0xbd, + 0xbd, 0xbd, 0xad, 0xad, 0xad, 0xad, 0x8c, 0x5a, 0x6b, 0x63, 0x52, 0x94, + 0x7b, 0x52, 0x5a, 0x52, 0x4a, 0xad, 0x94, 0x5a, 0x7b, 0x73, 0x52, 0xad, + 0x6b, 0x63, 0x9c, 0xb5, 0xd6, 0xbd, 0x9c, 0x5a, 0x63, 0x5a, 0x52, 0xf7, + 0xce, 0x63, 0xde, 0xb5, 0x63, 0xb5, 0x9c, 0x5a, 0x9c, 0x84, 0x5a, 0xde, + 0x8c, 0x42, 0x8c, 0x29, 0x08, 0x10, 0x5a, 0x94, 0x5a, 0x5a, 0x5a, 0x4a, + 0x4a, 0x4a, 0x73, 0x6b, 0x52, 0xb5, 0x39, 0x18, 0xb5, 0x4a, 0x21, 0x94, + 0x7b, 0x39, 0xbd, 0xd6, 0xe7, 0xbd, 0xa5, 0x5a, 0x94, 0x84, 0x52, 0xbd, + 0x4a, 0x21, 0xc6, 0x5a, 0x29, 0xce, 0x6b, 0x31, 0x9c, 0x8c, 0x5a, 0x84, + 0x73, 0x52, 0x9c, 0x08, 0x00, 0xbd, 0xc6, 0xc6, 0xbd, 0xb5, 0x9c, 0xbd, + 0x9c, 0x4a, 0x6b, 0x52, 0x21, 0x73, 0x73, 0x73, 0x5a, 0x4a, 0x21, 0x29, + 0x21, 0x08, 0x7b, 0x73, 0x6b, 0xe3, 0xd3, 0xe1, 0x15, 0x00, 0x00, 0x00, + 0x03, 0x74, 0x52, 0x4e, 0x53, 0x00, 0x00, 0x22, 0x2f, 0x16, 0x85, 0x3a, + 0x00, 0x00, 0x00, 0x01, 0x62, 0x4b, 0x47, 0x44, 0x00, 0x88, 0x05, 0x1d, + 0x48, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, + 0x12, 0x00, 0x00, 0x0b, 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x07, 0x74, 0x49, 0x4d, 0x45, 0x07, 0xe8, 0x0c, 0x0f, 0x11, 0x32, + 0x24, 0x67, 0xc7, 0xb7, 0xff, 0x00, 0x00, 0x05, 0x14, 0x49, 0x44, 0x41, + 0x54, 0x48, 0xc7, 0xb5, 0x56, 0xfd, 0x5f, 0x53, 0x55, 0x1c, 0xb6, 0x08, +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, 0x92, 0x6c, 0x49, 0x59, 0x6d, 0xb1, 0xa4, 0x5a, 0x2c, 0x96, 0x35, + 0x69, 0x96, 0xf4, 0x0c, 0x4c, 0x92, 0x32, 0x2d, 0xcb, 0xac, 0x59, 0x96, + 0x6c, 0x72, 0x87, 0x72, 0x34, 0xe3, 0x9c, 0xb5, 0xeb, 0xe0, 0xd7, 0xb9, + 0x6b, 0xf3, 0x18, 0x48, 0x7e, 0x81, 0x8d, 0x5b, 0x21, 0x42, 0xf6, 0xf5, + 0x45, 0x09, 0xc8, 0xb1, 0x81, 0x49, 0x41, 0xb2, 0xe9, 0x46, 0xab, 0x35, + 0x99, 0x3a, 0x8b, 0x4b, 0xb2, 0x68, 0x6a, 0x49, 0x49, 0x71, 0x29, 0xa5, + 0x59, 0x84, 0x3c, 0x4e, 0xa9, 0xf3, 0x09, 0x27, 0x2d, 0x23, 0xf8, 0xae, + 0x1a, 0x6f, 0x2a, 0xdf, 0x0c, 0x88, 0x15, 0x62, 0x25, 0x03, 0xce, 0x15, + 0x45, 0x49, 0x92, 0x5c, 0x55, 0x30, 0xd9, 0x42, 0x29, 0x4d, 0x2c, 0xda, + 0xca, 0x19, 0x27, 0xd3, 0x74, 0xa7, 0xb3, 0x9a, 0x3a, 0xad, 0xc4, 0x44, + 0x6b, 0x64, 0x42, 0x9e, 0xa4, 0x96, 0x54, 0x61, 0xdb, 0x76, 0x0b, 0x5d, + 0x05, 0xc0, 0x3b, 0x88, 0x70, 0x77, 0x8d, 0x9f, 0x12, 0x6b, 0xa1, 0xdf, + 0x29, 0xed, 0x82, 0x7e, 0x9d, 0x7b, 0x77, 0x5d, 0x5d, 0xbd, 0xe4, 0x79, + 0x1a, 0x35, 0x6c, 0x7f, 0xa6, 0x68, 0xcf, 0xde, 0x7d, 0x0e, 0x60, 0x6c, + 0x04, 0xc6, 0xdc, 0x40, 0x8f, 0x67, 0x69, 0x23, 0x16, 0x48, 0xe9, 0x73, + 0x69, 0x74, 0x7f, 0x16, 0x4d, 0x83, 0xa5, 0x62, 0x18, 0xc7, 0x6a, 0x5c, + 0xef, 0x6e, 0x82, 0xfe, 0x80, 0xfb, 0x20, 0xf4, 0x85, 0x55, 0xf5, 0x0c, + 0xbd, 0x19, 0xa1, 0x43, 0x7b, 0x1b, 0x10, 0x3a, 0x7c, 0x04, 0xe9, 0x8c, + 0x8f, 0x16, 0xe3, 0x1d, 0xd4, 0x29, 0xe3, 0xe7, 0x69, 0xa3, 0x80, 0x49, + 0x29, 0x35, 0x64, 0x66, 0xa6, 0x56, 0x1f, 0xe3, 0x52, 0x64, 0x5b, 0x09, + 0xb9, 0xa3, 0x71, 0x14, 0x70, 0x7e, 0x39, 0x53, 0x61, 0x67, 0x15, 0xe8, + 0x6a, 0x6e, 0xf1, 0xe4, 0xa3, 0x0a, 0xe9, 0x78, 0x3e, 0x42, 0x7b, 0x0e, + 0x31, 0x69, 0x1c, 0x1a, 0x70, 0x36, 0x3d, 0x6a, 0x95, 0xf7, 0xd3, 0x13, + 0x32, 0x7e, 0x81, 0x9e, 0x04, 0xc6, 0x2f, 0xd2, 0x6d, 0x25, 0x94, 0xae, + 0x3e, 0x46, 0x4f, 0x00, 0x70, 0x8d, 0xf3, 0x44, 0x89, 0x80, 0xe7, 0x35, + 0x3e, 0xf5, 0xd2, 0xcb, 0x91, 0x70, 0xab, 0x94, 0xea, 0x50, 0x8e, 0xe4, + 0x6a, 0xdd, 0x85, 0x72, 0xab, 0x76, 0x23, 0x73, 0x81, 0xd8, 0x06, 0xae, + 0x7b, 0xc5, 0x71, 0x27, 0x8e, 0xf1, 0xea, 0xc6, 0x14, 0x82, 0x8f, 0x35, + 0x96, 0x11, 0x21, 0xa3, 0xc6, 0x09, 0x8c, 0xb3, 0x6a, 0x32, 0x4c, 0xd5, + 0x1b, 0xc9, 0xab, 0x8d, 0x65, 0xd6, 0xb2, 0x9a, 0x93, 0xaf, 0xa5, 0xbf, + 0x8e, 0x75, 0x99, 0x0d, 0x29, 0x6f, 0x78, 0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, 0x74, 0x91, 0xed, 0xf6, 0xed, 0xea, 0xbf, 0xff, 0xe1, 0xb8, 0xff, + 0x02, 0x12, 0xb7, 0xd2, 0x7c, 0x32, 0x4f, 0x12, 0x27, 0x00, 0x00, 0x00, + 0x25, 0x74, 0x45, 0x58, 0x74, 0x64, 0x61, 0x74, 0x65, 0x3a, 0x63, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x00, 0x32, 0x30, 0x32, 0x34, 0x2d, 0x31, 0x32, + 0x2d, 0x31, 0x35, 0x54, 0x31, 0x37, 0x3a, 0x34, 0x39, 0x3a, 0x35, 0x37, + 0x2b, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x9d, 0xe6, 0x51, 0x9c, 0x00, 0x00, + 0x00, 0x25, 0x74, 0x45, 0x58, 0x74, 0x64, 0x61, 0x74, 0x65, 0x3a, 0x6d, + 0x6f, 0x64, 0x69, 0x66, 0x79, 0x00, 0x32, 0x30, 0x32, 0x34, 0x2d, 0x31, + 0x32, 0x2d, 0x31, 0x35, 0x54, 0x31, 0x37, 0x3a, 0x34, 0x39, 0x3a, 0x35, + 0x37, 0x2b, 0x30, 0x30, 0x3a, 0x30, 0x30, 0xec, 0xbb, 0xe9, 0x20, 0x00, + 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82}; +unsigned int image_valid_html401_len = 2231; diff --git a/src/image/valid-html401.h b/src/image/valid-html401.h new file mode 100644 index 0000000..4a07bff --- /dev/null +++ b/src/image/valid-html401.h @@ -0,0 +1,2 @@ +extern unsigned char image_valid - html401[]; +extern unsigned int image_valid - html401_len; diff --git a/src/image/valid-html401.png b/src/image/valid-html401.png new file mode 100644 index 0000000..8e3d038 Binary files /dev/null and b/src/image/valid-html401.png differ diff --git a/src/main.c b/src/main.c index f81e4bd..8a21fb9 100644 --- a/src/main.c +++ b/src/main.c @@ -1,21 +1,21 @@ #include -int main(int argc, char** argv){ - int i; - char* action = NULL; - int target_argc = 0; +int main(int argc, char** argv) { + int i; + char* action = NULL; + int target_argc = 0; char** target_argv = malloc(sizeof(*target_argv)); - target_argv[0] = NULL; + target_argv[0] = NULL; printf("Taiga, static website generator - run `%s help' for help\n\n", argv[0]); - for(i = 1; i < argc; i++){ - if(argv[i][0] == '-'){ + for(i = 1; i < argc; i++) { + if(argv[i][0] == '-') { if(action != NULL) continue; - }else{ + } else { if(action != NULL) continue; action = argv[i]; - + free(target_argv); target_argc = argc - i - 1; target_argv = &argv[i + 1]; @@ -24,11 +24,11 @@ int main(int argc, char** argv){ if(action == NULL) action = "site"; - if(strcmp(action, "site") == 0){ + if(strcmp(action, "site") == 0) { return action_site(target_argc, target_argv); - }else if(strcmp(action, "help") == 0){ + } else if(strcmp(action, "help") == 0) { return action_help(target_argc, target_argv); - }else if(strcmp(action, "seed") == 0){ + } else if(strcmp(action, "seed") == 0) { return action_seed(target_argc, target_argv); } diff --git a/src/process.c b/src/process.c index d2954c0..0cc1571 100644 --- a/src/process.c +++ b/src/process.c @@ -2,31 +2,31 @@ static FILE* f; -static int parse_file(const char* top, const char* full){ +static int parse_file(const char* top, const char* full) { xemil_t* handle = xl_open_file(full); - int st = 1; + int st = 1; handle->new_text = 1; - if(handle != NULL && xl_parse(handle)){ - if(handle->root == NULL || strcmp(handle->root->name, "document") != 0){ + if(handle != NULL && xl_parse(handle)) { + if(handle->root == NULL || strcmp(handle->root->name, "document") != 0) { fprintf(stderr, "Root element has to be document\n"); st = 0; } - if(st){ - char* title = NULL; - xl_node_t* node = NULL; + if(st) { + char* title = NULL; + xl_node_t* node = NULL; xl_node_t* header = NULL; - xl_node_t* body = NULL; - + xl_node_t* body = NULL; + if(handle->root != NULL) node = handle->root->first_child; - while(node != NULL){ - if(node->type == XL_NODE_NODE && strcmp(node->name, "header") == 0){ + while(node != NULL) { + if(node->type == XL_NODE_NODE && strcmp(node->name, "header") == 0) { xl_node_t* n = node->first_child; - while(n != NULL){ - if(n->type == XL_NODE_NODE && strcmp(n->name, "title") == 0){ + while(n != NULL) { + if(n->type == XL_NODE_NODE && strcmp(n->name, "title") == 0) { if(title != NULL) free(title); title = u_strdup(n->text); } @@ -34,7 +34,7 @@ static int parse_file(const char* top, const char* full){ } header = node; - }else if(node->type == XL_NODE_NODE && strcmp(node->name, "body") == 0){ + } else if(node->type == XL_NODE_NODE && strcmp(node->name, "body") == 0) { body = node; } @@ -57,7 +57,7 @@ static int parse_file(const char* top, const char* full){ free(title); } - }else{ + } else { fprintf(stderr, "Parse failed!\n", full); st = 0; } @@ -67,12 +67,12 @@ static int parse_file(const char* top, const char* full){ return st; } -int process(const char* top, const char* out, const char* full){ +int process(const char* top, const char* out, const char* full) { char* fn = strrchr(full, '/'); if(fn != NULL) fn = fn + 1; - if(fn != NULL){ + if(fn != NULL) { char* n; char* p; @@ -80,8 +80,8 @@ int process(const char* top, const char* out, const char* full){ if((n = strrchr(fn, '.')) != NULL) n[0] = 0; p = u_strvacat(out, fn, ".html", NULL); - if((f = fopen(p, "w")) != NULL){ - if(!parse_file(top, full)){ + if((f = fopen(p, "w")) != NULL) { + if(!parse_file(top, full)) { fclose(f); free(p); free(fn); diff --git a/src/seed.c b/src/seed.c index 5e4dee7..322a36b 100644 --- a/src/seed.c +++ b/src/seed.c @@ -1,8 +1,8 @@ #include -static void describe(const char* path, const char* what){ +static void describe(const char* path, const char* what) { char space[64]; - int i; + int i; memset(space, 0, sizeof(space)); for(i = 0; i < (32 - strlen(path)); i++) space[i] = ' '; @@ -10,32 +10,32 @@ static void describe(const char* path, const char* what){ printf("%s%s# %s\n", path, space, what); } -int action_seed(int argc, char** argv){ +int action_seed(int argc, char** argv) { FILE* f; io_mkdir("site", 0755); io_mkdir("site/content", 0755); - if((f = fopen("site/skinconf.xml", "w")) == NULL){ + if((f = fopen("site/skinconf.xml", "w")) == NULL) { fprintf(stderr, "Failed to open site/skinconf.xml\n"); return 1; } fprintf(f, "\n"); fprintf(f, "\n"); fprintf(f, " \n"); - fprintf(f, " \n"); + fprintf(f, " \n"); fprintf(f, " \n"); fprintf(f, " \n"); - fprintf(f, " \n"); + fprintf(f, " \n"); fprintf(f, " \n"); - fprintf(f, " Example Co, Ltd.\n"); + fprintf(f, " Example Co, Ltd\n"); fprintf(f, " 2026\n"); fprintf(f, " \n"); fprintf(f, " \n"); fprintf(f, "\n"); fclose(f); - if((f = fopen("site/content/index.xml", "w")) == NULL){ + if((f = fopen("site/content/index.xml", "w")) == NULL) { fprintf(stderr, "Failed to open site/content/index.xml\n"); return 1; } diff --git a/src/site.c b/src/site.c index 47e94e7..efb9a05 100644 --- a/src/site.c +++ b/src/site.c @@ -2,27 +2,27 @@ xemil_t* skinconf; -static int scan(const char* top, const char* path){ - char* in = u_strvacat("site/content/", path, NULL); - char* out = u_strvacat("build/", path, NULL); +static int scan(const char* top, const char* path) { + char* in = u_strvacat("site/content/", path, NULL); + char* out = u_strvacat("build/", path, NULL); IO_DIR* dir; - + io_mkdir(out, 0755); - if((dir = io_opendir(in)) != NULL){ + if((dir = io_opendir(in)) != NULL) { struct io_dirent* d; - while((d = io_readdir(dir)) != NULL){ - char* p; + while((d = io_readdir(dir)) != NULL) { + char* p; struct io_stat s; if(strcmp(d->d_name, ".") == 0 || strcmp(d->d_name, "..") == 0) continue; p = u_strvacat(in, d->d_name, NULL); - if(io_stat(p, &s) == 0){ - if(IO_S_ISDIR(s.st_mode)){ + if(io_stat(p, &s) == 0) { + if(IO_S_ISDIR(s.st_mode)) { char* p2 = u_strvacat(d->d_name, "/", NULL); - char* t = u_strvacat(top, "../", NULL); - if(!scan(t, p2)){ + char* t = u_strvacat(top, "../", NULL); + if(!scan(t, p2)) { free(t); free(p2); free(p); @@ -34,9 +34,9 @@ static int scan(const char* top, const char* path){ } free(t); free(p2); - }else if(strcmp(d->d_name, "index.xml") == 0){ + } else if(strcmp(d->d_name, "index.xml") == 0) { printf("%s:\n", p); - if(!process(top, out, p)){ + if(!process(top, out, p)) { free(p); io_closedir(dir); free(out); @@ -51,33 +51,33 @@ static int scan(const char* top, const char* path){ io_closedir(dir); } - + free(out); free(in); return 1; } -int action_site(int argc, char** argv){ - int st = 0; +int action_site(int argc, char** argv) { + int st = 0; FILE* css; io_mkdir("build", 0755); - if((skinconf = xl_open_file("site/skinconf.xml")) == NULL || !xl_parse(skinconf)){ + if((skinconf = xl_open_file("site/skinconf.xml")) == NULL || !xl_parse(skinconf)) { fprintf(stderr, "Failed to parse site/skinconf.xml!\n"); st = 1; goto cleanup; } - if((css = fopen("build/style.css", "w")) == NULL){ + if((css = fopen("build/style.css", "w")) == NULL) { st = 1; goto cleanup; } - classic_stylesheet(css); + classic_stylesheet(css, "build/"); fclose(css); - if(!scan("", "")){ + if(!scan("", "")) { st = 1; goto cleanup; } @@ -85,9 +85,9 @@ int action_site(int argc, char** argv){ cleanup:; if(skinconf != NULL) xl_close(skinconf); - if(st == 0){ + if(st == 0) { fprintf(stderr, "\nBuild successful\n"); - }else{ + } else { fprintf(stderr, "\nBuild failed!\n"); } diff --git a/src/taiga.h b/src/taiga.h index 4bd8706..42648b0 100644 --- a/src/taiga.h +++ b/src/taiga.h @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #ifdef _WIN32 @@ -18,7 +19,7 @@ #include #ifdef _WIN32 -#define io_mkdir(x,y) _mkdir(x) +#define io_mkdir(x, y) _mkdir(x) #define io_chdir(x) _chdir(x) #define io_stat _stat @@ -56,7 +57,7 @@ char* u_strdup(const char* str); int process(const char* top, const char* out, const char* full); /* classic.c */ -void classic_stylesheet(FILE* out); +void classic_stylesheet(FILE* out, const char* top); /* also create files here if you need one */ void classic_head(FILE* out, const char* top, xl_node_t* header); void classic_body(FILE* out, const char* top, const char* title, xl_node_t* body); diff --git a/src/util.c b/src/util.c index 9d96bbc..45d1fd9 100644 --- a/src/util.c +++ b/src/util.c @@ -1,10 +1,10 @@ #include -char* u_strvacat(const char* str, ...){ - va_list va; - int len = 0; +char* u_strvacat(const char* str, ...) { + va_list va; + int len = 0; const char* s; - char* r; + char* r; len += strlen(str); va_start(va, str); @@ -21,7 +21,7 @@ char* u_strvacat(const char* str, ...){ return r; } -char* u_strdup(const char* str){ +char* u_strdup(const char* str) { char* s = malloc(strlen(str) + 1); strcpy(s, str);