jeff@voder.UUCP (07/10/84)
After installing vnews recently on our 4.2 system I noticed that the time field in the prompt line wasn't being updated. Long hours (and several wild goose chases) later I discovered the following problems. In visual.c: vgetc() uses select() to wait for input from the keyboard. Unfortunately, there is already a subroutine called select defined in rfuncs.c. The solution here is easy: edit rfuncs.c and readr.c to change the names of the innocent. *** diff old.rfuncs.c rfuncs.c 214c214 < || !select(&h, FALSE)) { --- > || !selectart(&h, FALSE)) { 417c417 < select(hp, insist) --- > selectart(hp, insist) *** diff old.readr.c readr.c 1163c1163 < || (!rfq && !select(&h, abs))) { --- > || (!rfq && !selectart(&h, abs))) { In visual.c the changes are slightly more involved: *** old.visual.c Mon Jul 9 23:04:32 1984 --- visual.c Mon Jul 9 23:04:54 1984 *************** *** 1802,1803 i = 60 - t->tm_sec; alarm(i > 30? 30 : i); /* reset alarm */ --- 1802,1806 ----- i = 60 - t->tm_sec; + #ifdef BSD4_2 + alarm((unsigned) i); /* reset alarm */ + #else alarm(i > 30? 30 : i); /* reset alarm */ *************** *** 1803,1804 alarm(i > 30? 30 : i); /* reset alarm */ hour = t->tm_hour % 12; --- 1806,1808 ----- alarm(i > 30? 30 : i); /* reset alarm */ + #endif hour = t->tm_hour % 12; *************** *** 1882,1883 int readfds, exceptfds; #endif --- 1886,1888 ----- int readfds, exceptfds; + int nfound; #endif *************** *** 1902,1904 #ifdef BSD4_2 ! /* use a read because it can be interrupted */ readfds = 1; exceptfds = 1; --- 1907,1909 ----- #ifdef BSD4_2 ! /* use a select because it can be interrupted */ readfds = 1; exceptfds = 1; *************** *** 1904,1907 readfds = 1; exceptfds = 1; ! select(1,&readfds,0,&exceptfds,0); ! if (readfds & 1) { /* got a key, go ahead and get it */ innleft = read(0,inbuf,INBUFSIZ); --- 1909,1912 ----- readfds = 1; exceptfds = 1; ! nfound = select(1,&readfds,0,&exceptfds,0); ! if (nfound > 0) { /* got a key, go ahead and get it */ innleft = read(0,inbuf,INBUFSIZ); *************** *** 2041,2042 register int i; unsigned oldalarm; --- 2046,2050 ----- register int i; + #ifdef BSD4_2 + int mask; + #else unsigned oldalarm; *************** *** 2042,2043 unsigned oldalarm; --- 2050,2052 ----- unsigned oldalarm; + #endif *************** *** 2047,2048 */ oldalarm = alarm((unsigned)0); /* suspend interrupts while writing */ --- 2056,2060 ----- */ + #ifdef BSD4_2 + mask = sigblock(1<<SIGALRM); /* suspend interrupts while writing */ + #else oldalarm = alarm((unsigned)0); /* suspend interrupts while writing */ *************** *** 2048,2049 oldalarm = alarm((unsigned)0); /* suspend interrupts while writing */ for (p = outbuf; p < outnext ; p += i) --- 2060,2062 ----- oldalarm = alarm((unsigned)0); /* suspend interrupts while writing */ + #endif for (p = outbuf; p < outnext ; p += i) *************** *** 2059,2060 outnext = outbuf; alarm(oldalarm); /* reset the timer */ --- 2072,2076 ----- outnext = outbuf; + #ifdef BSD4_2 + sigblock(mask); /* reenable timer interrupts */ + #else alarm(oldalarm); /* reset the timer */ *************** *** 2060,2061 alarm(oldalarm); /* reset the timer */ } --- 2076,2078 ----- alarm(oldalarm); /* reset the timer */ + #endif } N.B. The last set of changes (in vflush()) is necessitated by a bug in the 4.2 implementation of alarm(). Another article will follow explaining the problem; sorry, no fix. Jeff Gilliam No pain, no gain ... *sigh*