From owner-freebsd-ports Sat Feb 24 10:51:44 2001 Delivered-To: freebsd-ports@freebsd.org Received: from uucp.citykom.de (newsfeed.citykom.de [195.202.32.229]) by hub.freebsd.org (Postfix) with ESMTP id 636CA37B491; Sat, 24 Feb 2001 10:51:37 -0800 (PST) (envelope-from roxel.ms.sub.org!dirk@book7.ms.sub.org) Received: from book7.ms.sub.org (uucp@localhost) by uucp.citykom.de (8.8.8/8.8.8) with UUCP id TAA17288; Sat, 24 Feb 2001 19:24:43 +0100 Received: by book7.ms.sub.org (Smail3.1.28.1 #6) id m14WjGn-00137lC; Sat, 24 Feb 101 19:18 MET Received: (from dirk@localhost) by roxel.ms.sub.org (8.11.0/8.11.0) id f1OIZFU08308; Sat, 24 Feb 2001 19:35:15 +0100 Date: Sat, 24 Feb 2001 19:35:15 +0100 From: Dirk Nimmich To: Nickolay Dudorov 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> Mail-Followup-To: Nickolay Dudorov , ache@freebsd.org, ports@freebsd.org, tin-dev@tin.org References: <20010224223832.A13241@wint.itfs.nsk.su> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="qtZFehHsKgwS5rPz" X-Mailer: Mutt 1.0.1i In-Reply-To: <20010224223832.A13241@wint.itfs.nsk.su>; from nnd@wint.itfs.nsk.su on Sat, Feb 24, 2001 at 10:38:32PM +0600 Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org --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