=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/less/ttyin.c,v retrieving revision 1.1.1.2 retrieving revision 1.1.1.3 diff -c -r1.1.1.2 -r1.1.1.3 *** src/usr.bin/less/ttyin.c 2003/04/13 18:21:21 1.1.1.2 --- src/usr.bin/less/ttyin.c 2011/09/16 17:47:08 1.1.1.3 *************** *** 1,5 **** /* ! * Copyright (C) 1984-2002 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. --- 1,5 ---- /* ! * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. *************** *** 26,31 **** --- 26,32 ---- public int tty; extern int sigs; + extern int utf_mode; /* * Open keyboard for input. *************** *** 132,137 **** --- 133,170 ---- quit(QUIT_ERROR); } #endif + #if 0 /* allow entering arbitrary hex chars for testing */ + /* ctrl-A followed by two hex chars makes a byte */ + { + int hex_in = 0; + int hex_value = 0; + if (c == CONTROL('A')) + { + hex_in = 2; + result = 0; + continue; + } + if (hex_in > 0) + { + int v; + if (c >= '0' && c <= '9') + v = c - '0'; + else if (c >= 'a' && c <= 'f') + v = c - 'a' + 10; + else if (c >= 'A' && c <= 'F') + v = c - 'A' + 10; + else + hex_in = 0; + hex_value = (hex_value << 4) | v; + if (--hex_in > 0) + { + result = 0; + continue; + } + c = hex_value; + } + } + #endif /* * Various parts of the program cannot handle * an input character of '\0'. *************** *** 141,145 **** c = '\340'; } while (result != 1); ! return (c & 0377); } --- 174,178 ---- c = '\340'; } while (result != 1); ! return (c & 0xFF); }