patch-2.2.2 linux/scripts/lxdialog/inputbox.c

Next file: linux/scripts/lxdialog/menubox.c
Previous file: linux/scripts/lxdialog/checklist.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.1/linux/scripts/lxdialog/inputbox.c linux/scripts/lxdialog/inputbox.c
@@ -69,6 +69,14 @@
     wattrset (dialog, dialog_attr);
     waddch (dialog, ACS_RTEE);
 
+    if (title != NULL && strlen(title) >= width-2 ) {
+	/* truncate long title -- mec */
+	char * title2 = malloc(width-2+1);
+	memcpy( title2, title, width-2 );
+	title2[width-2] = '\0';
+	title = title2;
+    }
+
     if (title != NULL) {
 	wattrset (dialog, title_attr);
 	mvwaddch (dialog, 0, (width - strlen(title))/2 - 1, ' ');

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)