A short program written by yours truly. I was insanely bored. All the more reason that I should not be trusted with a C compiler or caffeine. May God have mercy on my soul. Some pieces of the source are moderately funny.

/*
 * prayer.c
 * Under BSD-ish license
 * 	(like certain religious holidays, it can
 * 	 be put in a commercial setting and
 * 	 marketed shamelessly)
 *
 * echoes stdin text to omnipotent device entry
 *
 * also unsets terminal input echo flag, giving
 * compliance with Matthew 6:4-6
 *
 * compile with -DCRISTIAN for /dev/jesus support
 */

#ifdef CHRISTIAN
#define LORD "/dev/jesus"
#else
#define LORD "/dev/god"
#endif

#include <stdio.h>
#include <unistd.h>

#include <termios.h>
#include <signal.h>

#include <stdlib.h>
#define THE_WORLD_IS_A_TERRIBLE_PLACE EXIT_FAILURE
	/* what to return if LORD doesn't exist :-) */

#include <assert.h>
#include <errno.h>

static struct termios old;
static int exit_signals[] = { SIGINT, SIGTERM };

void cleanup_term( int signum ) {
	tcsetattr( fileno(stdout), 0, &old );
}

int main() {

	struct termios new;
	FILE *Lord;		/* capitalization necessary :-) */
	int c , i;

	assert( isatty( fileno(stdout) ) );
	tcgetattr( fileno(stdout), &old );
	new = old;
	new.c_lflag &= ~ECHO;

	Lord = fopen( LORD, "w" );
	if( Lord == NULL ) {
		(errno == ENOENT) ?
			fprintf( stderr, "...  No " LORD "?\n" ) :
			perror( LORD );
		return THE_WORLD_IS_A_TERRIBLE_PLACE;
	}

	tcsetattr( fileno(stdout), 0, &new );
	for( i=0; i<sizeof(exit_signals)/sizeof(int); i++ ) 
		signal( exit_signals[i], cleanup_term );
	fprintf( Lord, "Oh Lord, I pray to thee:\n\n\t" );

	while( (c=getchar()) != EOF )
		fputc( c, Lord );
	
	fclose( Lord );
	tcsetattr( fileno(stdout), 0, &old );
	return 0;

}

Log in or registerto write something here or to contact authors.