From: nishi Date: Thu, 15 Feb 2024 05:46:41 +0000 (+0000) Subject: protocol.mk X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=6d24663d58a09126e1ebb1c32550dffe67e422f7;p=libw3.git protocol.mk git-svn-id: file:///raid/svn-main/nishi-libw3/trunk@225 d27a3e52-49c5-7645-884c-6793ebffc270 --- diff --git a/Library/Core.c b/Library/Core.c index 3ad58df..d9a9813 100644 --- a/Library/Core.c +++ b/Library/Core.c @@ -5,15 +5,39 @@ #include "W3Util.h" #include "W3Version.h" +#ifdef FTP_SUPPORT #include "W3FTP.h" +#endif + +#ifdef FILE_SUPPORT #include "W3File.h" +#endif + +#ifdef FINGER_SUPPORT #include "W3Finger.h" +#endif + +#ifdef GOPHER_SUPPORT #include "W3Gopher.h" +#endif + +#ifdef HTTP_SUPPORT #include "W3HTTP.h" +#endif + +#ifdef NNTP_SUPPORT #include "W3NNTP.h" +#endif + +#ifdef NEX_SUPPORT #include "W3Nex.h" +#endif + +#ifdef POP3_SUPPORT #include "W3POP3.h" -#ifdef SSL_SUPPORT +#endif + +#ifdef GEMINI_SUPPORT #include "W3Gemini.h" #endif @@ -85,17 +109,37 @@ struct W3* W3_Create(const char* protocol, const char* hostname, int port) { if(strcmp(protocol, "file") != 0) { if(strcmp(protocol, "http") == 0) { #ifdef SSL_SUPPORT +#ifdef HTTP_SUPPORT } else if(strcmp(protocol, "https") == 0) { +#endif +#ifdef POP3_SUPPORT } else if(strcmp(protocol, "pop3s") == 0) { +#endif +#ifdef GEMINI_SUPPORT } else if(strcmp(protocol, "gemini") == 0) { +#endif +#ifdef GOPHER_SUPPORT } else if(strcmp(protocol, "gophers") == 0) { #endif +#endif +#ifdef NEX_SUPPORT } else if(strcmp(protocol, "nex") == 0) { +#endif +#ifdef FINGER_SUPPORT } else if(strcmp(protocol, "finger") == 0) { +#endif +#ifdef GOPHER_SUPPORT } else if(strcmp(protocol, "gopher") == 0) { +#endif +#ifdef POP3_SUPPORT } else if(strcmp(protocol, "pop3") == 0) { +#endif +#ifdef FTP_SUPPORT } else if(strcmp(protocol, "ftp") == 0) { +#endif +#ifdef NNTP_SUPPORT } else if(strcmp(protocol, "nntp") == 0) { +#endif } else { __W3_Debug("Protocol", "Not suppported"); W3_Free(w3); @@ -115,6 +159,14 @@ struct W3* W3_Create(const char* protocol, const char* hostname, int port) { w3 = NULL; } } +#ifndef FILE_SUPPORT + else { + __W3_Debug("Protocol", "Not suppported"); + W3_Free(w3); + w3 = NULL; + return w3; + } +#endif return w3; } @@ -139,38 +191,57 @@ void W3_Set_Path(struct W3* w3, const char* path) { } void W3_Send_Request(struct W3* w3) { - if(strcmp(w3->protocol, "http") == 0 + if(0){ +#ifdef HTTP_SUPPORT + }else if(strcmp(w3->protocol, "http") == 0 #ifdef SSL_SUPPORT || strcmp(w3->protocol, "https") == 0 #endif ) { __W3_HTTP_Request(w3); +#endif +#ifdef GOPHER_SUPPORT } else if(strcmp(w3->protocol, "gopher") == 0 #ifdef SSL_SUPPORT || strcmp(w3->protocol, "gophers") == 0 #endif ) { __W3_Gopher_Request(w3); +#endif +#ifdef POP3_SUPPORT } else if(strcmp(w3->protocol, "pop3") == 0 #ifdef SSL_SUPPORT || strcmp(w3->protocol, "pop3s") == 0 #endif ) { __W3_POP3_Request(w3); +#endif +#ifdef GEMINI_SUPPORT #ifdef SSL_SUPPORT } else if(strcmp(w3->protocol, "gemini") == 0) { __W3_Gemini_Request(w3); #endif +#endif +#ifdef FINGER_SUPPORT } else if(strcmp(w3->protocol, "finger") == 0) { __W3_Finger_Request(w3); +#endif +#ifdef NEX_SUPPORT } else if(strcmp(w3->protocol, "nex") == 0) { __W3_Nex_Request(w3); +#endif +#ifdef FTP_SUPPORT } else if(strcmp(w3->protocol, "ftp") == 0) { __W3_FTP_Request(w3); +#endif +#ifdef NNTP_SUPPORT } else if(strcmp(w3->protocol, "nntp") == 0) { __W3_NNTP_Request(w3); +#endif +#ifdef FILE_SUPPORT } else if(strcmp(w3->protocol, "file") == 0) { __W3_File_Request(w3); +#endif } } diff --git a/Library/Makefile b/Library/Makefile index f809b9c..0427271 100644 --- a/Library/Makefile +++ b/Library/Makefile @@ -1,13 +1,53 @@ # $Id$ .PHONY: clean install -OBJS = ./Core.o ./Util.o ./DNS.o ./HTTP.o ./Gopher.o ./POP3.o ./Finger.o ./File.o ./Nex.o ./FTP.o ./NNTP.o ./URL.o ./Tag.o +OBJS = ./Core.o ./Util.o ./DNS.o ./NNTP.o ./URL.o ./Tag.o + +include ./protocol.mk ifeq ($(TCL),YES) OBJS += ./Tcl.o endif ifeq ($(SSL),YES) +ifneq ($(GEMINI),NO) OBJS += ./Gemini.o +FLAGS += -DGEMINI_SUPPORT +endif +endif + +ifneq ($(HTTP),NO) +OBJS += ./HTTP.o +FLAGS += -DHTTP_SUPPORT +endif + +ifneq ($(GOPHER),NO) +OBJS += ./Gopher.o +FLAGS += -DGOPHER_SUPPORT +endif + +ifneq ($(POP3),NO) +OBJS += ./POP3.o +FLAGS += -DPOP3_SUPPORT +endif + +ifneq ($(FINGER),NO) +OBJS += ./Finger.o +FLAGS += -DFINGER_SUPPORT +endif + +ifneq ($(FILE),NO) +OBJS += ./File.o +FLAGS += -DFILE_SUPPORT +endif + +ifneq ($(NEX),NO) +OBJS += ./Nex.o +FLAGS += -DNEX_SUPPORT +endif + +ifneq ($(FTP),NO) +OBJS += ./FTP.o +FLAGS += -DFTP_SUPPORT endif ifeq ($(WINDOWS),YES) @@ -22,7 +62,7 @@ else endif ./%.o: ./%.c W3%.h - $(CC) $(CFLAGS) -I../openssl/include -c -o $@ $< + $(CC) $(CFLAGS) $(FLAGS) -I../openssl/include -c -o $@ $< clean: rm -f *.o *.so *.core *~ *.dll *.lib *.a *.res diff --git a/Library/protocol.mk b/Library/protocol.mk new file mode 100644 index 0000000..c2c1099 --- /dev/null +++ b/Library/protocol.mk @@ -0,0 +1,9 @@ +# $Id$ +#GEMINI=NO +#HTTP=NO +#FTP=NO +#FINGER=NO +#POP3=NO +#GOPHER=NO +#NEX=NO +#FILE=NO diff --git a/W3Version.h.p b/W3Version.h.p index 2a89c8f..9119059 100644 --- a/W3Version.h.p +++ b/W3Version.h.p @@ -6,7 +6,7 @@ extern "C" { #endif -#define LIBW3_VERSION "2.12H" \ +#define LIBW3_VERSION "2.13" \ SUFFIX #ifdef __cplusplus