#!/usr/bin/perl

# spurt.pl, a little server to use /dev/bollocks in your .signature or motd (botd).
# It doesn't daemonise yet, so run it in the background.
# Shamelessly ripped (and debugged...) from the perlipc(1) manpage by rage.
# I guess the copyright lives with perl.

chdir; # go home
$FIFO = '.signature'; # Change this if you don't want to zap your .signature!
$ENV{PATH} = '';
$CAT = '/bin/cat';
$LINELENGTH = 72;

while (1) {
	unless (-p $FIFO) {
		unlink $FIFO;
		system('mknod', $FIFO, 'p')
		|| die "can't mknod $FIFO: $!";
	}
	# next line blocks until there's a reader
	open (FIFO, "> $FIFO") || die "can't write $FIFO: $!";
	$spurt = `$CAT /dev/bollocks`;
	print FIFO<<__EOB__;

------------------------------------------------------------------

  In order to forge new paths along the superhighway we must:

      $spurt
  /dev/bollocks, a middle-manager emulator for the Linux Kernel!
  An idea so crap, it can only have come from middle management.

  Full info and download at:

      <http://www.fatsquirrel.org/veghead/software/bollocks/>

------------------------------------------------------------------
__EOB__
	close FIFO;
	sleep 2;    # to avoid dup signals
}

