ESC1298@ESOC.BITNET (Danielle Heinzer) (01/13/89)
Hi,
I have tried to run "caps" under both SunOS 3.2 and SunOS 4.0. It works
ok for OS 3.2 but not for OS 4.0.
Dbx returns the following, when running "caps":
SunOS 3.2 SunOS 4.0
kb type 3 3
tablemask 0 249168054
station 119 119
entry 160 160
string "" ""
The following happens under SunOS 4.0:
%caps
caps is n
%caps y
%caps
caps is n
%
If I hit the CAPS key, it is activated.
Other scenario:
%caps
caps is n
%caps n
%caps
caps is n
%
If I hit the CAPS key, it is activated.
I see that the tablemask is wrong, it is what the system returns on
"ioctl(kb,KIOCGETKEY,&key), there is no note of any change on the keyboard
interface in the Release 4.0 Change Notes.
Any idea ?
Regards,
Danielle Heinzer
ESA Computer Department/Computer Services
European Space Operations Centre
Robert-Bosch-str. 5
6100 Darmstadt
West-Germany
Tel int : 49-6151-886540cudcv%warwick.ac.uk@nss.cs.ucl.ac.uk (Rob McMahon) (01/28/89)
ESC1298@ESOC.BITNET (Danielle Heinzer) writes: >I have tried to run "caps" under both SunOS 3.2 and SunOS 4.0. It works >ok for OS 3.2 but not for OS 4.0. Caps fails to initialiase a structure properly, I don't know why it worked on 3.2, must have been a quirk of the compiler. Here are the patches to make it work. I've also put in some perror's to find out why it was failing. Rob -- RCS file: caps.c,v retrieving revision 1.1 diff -c -r1.1 caps.c *** /tmp/,RCSt1a07809 Sat Jan 21 18:29:29 1989 --- caps.c Wed Jan 18 09:13:17 1989 *************** *** 25,38 **** --- 25,41 ---- int e; struct kiockey key; + key.kio_tablemask = 0; key.kio_station = 0x77; /* CAPS key position */ if ((kb = open("/dev/kbd", 2)) < 0) { + perror("/dev/kbd"); fprintf(stderr, "%s: Cannot open kbd\n", *argv); exit(2); } if (ioctl(kb, KIOCTYPE, &t) < 0) { + perror("ioctl KIOCTYPE"); fprintf(stderr, "%s: KIOCTYPE ioctl failed on kbd\n", *argv); exit(2); } *************** *** 46,51 **** --- 49,55 ---- /* return current status of CAPS */ if (ioctl(kb, KIOCGETKEY, &key) < 0) { + perror("ioctl KIOCGETKEY"); fprintf(stderr, "%s: KIOCGETKEY failed\n", *argv); exit(2); } *************** *** 75,80 **** --- 79,85 ---- key.kio_tablemask = masks[x]; if (ioctl(kb, KIOCSETKEY, &key) < 0) { + perror("ioctl KIOCSETKEY"); fprintf(stderr, "%s: KIOCSETKEY failed\n", *argv); exit(2); } *************** *** 83,88 **** --- 88,94 ---- key.kio_entry = NOP; if (ioctl(kb, KIOCSETKEY, &key) < 0) { + perror("ioctl KIOCSETKEY"); fprintf(stderr, "%s: KIOCSETKEY failed\n", *argv); exit(2); } -- UUCP: ...!mcvax!ukc!warwick!cudcv PHONE: +44 203 523037 JANET: cudcv@uk.ac.warwick ARPA: cudcv@warwick.ac.uk Rob McMahon, Computing Services, Warwick University, Coventry CV4 7AL, England
cudcv%warwick.ac.uk@nss.cs.ucl.ac.uk (Rob McMahon) (02/10/89)
I wrote: >Caps fails to initialiase a structure properly, I don't know why it worked >on 3.2, must have been a quirk of the compiler. Guy Harris wrote to me to explain it, and it sounds like something to watch out for. Since 4.0, main is no longer the first to get at the stack, the loader is, so variables that got initialised to zero for free under previous versions of Unix may now contain random garbage left by the loader. Rob -- UUCP: ...!mcvax!ukc!warwick!cudcv PHONE: +44 203 523037 JANET: cudcv@uk.ac.warwick ARPA: cudcv@warwick.ac.uk Rob McMahon, Computing Services, Warwick University, Coventry CV4 7AL, England [[ K&R, page 198: "Static and external variables which are not initialized are guaranteed to start off as 0; automatic and register variables which are not initialized are guaranteed to start off as garbage." --wnl ]]