Nokotan -- not very complicated Spartan daemon.

Supported command line parameters:
-r <absolute-path>
	A directory to serve. Default is /var/spartan/
-p <port>
	A port to listen on. Default is 300
-u <uid>
-g <gid>
	The user and group ID to which privilleges are dropped. Default -
	do not switch user and group.
-d
	Do daemonize. Default is to run in foreground and write log to
	stderr (aside from log file).
-C
	Do not try to chroot.
-a
	Enable basic virtual hosts support (see below).
-v
	Verbose logging (for debugging)
-q
	Quiet logging (errors only)
-h
	This list of options and the program version.

Nokotan remains single-process, but uses select(2) (which is my favourite
Unix system call) to serve multiple clients at a single time.

By default, it tries to chroot(2) to a Spartan root directory, but works
even if it has no permission to do that. Thus, you can run the daemon on
behalf of an ordinary user (with port greater than 1023).

When requested file is a directory, then it sends a directory listing. If
a requested directory contains a file named .message, this file is written
before the listing, much like in many FTP daemons.

In this version directory entries are written in random order. I don't know
how to fix it and not to make the daemon freeze and crash when dealing with
large directories. Please write me if you know how to overcome this.

Also, in this version files' MIME types and charater encodings are
hard-coded:
"text/gemini" is for .gmi, .gem, .gemini and .message files;
"text/plain" is used by .txt, .sh, .c and files with no suffix
"application/octet-stream" for other suffixes;

charset parameter is always US-ASCII.

I promise I will fix MIME types in future versions. May be something like
.htaccess will be a good solution. Maybe not.

With -a flag, the daemon uses each directory in a Spartan root as a
separate virtual host. Directories must have the same name as a virtual
host they are used by.

V-hosts support is basic and I didn't test it yet, so it might be buggy.

If you experience troubles with Nokotan daemon (not the real Nokotan!),
write me to <arbo@sh.pp.ru>
