Caps (from caps.shar) and SunOS4.0

Rob McMahon cudcv%warwick.ac.uk at nss.cs.ucl.ac.uk
Sat Jan 28 17:55:40 AEST 1989


ESC1298 at 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 at uk.ac.warwick             ARPA:   cudcv at warwick.ac.uk
Rob McMahon, Computing Services, Warwick University, Coventry CV4 7AL, England



More information about the Comp.sys.sun mailing list