Also look for keymaps in keymaps/%s so that rdesktop can be run "in place"

without installation... I find this useful for testing and it might avoid
some user complaints as well.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@215 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Matt Chapman 2002-10-08 02:30:20 +00:00
parent faae4044d3
commit 0e88940ee5

View File

@ -69,7 +69,8 @@ static BOOL
xkeymap_read(char *mapname) xkeymap_read(char *mapname)
{ {
FILE *fp; FILE *fp;
char line[KEYMAP_MAX_LINE_LENGTH], path[PATH_MAX]; char line[KEYMAP_MAX_LINE_LENGTH];
char path[PATH_MAX], inplace_path[PATH_MAX];
unsigned int line_num = 0; unsigned int line_num = 0;
unsigned int line_length = 0; unsigned int line_length = 0;
char *keyname, *p; char *keyname, *p;
@ -83,10 +84,18 @@ xkeymap_read(char *mapname)
fp = fopen(path, "r"); fp = fopen(path, "r");
if (fp == NULL) if (fp == NULL)
{
/* in case we are running from the source tree */
strcpy(inplace_path, "keymaps/");
strncat(inplace_path, mapname, sizeof(inplace_path) - sizeof("keymaps/"));
fp = fopen(inplace_path, "r");
if (fp == NULL)
{ {
error("Failed to open keymap %s\n", path); error("Failed to open keymap %s\n", path);
return False; return False;
} }
}
/* FIXME: More tolerant on white space */ /* FIXME: More tolerant on white space */
while (fgets(line, sizeof(line), fp) != NULL) while (fgets(line, sizeof(line), fp) != NULL)