Introduction
Introduction Statistics Contact Development Disclaimer Help
tFix portability problem in techo() - st - [fork] customized build of st, the s…
git clone git://src.adamsgaard.dk/st
Log
Files
Refs
README
LICENSE
---
commit 6530025bcaf3a65083667a93ae50035bd7137bae
parent d4a17316d33f3c5a0017d7fe6e7e174883ccaa97
Author: Roberto E. Vargas Caballero <[email protected]>
Date: Fri, 15 Aug 2014 14:48:16 +0200
Fix portability problem in techo()
ISCONTROL chechks if a value is between 0 and 0x1f or
between 0x80 and 0x9f. Char signess depends of architecture
and compiler, so in some environment the second case is
always false (and wrong), Techo() calls ISCONTROL with a
char variable, whose type cannot be changed because tpuc()
expects a pointer to char, so the solution is to insert a
cast in the call to ISCONTROL.
Diffstat:
M st.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/st.c b/st.c
t@@ -2311,13 +2311,13 @@ techo(char *buf, int len) {
for(; len > 0; buf++, len--) {
char c = *buf;
- if(ISCONTROL(c)) { /* control code */
+ if(ISCONTROL((uchar) c)) { /* control code */
if(c & 0x80) {
c &= 0x7f;
tputc("^", 1);
tputc("[", 1);
} else if(c != '\n' && c != '\r' && c != '\t') {
- c ^= '\x40';
+ c ^= 0x40;
tputc("^", 1);
}
tputc(&c, 1);
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.