Date: Sat, 24 Feb 2001 19:35:15 +0100 From: Dirk Nimmich <nimmich@uni-muenster.de> To: Nickolay Dudorov <nnd@wint.itfs.nsk.su> Cc: ache@freebsd.org, ports@freebsd.org, tin-dev@tin.org Subject: Re: Patch for tin's src/keymap.c error Message-ID: <20010224193515.A901@roxel.ms.sub.org> In-Reply-To: <20010224223832.A13241@wint.itfs.nsk.su>; from nnd@wint.itfs.nsk.su on Sat, Feb 24, 2001 at 10:38:32PM %2B0600 References: <20010224223832.A13241@wint.itfs.nsk.su>
next in thread | previous in thread | raw e-mail | index | archive | help
--qtZFehHsKgwS5rPz Content-Type: multipart/mixed; boundary="St7VIuEGZ6dlpu13" --St7VIuEGZ6dlpu13 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Thank you for your report. Nickolay Dudorov wrote: > In the file 'keymap.c' there is the next fragment started > from the line 912 (this is for tin-1.5.8-release, the same problem > was in the tin-1.5.6-release): > -------------------------------------------------------------------------= ----- > /* get locale suffix */ > map =3D get_val("LC_ALL", get_val("LC_CTYPE", get_val("LC_MESSAGES", get= _val("LANG", "")))); > if (strlen(map)) { > if ((ptr =3D strchr (map, '.'))) > *ptr =3D '\0'; > -------------------------------------------------------------------------= ----- > After the last assignment (if it is executed) the value of the > environment variable ("LANG" for example in my case) will be changed > and this can later broke the correct behavior of the EDITOR command > for example. I didn't know that you operate directly in the environment by doing this. Of course, this is a very bad idea. > --- src/keymap.c.orig Sat Feb 24 22:08:02 2001 > +++ src/keymap.c Sat Feb 24 22:08:02 2001 > @@ -936,6 +936,8 @@ > } > #endif /* TIN_DEFAULTS_DIR */ > =20 > +/* Restore environment value */ > + if (ptr !=3D NULL) *ptr =3D'.'; Still, I don't think it's a good idea to work directly on the environment. A much better idea is to use a local copy of the value, so please try the patch attached to this message. Again, thank you for your notice, but please use tin-dev@tin.org or tin-bugs@tin.org for reporting bugs and patches in the future. --St7VIuEGZ6dlpu13 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="keymap.diff" --- tin-1.5.8/src/keymap.c Wed Jan 10 01:58:28 2001 +++ tin-1.5.8-dn/src/keymap.c Sat Feb 24 19:23:53 2001 @@ -891,8 +891,8 @@ { FILE *fp = (FILE *) 0; char *line, *keydef, *kname; - char *ptr; - const char *ptr2, *map; + char *map, *ptr; + const char *ptr2; char buf[LEN], buff[LEN]; char key; int i; @@ -910,7 +910,7 @@ */ ptr2 = get_val("TIN_HOMEDIR", get_val("HOME", homedir)); /* get locale suffix */ - map = get_val("LC_ALL", get_val("LC_CTYPE", get_val("LC_MESSAGES", get_val("LANG", "")))); + map = my_strdup(get_val("LC_ALL", get_val("LC_CTYPE", get_val("LC_MESSAGES", get_val("LANG", ""))))); if (strlen(map)) { if ((ptr = strchr (map, '.'))) *ptr = '\0'; @@ -936,6 +936,7 @@ } #endif /* TIN_DEFAULTS_DIR */ + FreeIfNeeded(map); if (!fp) return FALSE; --St7VIuEGZ6dlpu13-- --qtZFehHsKgwS5rPz Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: 2.6.3in iQCVAwUBOpf+4yWkuIfXXOepAQFe3AP/WS9ZRTNtDCzlZlqmtCBC5yzckEu7eDmc v3y7JYyZoI8q89yiGpKDG+Ms3ksXYN6KmGBcHDNXbunEoWoumyBCTxDmlqA/CGb4 GXhyofsw5cOfeV0OOu/K0biovKyDS8AM12BF4XxD7RO5YR1C9xtc3h9F5FfvW/RI GZpst6f0n2g= =o4Y1 -----END PGP SIGNATURE----- --qtZFehHsKgwS5rPz-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010224193515.A901>