1: /* Copyright (c) 1979 Regents of the University of California */ 2: /* 3: * clock - continually print the time of day 4: */ 5: #include <setjmp.h> 6: jmp_buf env; 7: 8: main() 9: { 10: register char *tp; 11: int tim[2]; 12: extern int stop(); 13: 14: setjmp(env); 15: signal(3, &stop); 16: time(tim); 17: tp = ctime(tim)+11; 18: printf("\n\t%8.8s\t", tp); 19: while (1) { 20: time(tim); 21: tp = ctime(tim)+11; 22: printf("%8.8s\b\b\b\b\b\b\b\b",tp); 23: sleep(1); 24: } 25: } 26: 27: 28: stop() 29: { 30: extern int start(); 31: signal(3, &start); 32: while (1) 33: sleep(3600); 34: } 35: 36: start() 37: { 38: longjmp(env, 1); 39: }