home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
unix
/
volume10
/
x10r4.sunpch
/
part03
/
Xlib
/
changes
/
XKeyBind.c.patch
< prev
Wrap
Text File
|
1987-07-14
|
5KB
|
170 lines
*** /usr/src/new/X.V10R4/Xlib/XKeyBind.c Mon Dec 1 19:05:22 1986
--- XKeyBind.c Mon Jun 8 14:29:50 1987
***************
*** 1,6 ****
#include <X/mit-copyright.h>
! /* $Header: XKeyBind.c,v 10.12 86/07/21 15:27:14 wesommer Rel $ */
/* Copyright 1985, Massachusetts Institute of Technology */
#include "XlibInternal.h"
--- 1,6 ----
#include <X/mit-copyright.h>
! /* $Header: XKeyBind.c,v 1.2 87/05/02 17:22:44 mayer Exp $ */
/* Copyright 1985, Massachusetts Institute of Technology */
#include "XlibInternal.h"
***************
*** 10,15 ****
--- 10,18 ----
#include "Xkeyboard.h"
#include <stdio.h>
#include <strings.h>
+ #ifdef KEYBD
+ #include "Xdefault.h"
+ #endif KEYBD
#define EMPTY_ENTRY LeftMask
/* if the "metabits" field of a runtime table entry contains this,
***************
*** 25,31 ****
typedef struct {
unsigned char keycode;
! unsigned char metabits;
short length;
char *value;
} RuntimeTableEntry;
--- 28,34 ----
typedef struct {
unsigned char keycode;
! unsigned short metabits;
short length;
char *value;
} RuntimeTableEntry;
***************
*** 35,40 ****
--- 38,47 ----
*rt_end, /* this and all succeeding entries are empty */
*rt_buf_end;/* points beyond end of allocated storage for table */
+ #ifdef KEYBD
+ char *keyboardtype = NULL;
+ #endif KEYBD
+
#define RT_INITIAL_SIZE 100 /* initial size of runtime table */
#define RT_INCREMENT 40 /* size to grow by if expanded */
***************
*** 54,61 ****
if (filesize < 256*sizeof(KeyMapElt)) {
fprintf (stderr, "Keymap file %s is too small\n", filename);
close (file);
! free (filename);
! return;
}
read (file, &magic, 1);
if (magic != X_KEYMAP_MAGIC) {
--- 61,67 ----
if (filesize < 256*sizeof(KeyMapElt)) {
fprintf (stderr, "Keymap file %s is too small\n", filename);
close (file);
! return(0);
}
read (file, &magic, 1);
if (magic != X_KEYMAP_MAGIC) {
***************
*** 84,98 ****
}
static Initialize() {
! int file;
int filesize;
unsigned char magic;
struct stat filestat;
char *getenv();
! char *filename;
char *home = getenv ("HOME");
inited = TRUE;
! if (home) {
int homelen = strlen (home);
char *keymapstr = "/.Xkeymap";
int keymapstrlen = strlen (keymapstr);
--- 90,125 ----
}
static Initialize() {
! int file = -1;
int filesize;
unsigned char magic;
struct stat filestat;
char *getenv();
! char *filename = NULL;
! #ifdef KEYBD
! char *home;
! char *kdefault = "default";
! char *keybddir = KEYBDDIR;
! #else KEYBD
char *home = getenv ("HOME");
+ #endif KEYBD
+
inited = TRUE;
! #ifdef KEYBD
! if(keyboardtype && *keyboardtype) { /* Use keyboard type keymap */
! filename = malloc(strlen(keybddir) + strlen(keyboardtype) + 1);
! strcpy(filename, keybddir);
! strcat(filename, keyboardtype);
! if((file = open (filename, O_RDONLY, 0)) < 0) {
! free (filename);
! filename = NULL;
! }
! }
! if(file < 0 && (home = getenv ("HOME")))
! #else KEYBD
! if (home)
! #endif KEYBD
! {
int homelen = strlen (home);
char *keymapstr = "/.Xkeymap";
int keymapstrlen = strlen (keymapstr);
***************
*** 100,112 ****
strncpy (filename, home, homelen+1);
strncat (filename, keymapstr, keymapstrlen);
file = open (filename, O_RDONLY, 0);
- if (file < 0) {
- free (filename);
- return; /* no keymap file found */
- }
}
! else
! return; /* no home directory to find keymap file in! */
fstat (file, &filestat);
filesize = filestat.st_size - 1; /* first byte is magic number */
if (filesize < 256*sizeof(KeyMapElt)) {
--- 127,148 ----
strncpy (filename, home, homelen+1);
strncat (filename, keymapstr, keymapstrlen);
file = open (filename, O_RDONLY, 0);
}
! #ifdef KEYBD
! if (file < 0) { /* Try system default keymap */
! if(filename)
! free(filename);
! filename = malloc(strlen(keybddir) + strlen(kdefault) + 1);
! strcpy(filename, keybddir);
! strcat(filename, kdefault);
! file = open (filename, O_RDONLY, 0);
! }
! #endif KEYBD
! if (file < 0) {
! if(filename)
! free(filename);
! return; /* no keymap file found */
! }
fstat (file, &filestat);
filesize = filestat.st_size - 1; /* first byte is magic number */
if (filesize < 256*sizeof(KeyMapElt)) {