ifeq ($(TCL),YES)
$(MAKE) -C ./tclw3 CC=$(CC) TCL_LIBS="$(TCL_LIBS)" TCL_CFLAGS="$(TCL_CFLAGS)" SUFFIX=$(SUFFIX)
endif
+ifeq ($(HTTPD),YES)
+ $(MAKE) -C ./httpd CC=$(CC) SUFFIX=$(SUFFIX)
+endif
install:
$(MAKE) -C ./fetch CC=$(CC) PREFIX=$(PREFIX) SUFFIX=$(SUFFIX) install
ifeq ($(TCL),YES)
$(MAKE) -C ./tclw3 CC=$(CC) PREFIX=$(PREFIX) SUFFIX=$(SUFFIX) install
endif
+ifeq ($(HTTPD),YES)
+ $(MAKE) -C ./httpd CC=$(CC) PREFIX=$(PREFIX) SUFFIX=$(SUFFIX) install
+endif
clean:
rm -f *.o *.so *.core *~ *.exe *.res
$(MAKE) -C ./ftp-list SUFFIX=$(SUFFIX) clean
$(MAKE) -C ./nntp-list SUFFIX=$(SUFFIX) clean
ifeq ($(TCL),YES)
- $(MAKE) -C ./tclw3 CC=$(CC) SUFFIX=$(SUFFIX) clean
+ $(MAKE) -C ./tclw3 SUFFIX=$(SUFFIX) clean
+endif
+ifeq ($(HTTPD),YES)
+ $(MAKE) -C ./httpd SUFFIX=$(SUFFIX) clean
endif
--- /dev/null
+# $Id$:
+.PHONY: clean install
+
+./httpd$(SUFFIX): ./httpd.c $(RESFILE)
+ $(CC) -g -o $@ -I ../../Library -L ../../Library $^ -lw3
+
+../libw3.res:
+ $(MAKE) -C .. ./libw3.res WINDRES=$(WINDRES)
+
+clean:
+ rm -f httpd *.o *.so *.core *~ *.exe *.res
+
+install: ./httpd
+ mkdir -p $(PREFIX)/bin
+ cp ./httpd $(PREFIX)/bin/w3-httpd
--- /dev/null
+/*
+ * $Id$
+ *
+ * HTTP Daemon.
+ */
+
+#include <W3Core.h>
+
+#include <stdio.h>
+#include <string.h>
+
+int main(int argc, char** argv) {
+ if(argv[1] != NULL && strcmp(argv[1], "--version") == 0) {
+ printf("LibW3 %s\n", LIBW3_VERSION);
+ return 0;
+ }
+}
}
struct W3URL* global_u;
-void nntpresp_handler(struct W3* w3, int status, char* data){
- if(status == 200){
- if(databuf == NULL){
+void nntpresp_handler(struct W3* w3, int status, char* data) {
+ if(status == 200) {
+ if(databuf == NULL) {
databuf = malloc(1);
databuf[0] = 0;
}
char* hyp = malloc(2 + strlen(data) + 3 + 1);
hyp[0] = '\n';
int i;
- for(i = 0; data[i] != 0; i++){
+ for(i = 0; data[i] != 0; i++) {
hyp[i + 1] = '-';
}
for(i = 0; i < 3; i++) hyp[strlen(data) + i + 1] = '-';
W3_Set_Method(w3, "GROUP");
W3_Set_Path(w3, global_u->path + 1);
W3_NNTP_Send_Request(w3);
- }else if(status == 211 || status == 223){
+ } else if(status == 211 || status == 223) {
W3_Set_Method(w3, "HEAD");
W3_NNTP_Send_Request(w3);
- }else if(status == 221){
+ } else if(status == 221) {
W3_Set_Method(w3, "NEXT");
W3_NNTP_Send_Request(w3);
- }else{
+ } else {
W3_NNTP_Disconnect(w3);
}
}
#GOPHER=NO
#NEX=NO
#FILE=NO
+#NNTP=NO
ifeq ($(shell uname -s),Haiku)
LIBS += -lnetwork
endif
+HTTPD := YES
+# HTTPd uses fork() - this means you cannot build it for Windows. Sorry.
endif
ifeq ($(DEBUG),YES)
$(MAKE) -C ./Library CC=$(CC) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)" WINDOWS=YES WINARCH=$(WINARCH) TCL=$(TCL) SSL=$(SSL)
./Example: ./Library/w3.dll
- $(MAKE) -C ./Example CC=$(CC) TCL=$(TCL) TCL_LIBS="$(TCL_LIBS)" TCL_CFLAGS="$(TCL_CFLAGS)" examples SUFFIX=.exe
+ $(MAKE) -C ./Example CC=$(CC) TCL=$(TCL) TCL_LIBS="$(TCL_LIBS)" TCL_CFLAGS="$(TCL_CFLAGS)" HTTPD=$(HTTPD) examples SUFFIX=.exe
./Library/W3Version.h: ./W3Version.h.m4
m4 -DSUFFIX=\"W\" $(FLAGS) $< > $@
$(MAKE) -C ./Library CC=$(CC) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)" TCL=$(TCL) SSL=$(SSL) ./libw3.a
./Example: ./Library/libw3.so
- $(MAKE) -C ./Example CC=$(CC) TCL_LIBS="$(TCL_LIBS)" TCL_CFLAGS="$(TCL_CFLAGS)" TCL=$(TCL) examples
+ $(MAKE) -C ./Example CC=$(CC) TCL_LIBS="$(TCL_LIBS)" TCL_CFLAGS="$(TCL_CFLAGS)" TCL=$(TCL) HTTPD=$(HTTPD) examples
./Library/W3Version.h: ./W3Version.h.m4
m4 -DSUFFIX=\"\" $(FLAGS) $< > $@
cp -rf /usr/$(MINGW)/sys-root/mingw/share/tcl8.6 w3-$(VERSION)/Example/tclw3/lib/tcl8.6
endif
else
+ mkdir -p w3-$(VERSION)/Example/httpd
cp ./Library/*.so w3-$(VERSION)/Library/
cp ./Example/fetch/fetch w3-$(VERSION)/Example/fetch/
cp ./Example/interactive/interactive w3-$(VERSION)/Example/interactive/
cp ./Example/w3b/w3b w3-$(VERSION)/Example/w3b/
cp ./Example/ftp-list/ftp-list w3-$(VERSION)/Example/ftp-list/
cp ./Example/nntp-list/nntp-list w3-$(VERSION)/Example/nntp-list/
+ cp ./Example/httpd/httpd w3-$(VERSION)/Example/httpd/
ifeq ($(TCL),YES)
cp ./Example/tclw3/tclw3 w3-$(VERSION)/Example/tclw3/bin/
endif
extern "C" {
#endif
-#define LIBW3_VERSION "2.15D" \
+#define LIBW3_VERSION "2.16" \
SUFFIX
ifdef(`HTTP_SUPPORT', `#define LIBW3_HTTP_SUPPORT', `')