[comp.sources.d] minimalist version of "screens"

brad@looking.UUCP (Brad Templeton) (11/27/88)

[Agreed.  But since when has that stopped anyone?  ++bsa]

I thought it was a bit overblown.  What it describes can be easily done
with a trivial shell script, and this short program that I wrote, which
I use to have the cron pick a random joke from my joke queues.

pick.c:

main(argc,argv)
int argc;
char **argv;
{
	long time();

	srand( (unsigned int)time( (long *)0 ) );
	if( argc > 1 && strcmp(argv[1],"*") )
		printf( "%s\n", argv[ 1 + (rand() % (argc-1)) ] );
}

You say something like

p `pick ~/.screens/*`

to get the same effect.

Hardly even worth posting...