more checks when centering a line

This commit is contained in:
marschap
2004-12-30 17:19:17 +00:00
parent 6e8850087c
commit df637e1349
+3 -1
View File
@@ -175,7 +175,9 @@ time_screen (int rep, int display)
else
sprintf (tmp, "%s%c%s%c%s%s %2i%% idle", hr, colon, min, colon, sec, ampm, (int) idle);
// Center the output line...
i = ((lcd_wid - strlen (tmp)) / 2) + 1;
i = (lcd_wid > strlen(tmp))
? ((lcd_wid - strlen (tmp)) / 2) + 1
: 1;
sprintf (buffer, "widget_set T three %i 4 {%s}\n", i, tmp);
if (display)
sock_send_string (sock, buffer);