diff --git a/.gitignore b/.gitignore index 580a0b4..2bee4ed 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ # src/*.o src/files.h +src/filetypes.h src/functions.h README README.options diff --git a/INSTALL.md b/INSTALL.md index 186e0e8..f586343 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -181,3 +181,4 @@ on Github and make a pull request! | Gentoo | up to date | | Alpine Linux | Edge, 3.9 | | FreeBSD | 12.0 | +| Darwin (Mac) | OSX 10.7 | diff --git a/Makefile b/Makefile index 400ec27..93901ea 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ VERSION = 3.1 CODENAME = Dungeon Edition SOURCES = src/$(NAME).c src/file.c src/menu.c src/string.c src/platform.c src/session.c src/options.c -HEADERS = src/functions.h src/files.h +HEADERS = src/functions.h src/files.h src/filetypes.h OBJECTS = $(SOURCES:.c=.o) README = README.md DOCS = LICENSE README.md INSTALL.md changelog README.Gophermap gophertag @@ -25,7 +25,9 @@ MAP = gophermap INETD = /etc/inetd.conf XINETD = /etc/xinetd.d -INETLIN = "gopher stream tcp nowait nobody $(SBINDIR)/$(BINARY) $(BINARY) -h `hostname`" +# get OPTIONS line from gophernicus.env and use that also for inetd +INETOPT = `grep '^OPTIONS=' $(NAME).env | tail -n 1 | sed -e 's/OPTIONS="*//;s/"*$$//'` +INETLIN = "gopher stream tcp nowait nobody $(SBINDIR)/$(BINARY) $(BINARY) $(INETOPT)" INETPID = /var/run/inetd.pid LAUNCHD = /Library/LaunchDaemons PLIST = org.$(NAME).server.plist @@ -74,6 +76,9 @@ src/functions.h: sed -e "s/ =.*$$//" -e "s/ *$$/;/" >> $@ @echo +src/filetypes.h: src/filetypes.conf + sh src/filetypes.sh < src/filetypes.conf > $@ + src/bin2c: src/bin2c.c $(CC) src/bin2c.c -o $@ diff --git a/init/gophernicus.env b/init/gophernicus.env index 13556df..89aefd0 100644 --- a/init/gophernicus.env +++ b/init/gophernicus.env @@ -6,5 +6,5 @@ # Example: # OPTIONS="-h full.hostname -D \"I find your lack of gopher disturbing.\"" # -# Uncomment and add your options here: -#OPTIONS="" +# modify and set your options here: +OPTIONS="-h localhost -nv" diff --git a/src/filetypes.conf b/src/filetypes.conf new file mode 100644 index 0000000..2f4bc5b --- /dev/null +++ b/src/filetypes.conf @@ -0,0 +1,29 @@ +# This file contains definitions of file types which will be created +# during compile time as filetypes.h and included in gophernicus.h. +# If no definitions are found here, filetypes.h will be empty. +# You should keep the defaults, though! + +# The syntax is very simple: Each line consists of one character, +# representing a gopher file type, followed by file extensions +# (without dots) of files to be handled as that gopher type. +# Fields must be separated by TAB or SPC. +# Empty lines and lines starting with a lone '#' are ignored. +# (Do not use lines with several '###...' though! Stupid script!) +# No more than MAX_FILETYPES (defined in gophernicus.h) extensions +# should be listed here (that's by default 1000 and should suffice)! + +# defaults as included in gophernicus.h until version 3.0: +0 txt pl py sh tcl c cpp h log conf php php3 +1 map menu +4 hqx +5 Z gz tgz tar zip bz2 rar sea +7 q qry +9 iso so o rtf ttf bin +c ics ical +g gif +h html htm xhtml css swf rdf rss xml +I jpg jpeg png bmp svg tif tiff ico xbm xpm pcx +M mbox +d pdf ps doc ppt xls xlsx docx pptx +s mp3 wav mid wma flac ogg aiff aac +; avi mp4 mpg mov qt asf mpv m4v webm ogv diff --git a/src/filetypes.sh b/src/filetypes.sh new file mode 100644 index 0000000..b2ddb9c --- /dev/null +++ b/src/filetypes.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# script for conversion of filetypes.conf into filetypes.h +# (called by Makefile before compilation) +# (2020-1-16 // HB9KNS) +cat <