CVS: rdesktop proto.h,1.78,1.79 rdesktop.c,1.133,1.134 xkeymap.c,1.82,1.83

Peter Åstrand <[email protected]>
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/rdesktop
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31953

Modified Files:
	proto.h rdesktop.c xkeymap.c 
Log Message:
Reorganized the automatic selection of keymap: The message about autoselection is not printed if -k is not given.

Index: proto.h
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/proto.h,v
retrieving revision 1.78
retrieving revision 1.79
diff -C2 -d -r1.78 -r1.79
*** proto.h	3 Aug 2005 09:56:00 -0000	1.78
--- proto.h	4 Aug 2005 12:44:10 -0000	1.79
***************
*** 167,171 ****
  void xclip_init(void);
  /* xkeymap.c */
! void xkeymap_from_locale(const char *locale);
  FILE *xkeymap_open(const char *filename);
  void xkeymap_init(void);
--- 167,171 ----
  void xclip_init(void);
  /* xkeymap.c */
! BOOL xkeymap_from_locale(const char *locale);
  FILE *xkeymap_open(const char *filename);
  void xkeymap_init(void);

Index: rdesktop.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/rdesktop.c,v
retrieving revision 1.133
retrieving revision 1.134
diff -C2 -d -r1.133 -r1.134
*** rdesktop.c	4 Aug 2005 11:19:06 -0000	1.133
--- rdesktop.c	4 Aug 2005 12:44:10 -0000	1.134
***************
*** 28,32 ****
  #include <sys/times.h>		/* times */
  #include <ctype.h>		/* toupper */
! #include <limits.h>             /* PATH_MAX */
  #include <errno.h>
  #include "rdesktop.h"
--- 28,32 ----
  #include <sys/times.h>		/* times */
  #include <ctype.h>		/* toupper */
! #include <limits.h>		/* PATH_MAX */
  #include <errno.h>
  #include "rdesktop.h"
***************
*** 52,56 ****
  char g_username[64];
  char g_hostname[16];
! char keymapname[PATH_MAX] = "en-us";
  int g_keylayout = 0x409;	/* Defaults to US keyboard layout */
  int g_keyboard_type = 0x4;	/* Defaults to US keyboard layout */
--- 52,56 ----
  char g_username[64];
  char g_hostname[16];
! char keymapname[PATH_MAX] = "";
  int g_keylayout = 0x409;	/* Defaults to US keyboard layout */
  int g_keyboard_type = 0x4;	/* Defaults to US keyboard layout */
***************
*** 375,388 ****
  	char *p;
  	int c;
! 	char *locale;
  	int username_option = 0;
  
  	/* Set locale according to environment */
  	locale = setlocale(LC_ALL, "");
  	if (locale)
  	{
! 		xkeymap_from_locale(locale);
  	}
  
  	flags = RDP_LOGON_NORMAL;
  	prompt_password = False;
--- 375,395 ----
  	char *p;
  	int c;
! 	char *locale = NULL;
  	int username_option = 0;
  
+ #ifdef HAVE_LOCALE_H
  	/* Set locale according to environment */
  	locale = setlocale(LC_ALL, "");
  	if (locale)
  	{
! 		locale = strdup(locale);
! 		if (locale == NULL)
! 		{
! 			perror("strdup");
! 			exit(1);
! 		}
  	}
  
+ #endif
  	flags = RDP_LOGON_NORMAL;
  	prompt_password = False;
***************
*** 751,754 ****
--- 758,776 ----
  	}
  
+ 	if (keymapname[0] == 0)
+ 	{
+ 		if (locale && xkeymap_from_locale(locale))
+ 		{
+ 			fprintf(stderr, "Autoselected keyboard map %s\n", keymapname);
+ 		}
+ 		else
+ 		{
+ 			STRNCPY(keymapname, "en-us", sizeof(keymapname));
+ 		}
+ 	}
+ 	if (locale)
+ 		xfree(locale);
+ 
+ 
  	if (prompt_password && read_password(password, sizeof(password)))
  		flags |= RDP_LOGON_AUTO;

Index: xkeymap.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/xkeymap.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -C2 -d -r1.82 -r1.83
*** xkeymap.c	3 Aug 2005 11:47:20 -0000	1.82
--- xkeymap.c	4 Aug 2005 12:44:10 -0000	1.83
***************
*** 160,164 ****
  }
  
! void
  xkeymap_from_locale(const char *locale)
  {
--- 160,164 ----
  }
  
! BOOL
  xkeymap_from_locale(const char *locale)
  {
***************
*** 212,217 ****
  		fclose(fp);
  		STRNCPY(keymapname, str, sizeof(keymapname));
! 		fprintf(stderr, "Autoselected keyboard map %s.\n", keymapname);
  	}
  }
  
--- 212,219 ----
  		fclose(fp);
  		STRNCPY(keymapname, str, sizeof(keymapname));
! 		return True;
  	}
+ 
+ 	return False;
  }
  



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.