summaryrefslogtreecommitdiff
path: root/japanese/kon2-16dot/files/patch-src_mouse.c
diff options
context:
space:
mode:
Diffstat (limited to 'japanese/kon2-16dot/files/patch-src_mouse.c')
-rw-r--r--japanese/kon2-16dot/files/patch-src_mouse.c145
1 files changed, 72 insertions, 73 deletions
diff --git a/japanese/kon2-16dot/files/patch-src_mouse.c b/japanese/kon2-16dot/files/patch-src_mouse.c
index 5b6607c63914..987dcf478cdd 100644
--- a/japanese/kon2-16dot/files/patch-src_mouse.c
+++ b/japanese/kon2-16dot/files/patch-src_mouse.c
@@ -1,73 +1,72 @@
- --- src/mouse.c 30 Sep 2008 08:09:56 -0000 1.1.1.2
- +++ src/mouse.c 23 Oct 2008 09:24:33 -0000
- @@ -122,11 +122,11 @@
- }
- };
-
- -static int mouseBaud;
- +static int mouseBaud = B1200;
-
- static int ConfigMouseBaud(const char *config)
- {
- - int baud;
- + int baud = 0;
-
- sscanf(config, "%d", &baud);
-
- @@ -149,19 +149,23 @@
- return SUCCESS;
- }
-
- -static char *mouseDev;
- +static char *mouseDev = NULL;
-
- static int ConfigMouseDev(const char *config)
- {
- - char name[MAX_COLS];
- - sscanf(config, "%s", name);
- + char *name, *last, *sep = " \t\r\n";
-
- - if (mouseDev) free(mouseDev);
- + name = strtok_r((char *)config, sep, &last);
- + if (name == NULL) {
- + warn("unknown mouse type ignored; assuming no mouse\r\n");
- + return SUCCESS;
- + }
- + SafeFree(mouseDev);
- mouseDev = strdup(name);
- return SUCCESS;
- }
-
- -static int pasteButton;
- +static int pasteButton = MOUSE_RGT;
-
- static int Config3Buttons(const char *config)
- {
- @@ -172,12 +176,15 @@
- static int ConfigMouse(const char *config)
- {
- struct mouseconf *p;
- - char name[MAX_COLS];
- + char *name, *last, *sep = " \t\r\n";
-
- mouseType = MOUSE_NONE;
- mInfo.has_mouse = FALSE;
- - strncpy(name, config, MAX_COLS - 1);
- - name[MAX_COLS - 1] = '\0';
- + name = strtok_r((char *)config, sep, &last);
- + if (name == NULL) {
- + warn("unknown mouse type ignored; assuming no mouse\r\n");
- + return SUCCESS;
- + }
- for (p = mice; p->name != NULL; p++) {
- if (strcasecmp(name, p->name) == 0) {
- mouseType = p->type;
- @@ -254,7 +261,7 @@
- if ((mfd = open(mouseDev, O_RDWR|O_NONBLOCK)) < 0) {
- warn("couldn't open mouse device; mouse disabled\n");
- Perror(mouseDev);
- - free(mouseDev);
- + SafeFree(mouseDev);
- mouseDev = NULL;
- mInfo.has_mouse = FALSE;
- return -1;
+--- src/mouse.c.orig 1997-01-27 20:40:27.000000000 +0900
++++ src/mouse.c 2012-05-10 00:14:28.944551694 +0900
+@@ -122,11 +122,11 @@
+ }
+ };
+
+-static int mouseBaud;
++static int mouseBaud = B1200;
+
+ static int ConfigMouseBaud(const char *config)
+ {
+- int baud;
++ int baud = 0;
+
+ sscanf(config, "%d", &baud);
+
+@@ -149,19 +149,23 @@
+ return SUCCESS;
+ }
+
+-static char *mouseDev;
++static char *mouseDev = NULL;
+
+ static int ConfigMouseDev(const char *config)
+ {
+- char name[MAX_COLS];
+- sscanf(config, "%s", name);
++ char *name, *last, *sep = " \t\r\n";
+
+- if (mouseDev) free(mouseDev);
++ name = strtok_r((char *)config, sep, &last);
++ if (name == NULL) {
++ warn("unknown mouse type ignored; assuming no mouse\r\n");
++ return SUCCESS;
++ }
++ SafeFree(mouseDev);
+ mouseDev = strdup(name);
+ return SUCCESS;
+ }
+
+-static int pasteButton;
++static int pasteButton = MOUSE_RGT;
+
+ static int Config3Buttons(const char *config)
+ {
+@@ -172,11 +176,15 @@
+ static int ConfigMouse(const char *config)
+ {
+ struct mouseconf *p;
+- char name[MAX_COLS];
++ char *name, *last, *sep = " \t\r\n";
+
+ mouseType = MOUSE_NONE;
+ mInfo.has_mouse = FALSE;
+- sscanf(config, "%s", name);
++ name = strtok_r((char *)config, sep, &last);
++ if (name == NULL) {
++ warn("unknown mouse type ignored; assuming no mouse\r\n");
++ return SUCCESS;
++ }
+ for (p = mice; p->name != NULL; p++) {
+ if (strcasecmp(name, p->name) == 0) {
+ mouseType = p->type;
+@@ -253,7 +261,7 @@
+ if ((mfd = open(mouseDev, O_RDWR|O_NONBLOCK)) < 0) {
+ warn("couldn't open mouse device; mouse disabled\n");
+ Perror(mouseDev);
+- free(mouseDev);
++ SafeFree(mouseDev);
+ mouseDev = NULL;
+ mInfo.has_mouse = FALSE;
+ return -1;