Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!sun-spots-request From: cudcv%warwick.ac.uk@nss.cs.ucl.ac.uk (Rob McMahon) Newsgroups: comp.sys.sun Subject: Re: Caps (from caps.shar) and SunOS4.0 Message-ID: <94@titania.warwick.ac.uk> Date: 28 Jan 89 07:55:40 GMT References: <8901091432.AA02687@rice.edu> Sender: usenet@rice.edu Organization: Computing Services, Warwick University, UK Lines: 71 Approved: Sun-Spots@rice.edu Original-Date: 21 Jan 89 18:33:29 GMT X-Sun-Spots-Digest: Volume 7, Issue 126, message 9 of 12 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