bug-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-inetutils] [BUG] talk (part of inetutils) relies upon signedness o


From: Alexander E. Patrakov
Subject: [bug-inetutils] [BUG] talk (part of inetutils) relies upon signedness of char
Date: Sat, 28 Jun 2003 14:46:49 +0600
User-agent: KMail/1.5.1

In inetutils 1.4.2, file talk/display.c, line 143:

                if (*text < ' ' && *text != '\t') {
text is declared as register char* and the result of comparison of characters 
with 8th bit set with the ' ' depends on signedness of char. If char is 
signed, then all characters with 8th bit set are treated as control ones, and 
displayed incorrectly. If char is unsigned, everything is OK. Quick and dirty 
fix:

--- display.c   2001-06-02 21:27:15.000000000 +0600
+++ display.c.fixed     2003-06-28 11:55:59.000000000 +0600
@@ -140,7 +140,7 @@
                        /* check for wraparound */
                        xscroll(win, 0);
                }
-               if (*text < ' ' && *text != '\t') {
+               if ((unsigned char)(*text) < ' ' && *text != '\t') {
                        waddch(win->x_win, '^');
                        getyx(win->x_win, win->x_line, win->x_col);
                        if (win->x_col == COLS-1) /* check for wraparound */
@@ -148,7 +148,7 @@
                        cch = (*text & 63) + 64;
                        waddch(win->x_win, cch);
                } else
-                       waddch(win->x_win, *text);
+                       waddch(win->x_win, (unsigned char)(*text));
                getyx(win->x_win, win->x_line, win->x_col);
                text++;
        }

Please notify me if you have read this mail. Otherwise I will think that it is 
wrong that free software is supported at all. It would be nice if you also 
notify me on changes of this bug's status.

-- 
Alexander E. Patrakov





reply via email to

[Prev in Thread] Current Thread [Next in Thread]