I don't have a C compiler setup on my AIX 4.3.3 box, but I need a simple
program compiled. I *really* don't want to setup the compiler just for this
one program, so I'm hoping that some gracious soul out there would compile
would greatly appreciate someones help.
Here is the source. Thx-v-much.
Than Martens
P.S. May god have mercy on your soul if you add a virus to the binary.
/************************************************************************** * timechoice.c - Program to read from standard input with a timeout after * * a specified number of seconds if nothing has been * * entered. The input is then echoed to standard output. * * * * Usage: timechoice <seconds> * * * * Most common use is to call timechoice from a shell script in order to set * the value of an environment variable. For example: * * * * #!/bin/sh * * CHOICE=`timechoice 10 * * * * would read from standard input and place the result into CHOICE, or would * exit after 10 seconds if nothing was entered. * * * *************************************************************************** #include <stdio.h> #include <stdlib.h> #include <signal.h> void timeout (void) { exit (2); int argc; char **argv; { char instring[255]; int timeoutval; if (argc != 2) { printf ("\nUsage: %s <seconds>\n\n", argv[0]); exit (1); signal (SIGALRM, timeout); alarm (timeoutval); gets (instring); puts (instring); exit (0);
****
*
*
*/
void main (argc, argv)
if ((timeoutval = atoi (argv[1])) > 0) {
else exit (1);