[PATCH] abbreviated group names are sometimes cut off

Dennis Preiser <[email protected]> Sat, 8 Oct 2011 12:41:43 +0200
Newsgroups gmane.network.tin.devel
Message-ID <[email protected]>
If abbreviate_groupname=ON and show_description=ON group names of groups
with no description could be cut off.

Example (Selection Level)

show_description=OFF:

  u 40 K        vmsnet.networks.tcp-ip.misc
  u 40 K        vmsnet.networks.tcp-ip.ucx
  u 40 K        vmware.for-linux.configuration
  u 40 K        vmware.for-linux.experimental

show_description=ON:

  u 40 K        v.n.tcp-ip.misc       Other TCP/IP solutions for VMS.
  u 40 K        v.n.tcp-ip.ucx        DEC's VMS/Ultrix Connection (TCP/IP
  u 40 K        vmware.for-linux.con
  u 40 K        vmware.for-linux.exp

This was caused by an incorrect length argument that was passed to
abbr_[wcs]groupname(). With the attached patch the screen
(show_description=ON) looks like this:

  u 40 K        v.n.tcp-ip.misc       Other TCP/IP solutions for VMS.
  u 40 K        v.n.tcp-ip.ucx        DEC's VMS/Ultrix Connection (TCP/IP
  u 40 K        v.f.configuration
  u 40 K        v.f.experimental

Dennis
20111108.diff (text/plain, 1.2 KB)
diff -urp tin-2.1.0/src/select.c tin-2.1.0_r1/src/select.c
--- tin-2.1.0/src/select.c	2011-08-30 13:53:36.000000000 +0200
+++ tin-2.1.0_r1/src/select.c	2011-10-07 20:27:19.000000000 +0200
@@ -674,11 +674,7 @@ build_gline(
 		active_desc = char2wchar_t(active[n].description);
 
 	if (active_name && tinrc.abbreviate_groupname) {
-		if (show_description && !active_desc)
-			active_name2 = abbr_wcsgroupname(active_name, (size_t) (groupname_len + blank_len));
-		else
-			active_name2 = abbr_wcsgroupname(active_name, (size_t) groupname_len);
-
+		active_name2 = abbr_wcsgroupname(active_name, (size_t) groupname_len);
 		free(active_name);
 	} else
 		active_name2 = active_name;
@@ -720,12 +716,9 @@ build_gline(
 
 	FreeIfNeeded(name_buf);
 #else
-	if (tinrc.abbreviate_groupname) {
-		if (show_description && !active[n].description)
-			active_name = abbr_groupname(active[n].name, (size_t) (groupname_len + blank_len));
-		else
-			active_name = abbr_groupname(active[n].name, (size_t) groupname_len);
-	} else
+	if (tinrc.abbreviate_groupname)
+		active_name = abbr_groupname(active[n].name, (size_t) groupname_len);
+	else
 		active_name = my_strdup(active[n].name);
 
 	if (show_description) {