'-F .ds =F twinkle2.c .ds =M May 11 03:56 1981 'wh 0 vH 'wh -1i vF 'FN main main() \*(+K{\*(-K \h'|11n'reg \*(+Kchar\*(-K\h'|31n'\fI*\fPsp; \h'|11n'\*(+Kchar\*(-K\h'|31n'\fI*\fPgetenv(); \h'|11n'\*(+Kint\*(-K\h'|31n'\*_putchar(), die(); \h'|11n'srand(getpid());\h'|51n'\fI\h'\w' 'u-\w'/'u'/\fP\fI*\fP\c\c '+C initialize random sequence \fI*\fP\fI\h'\w' 'u-\w'/'u'/\fP\c '-C \h'|11n'\*(+Kif\*(-K (isatty(0)) \*(+K{\*(-K \h'|11n' gettmode(); \h'|11n' \*(+Kif\*(-K (sp=getenv("TERM")) \h'|21n' setterm(sp); \h'|21n'signal(SIGINT, die); \h'|11n'\*(+K}\*(-K \h'|11n'\*(+Kelse\*(-K \*(+K{\*(-K \h'|21n'printf("Need a terminal on %d\en", \*_tty\*_ch); \h'|21n'exit(1); \h'|11n'\*(+K}\*(-K \h'|11n'\*_puts(TI); \h'|11n'\*_puts(VS); \h'|11n'noecho(); \h'|11n'nonl(); \h'|11n'tputs(CL, NLINES, \*_putchar); \h'|11n'\*(+Kfor\*(-K (;;) \*(+K{\*(-K \h'|21n'makeboard();\h'|51n'\fI\h'\w' 'u-\w'/'u'/\fP\fI*\fP\c\c '+C make the board setup \fI*\fP\fI\h'\w' 'u-\w'/'u'/\fP\c '-C \h'|21n'puton(\'\fI*\fP\');\h'|51n'\fI\h'\w' 'u-\w'/'u'/\fP\fI*\fP\c\c '+C put on \'\fI*\fP\'s \fI*\fP\fI\h'\w' 'u-\w'/'u'/\fP\c '-C \h'|21n'puton(\' \');\h'|51n'\fI\h'\w' 'u-\w'/'u'/\fP\fI*\fP\c\c '+C cover up with \' \'s \fI*\fP\fI\h'\w' 'u-\w'/'u'/\fP\c '-C \h'|11n'\*(+K}\*(-K \*(+K}\*(-K\c\c '-F \fI\h'\w' 'u-\w'/'u'/\fP\fI*\fP\c\c '+C \fI*\fP \*_putchar defined \*(+Kfor\*(-K tputs() (and \*_puts()) \fI*\fP\fI\h'\w' 'u-\w'/'u'/\fP\c '-C 'FN _putchar \*_putchar(c) reg \*(+Kchar\*(-K\h'|21n'c; \*(+K{\*(-K \h'|11n'putchar(c); \*(+K}\*(-K\c\c '-F 'FN puton puton(ch) \*(+Kchar\*(-K\h'|11n'ch; \*(+K{\*(-K \h'|11n'\*(+Kstatic\*(-K \*(+Kint\*(-K\h'|31n'lasty, lastx; \h'|11n'reg LOCS\h'|31n'\fI*\fPlp; \h'|11n'reg \*(+Kint\*(-K\h'|31n'r; \h'|11n'reg LOCS\h'|31n'\fI*\fPend; \h'|11n'LOCS\h'|31n'temp; \h'|11n'end = &Layout[Numstars]; \h'|11n'\*(+Kfor\*(-K (lp = Layout; lp < end; lp++) \*(+K{\*(-K \h'|21n'r = rand() % Numstars; \h'|21n'temp = \fI*\fPlp; \h'|21n'\fI*\fPlp = Layout[r]; \h'|21n'Layout[r] = temp; \h'|11n'\*(+K}\*(-K \h'|11n'\*(+Kfor\*(-K (lp = Layout; lp < end; lp++) \h'|31n'\fI\h'\w' 'u-\w'/'u'/\fP\fI*\fP\c\c '+C prevent scrolling \fI*\fP\fI\h'\w' 'u-\w'/'u'/\fP\c '-C \h'|21n'\*(+Kif\*(-K (!AM || (lp\*->y < NLINES \*- 1 || lp\*->x < NCOLS \*- 1)) \*(+K{\*(-K \h'|31n'mvcur(lasty, lastx, lp\*->y, lp\*->x); \h'|31n'putchar(ch); \h'|31n'lasty = lp\*->y; \h'|31n'\*(+Kif\*(-K ((lastx = lp\*->x + 1) >= NCOLS) \h'|41n'\*(+Kif\*(-K (AM) \*(+K{\*(-K \h'|51n'lastx = 0; \h'|51n'lasty++; \h'|41n'\*(+K}\*(-K \h'|41n'\*(+Kelse\*(-K \h'|51n'lastx = NCOLS \*- 1; \h'|21n'\*(+K}\*(-K \*(+K}\*(-K\c\c '-F