**
** You should have received a copy of the GNU General Public License
** along with TACK; see the file COPYING. If not, write to
-** the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-** Boston, MA 02111-1307, USA.
+** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+** Boston, MA 02110-1301, USA
*/
#include <tack.h>
-MODULE_ID("$Id: ansi.c,v 1.5 2000/04/22 21:06:57 tom Exp $")
+MODULE_ID("$Id: ansi.c,v 1.10 2005/09/17 19:49:16 tom Exp $")
/*
* Standalone tests for ANSI terminals. Three entry points:
int ch, i, j, last_escape;
fflush(stdout);
- read_key(ansi_buf, sizeof(ansi_buf));
+ read_key((char *)ansi_buf, sizeof(ansi_buf));
/* Throw away control characters inside CSI sequences.
Convert two character 7-bit sequences into 8-bit sequences. */
for (i = j = last_escape = 0; (ch = ansi_buf[i]) != 0; i++) {
static int
valid_mode(int expected)
{
- char *s;
+ unsigned char *s;
int ch, terminator;
read_ansi();
ape = 0;
- ch = pack_buf[0] & 0xff;
+ ch = UChar(pack_buf[0]);
ansi_value[0] = 0;
if (ch != A_CSI && ch != A_DCS)
return FALSE;
{
int i, j, k, tc, vcr, lc;
char *s;
+ const char *t;
lc = 5;
terminal_class = tc = 0;
vcr = TRUE;
break;
}
- j = pack_buf[0] & 0xff;
+ j = UChar(pack_buf[0]);
if (j != A_CSI && j != A_DCS) {
put_crlf();
- s = "*** The above request gives illegal response ***";
- ptext(s);
- for (j = strlen(s); j < 49; j++)
+ t = "*** The above request gives illegal response ***";
+ ptext(t);
+ for (j = strlen(t); j < 49; j++)
putchp(' ');
}
- s = expand(ansi_buf);
+ s = expand((const char *)ansi_buf);
if (char_count + expand_chars >= columns) {
put_str("\r\n ");
lc++;
putchp(' ');
for (j = 0; ansi_buf[j]; j++) {
if (ansi_buf[j] == 'r') {
- for (k = j++; (ch = (ansi_buf[k] & 0xff)); k++)
+ for (k = j++; (ch = UChar(ansi_buf[k])) != 0; k++)
if (ch == A_ESC) {
break;
} else if (ch == A_ST) {
break;
}
ansi_buf[k] = '\0';
- s = expand(&ansi_buf[j]);
+ s = expand((const char *)&ansi_buf[j]);
if (char_count + expand_chars >= columns)
put_str("\r\n ");
put_str(s);
tc_putp(temp);
if (!valid_mode(('$' << 8) | 'y')) {
/* not valid, save terminating value */
- s = expand(ansi_buf);
+ s = expand((const char *)ansi_buf);
sprintf(tms, "%s%s%d %s ", tms,
puc[i], j, s);
break;