/* file: wave-remote-test.c G. Moody 10 October 1996 Testbed for wave-remote */ #include #include #include char fname[30]; int i; void exitproc(s) int s; { unlink(fname); printf("\nReceived signal %d -- exiting\n", s); exit(s); } void actionproc(s) { char buf[80]; FILE *ifile; printf("\n"); ifile = fopen(fname, "r"); while (fgets(buf, sizeof(buf), ifile)) fputs(buf, stdout); fclose(ifile); fclose(fopen(fname, "w")); signal(SIGUSR1, actionproc); i = 0; } main(argc, argv) int argc; char **argv; { sprintf(fname, "/tmp/.wave.%d.%d", (int)getuid(), (int)getpid()); fclose(fopen(fname, "w")); /* create fname as an empty file */ signal(SIGHUP, exitproc); signal(SIGINT, exitproc); signal(SIGQUIT, exitproc); signal(SIGUSR1, actionproc); signal(SIGTERM, exitproc); printf("wave-remote-test now running, sentinel file: %s\n", fname); while (1) { sleep(1); printf("."); if (++i > 79) { i = 0; printf("\n"); } fflush(stdout); } }