name changed to gosher

master
KatolaZ 6 years ago
parent cf2ff5ca4c
commit c15a524ced
  1. 31
      README.md
  2. 5
      TODO
  3. 14
      gosher
  4. 1
      gosher_serve
  5. 1
      gprsh_serve

@ -1,15 +1,34 @@
## gprsh -- A simple Gopher server in a POSIX shell script
## gosher -- A simple Gopher server in a POSIX shell script
`gprsh` is a Gopher server in a shell script. It requires only a
standard `netcat`.
`gosher` is a Gopher server in a POSIX shell script. It requires only a
standard `netcat(1)`.
You start the server using:
$ ./gprsh [<PORT> [<GOPHERDIR>]
$ ./gosher [<PORT> [<GOPHERDIR>]
If PORT is not specified, it will bind on port 70. If GOPHERDIR is not
provided, it defaults to "./".
`gprsh` reads the index.gph gopherfile in a folder and renders it as a
gophermap.
If the selector is a directory, `gosher` will look for a file named
`gophermap` to render the submenu. If a `gophermap` does not exist,
`gosher` looks for the index.gph gopherfile in the folder and, if it
exists, renders it as a gophermap.
## Why `gosher`?
Just for fun. There are only a few TCP/IP application protocols left
that can be implemented in a few dozen lines of POSIX shell script, and
Gopher (RFC 1436) is one of those.
## Why calling it `gosher`?
Well, `gosher` is just `gopher` where the `p` is replaced with an `s`,
and `sh(1)` is all that you need to run `gosher` (if we leave
`netcat(1)` out...).
Also, `gopher` is probably one of the few `kosher` protocols out there.
According to the Urban Dictionary, `gosher` is "an insult that can mean
anything", so choose your own.

@ -0,0 +1,5 @@
- add chroot and privilege drop
- allow on-the-fly creation of gopherfle from a folder (set it active
through an option)

@ -1,11 +1,11 @@
#!/bin/sh
##
## === gprsh ===
## === gosher ===
##
## gprsh is a simple gopher server in a POSIX shell script:
## gosher is a simple gopher server in a POSIX shell script:
##
## $ ./gprsh [<PORT> [<GOPHERDIR>]
## $ ./gosher [<PORT> [<GOPHERDIR>]
##
## If PORT is not specified, the default is 70. If GOPHERDIR is not
## specified, "./" is assumed
@ -18,20 +18,20 @@
######################
##
## If the script is called with basename "gprsh", launch the netcat
## If the script is called with basename "gosher", launch the netcat
## server...
##
MYNAME=$(basename $0)
if [ -z "${MYNAME#gprsh}" ]; then
## we are called as gprsh -- launch the server
if [ -z "${MYNAME#gosher}" ]; then
## we are called as gosher -- launch the server
PORT=${1:-70}
GOPHERDIR=${2:-"./"}
while [ 1 -eq 1 ]; do
netcat -vv -k -l -p ${PORT} -c "./gprsh_serve ${GOPHERDIR}"
netcat -vv -k -l -p ${PORT} -c "./gosher_serve ${GOPHERDIR}"
ret=$?
done
exit 0

@ -0,0 +1 @@
gosher

@ -1 +0,0 @@
gprsh
Loading…
Cancel
Save