mirror of
https://github.com/gophernicus/gophernicus.git
synced 2025-02-02 15:08:00 -05:00
parent
e2856aadf3
commit
87362cd316
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,6 +3,7 @@
|
|||||||
#
|
#
|
||||||
src/*.o
|
src/*.o
|
||||||
src/files.h
|
src/files.h
|
||||||
|
src/filetypes.h
|
||||||
src/functions.h
|
src/functions.h
|
||||||
README
|
README
|
||||||
README.options
|
README.options
|
||||||
|
@ -181,3 +181,4 @@ on Github and make a pull request!
|
|||||||
| Gentoo | up to date |
|
| Gentoo | up to date |
|
||||||
| Alpine Linux | Edge, 3.9 |
|
| Alpine Linux | Edge, 3.9 |
|
||||||
| FreeBSD | 12.0 |
|
| FreeBSD | 12.0 |
|
||||||
|
| Darwin (Mac) | OSX 10.7 |
|
||||||
|
9
Makefile
9
Makefile
@ -5,7 +5,7 @@ VERSION = 3.1
|
|||||||
CODENAME = Dungeon Edition
|
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
|
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)
|
OBJECTS = $(SOURCES:.c=.o)
|
||||||
README = README.md
|
README = README.md
|
||||||
DOCS = LICENSE README.md INSTALL.md changelog README.Gophermap gophertag
|
DOCS = LICENSE README.md INSTALL.md changelog README.Gophermap gophertag
|
||||||
@ -25,7 +25,9 @@ MAP = gophermap
|
|||||||
|
|
||||||
INETD = /etc/inetd.conf
|
INETD = /etc/inetd.conf
|
||||||
XINETD = /etc/xinetd.d
|
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
|
INETPID = /var/run/inetd.pid
|
||||||
LAUNCHD = /Library/LaunchDaemons
|
LAUNCHD = /Library/LaunchDaemons
|
||||||
PLIST = org.$(NAME).server.plist
|
PLIST = org.$(NAME).server.plist
|
||||||
@ -74,6 +76,9 @@ src/functions.h:
|
|||||||
sed -e "s/ =.*$$//" -e "s/ *$$/;/" >> $@
|
sed -e "s/ =.*$$//" -e "s/ *$$/;/" >> $@
|
||||||
@echo
|
@echo
|
||||||
|
|
||||||
|
src/filetypes.h: src/filetypes.conf
|
||||||
|
sh src/filetypes.sh < src/filetypes.conf > $@
|
||||||
|
|
||||||
src/bin2c: src/bin2c.c
|
src/bin2c: src/bin2c.c
|
||||||
$(CC) src/bin2c.c -o $@
|
$(CC) src/bin2c.c -o $@
|
||||||
|
|
||||||
|
@ -6,5 +6,5 @@
|
|||||||
# Example:
|
# Example:
|
||||||
# OPTIONS="-h full.hostname -D \"I find your lack of gopher disturbing.\""
|
# OPTIONS="-h full.hostname -D \"I find your lack of gopher disturbing.\""
|
||||||
#
|
#
|
||||||
# Uncomment and add your options here:
|
# modify and set your options here:
|
||||||
#OPTIONS=""
|
OPTIONS="-h localhost -nv"
|
||||||
|
29
src/filetypes.conf
Normal file
29
src/filetypes.conf
Normal file
@ -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
|
21
src/filetypes.sh
Normal file
21
src/filetypes.sh
Normal file
@ -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 <<EOH
|
||||||
|
/* $outp autogenerated on `date -u` by $0 */
|
||||||
|
|
||||||
|
#define FILETYPES \\
|
||||||
|
EOH
|
||||||
|
# slurp $inpt and get gopher type and list of extensions
|
||||||
|
while read gtype exts
|
||||||
|
do if ! test "$gtype" = "" -o "$gtype" = "#"
|
||||||
|
# process extensions, removing trailing SPC,
|
||||||
|
# prepending '"' and appending '","gophertype",' to each,
|
||||||
|
# and prepending TAB and appending ' \'
|
||||||
|
then echo $exts | sed -e "s/\([^ ][^ ]*\) */\"\1\",\"$gtype\",/g;s/^/ /;s/\$/ \\\\/"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
cat <<EOF
|
||||||
|
NULL, NULL
|
||||||
|
EOF
|
@ -278,7 +278,7 @@ size_t strlcat(char *dst, const char *src, size_t siz);
|
|||||||
/* Sizes & maximums */
|
/* Sizes & maximums */
|
||||||
#define BUFSIZE 1024 /* Default size for string buffers */
|
#define BUFSIZE 1024 /* Default size for string buffers */
|
||||||
#define MAX_HIDDEN 32 /* Maximum number of hidden files */
|
#define MAX_HIDDEN 32 /* Maximum number of hidden files */
|
||||||
#define MAX_FILETYPES 128 /* Maximum number of suffix to filetype mappings */
|
#define MAX_FILETYPES 1024 /* Maximum number of suffix to filetype mappings */
|
||||||
#define MAX_FILTERS 16 /* Maximum number of file filters */
|
#define MAX_FILTERS 16 /* Maximum number of file filters */
|
||||||
#define MAX_SDIRENT 1024 /* Maximum number of files per directory to handle */
|
#define MAX_SDIRENT 1024 /* Maximum number of files per directory to handle */
|
||||||
#define MAX_REWRITE 32 /* Maximum number of selector rewrite options */
|
#define MAX_REWRITE 32 /* Maximum number of selector rewrite options */
|
||||||
@ -414,27 +414,6 @@ typedef struct {
|
|||||||
time_t mtime;
|
time_t mtime;
|
||||||
} sdirent;
|
} sdirent;
|
||||||
|
|
||||||
|
|
||||||
/* File suffix to gopher filetype mappings */
|
|
||||||
#define FILETYPES \
|
|
||||||
"txt","0","pl","0","py","0","sh","0","tcl","0","c","0","cpp","0", "h","0","log","0", \
|
|
||||||
"conf","0","php","0","php3","0", \
|
|
||||||
"map","1","menu","1", \
|
|
||||||
"hqx","4", \
|
|
||||||
"Z","5","gz","5","tgz","5","tar","5","zip","5","bz2","5","rar","5","sea","5", \
|
|
||||||
"q","7","qry","7", \
|
|
||||||
"iso","9","so","9","o","9","rtf","9","ttf","9","bin","9", \
|
|
||||||
"ics","c","ical","c", \
|
|
||||||
"gif","g", \
|
|
||||||
"html","h","htm","h","xhtml","h","css","h","swf","h","rdf","h","rss","h","xml","h", \
|
|
||||||
"jpg","I","jpeg","I","png","I","bmp","I","svg","I","tif","I","tiff","I", \
|
|
||||||
"ico","I","xbm","I","xpm","I","pcx","I", \
|
|
||||||
"mbox","M", \
|
|
||||||
"pdf","d","ps","d","doc","d","ppt","d","xls","d","xlsx","d","docx","d","pptx","d", \
|
|
||||||
"mp3","s","wav","s","mid","s","wma","s","flac","s","ogg","s","aiff","s","aac","s", \
|
|
||||||
"avi",";","mp4",";","mpg",";","mov",";","qt",";","asf",";","mpv",";","m4v",";","webm",";","ogv",";", \
|
|
||||||
NULL, NULL
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Useful macros
|
* Useful macros
|
||||||
*/
|
*/
|
||||||
@ -452,5 +431,6 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
#include "files.h"
|
#include "files.h"
|
||||||
|
#include "filetypes.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user