- Timestamp:
- Sep 13, 2024, 6:06:44 PM (2 months ago)
- Location:
- trunk
- Files:
-
- 5 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Makefile
r2 r3 6 6 .SUFFIXES: .c .o 7 7 8 OBJS = string.o 8 OBJS = string.o log.o 9 9 10 10 all: common.a -
trunk/Common/string.c
r2 r3 1 1 /* $Id$ */ 2 3 #include <string.h> 4 #include <stdlib.h> 5 6 char* cm_strcat(const char* a, const char* b) { 7 char* str = malloc(strlen(a) + strlen(b) + 1); 8 memcpy(str, a, strlen(a)); 9 memcpy(str + strlen(a), b, strlen(b)); 10 str[strlen(a) + strlen(b)] = 0; 11 return str; 12 } 13 14 char* cm_strdup(const char* str) { return cm_strcat(str, ""); } -
trunk/Platform/generic.mk
r2 r3 3 3 CC = cc 4 4 AR = ar 5 CFLAGS = -g -std=c99 -DPREFIX=\"$(PREFIX)\" 5 CFLAGS = -g -std=c99 -DPREFIX=\"$(PREFIX)\" -I $(PWD)/Common 6 6 LDFLAGS = 7 7 LIBS = -
trunk/Server/Makefile
r2 r3 6 6 .SUFFIXES: .c .o 7 7 8 OBJS = ../Common/common.amain.o8 OBJS = version.o main.o 9 9 10 10 all: tewi$(EXEC) 11 11 12 tewi$(EXEC): $(OBJS) 13 $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) 12 tewi$(EXEC): $(OBJS) ../Common/common.a 13 $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) ../Common/common.a 14 14 15 15 .c.o: -
trunk/Server/main.c
r2 r3 1 1 /* $Id$ */ 2 2 3 int main() {} 3 #include <stdio.h> 4 #include <stdbool.h> 5 #include <string.h> 6 7 #include <cm_log.h> 8 9 #include "tw_version.h" 10 11 extern bool cm_do_log; 12 13 int main(int argc, char** argv) { 14 int i; 15 for(i = 1; i < argc; i++) { 16 if(argv[i][0] == '-') { 17 if(strcmp(argv[i], "--verbose") == 0 || strcmp(argv[i], "-v") == 0) { 18 if(!cm_do_log) { 19 cm_do_log = true; 20 cm_log("", "This is Tewi HTTPd, version %s", tw_get_version()); 21 } else { 22 cm_do_log = true; 23 } 24 } else { 25 fprintf(stderr, "Unknown option: %s\n", argv[i]); 26 return 1; 27 } 28 } 29 } 30 cm_log("Daemon", "Ready"); 31 }
Note:
See TracChangeset
for help on using the changeset viewer.