On Sat, Jul 06, 2013 at 04:46:32PM +0200, Andrea Colangelo wrote:
> I agree with you that adding custom fortunes in a simple way would be a nice
> addition to fortune-mod. OTOH, this should be done by upstream developers, who
> seems vanished, unfortunately.

Well, "upstream" is ... complicated here. fortune was written by Ken
Arnold in something like 1986, about thirty years ago, and didn't change
that much since then. It was part of the ancestral v7 Unix and from
there landed in the various BSDs. The one we have in Debian is
apparently from NetBSD, but I checked and the NetBSD one is actually
pretty similar to the FreeBSD one as well, just like DragonflyBSD.
OpenBSD actually went and audited the heck out of it. Here are the
canonical sources for all of those:

http://cvsweb.netbsd.org/bsdweb.cgi/src/games/fortune/fortune/fortune.c
https://svnweb.freebsd.org/base/head/usr.bin/fortune/fortune/fortune.c
https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/games/fortune/fortune/fortune.c
https://gitweb.dragonflybsd.org/dragonfly.git/history/HEAD:/games/fortune/fortune/fortune.c

That said, it might be worth filing a feature request in the FreeBSD
bugtracker, as an upstream. They recently removed all fortune databases
from their source tree so this might actually be quite useful for them.

> Further, the whole way fortne-mod accesses the
> db and extracts fortunes should be deeply straightened up.

Well, that's a hornet's nest, if you ask me. You might break a lot of
things if you don't just add the thing and try to shuffle things around
instead.

Note that there are other fortune implementations out there which might
make implementing this feature much easier. Just one example, linked
(strangely) from wikipedia:

https://software.clapper.org/fortune/
https://github.com/bmc/fortune

There are about half a dozen of those on pypi, for what that's worth...
None of them support ~/.fortunes as far as I know. But many fortunes
program (including FreeBSD's, but not Net or OpenBSD's) allow
environment variables (e.g. FORTUNE_PATH) to modify the search path.

So if that would be acceptable for you, syncing with the FreeBSD
upstream would allow a variation of this to work with environment
variables.

A.

-- 
Dr. King’s major assumption was that if you are nonviolent, if you
suffer, your opponent will see your suffering and will be moved to
change his heart. He only made one fallacious assumption: In order for
nonviolence to work, your opponent must have a conscience. The United
States has none.        - Stokely Carmichael

Attachment: signature.asc
Description: PGP signature

Reply via email to