|
I have a program that will load the UDKs on a VT-2xx terminal:
(following the form-feed)
/*
* controls.c -- program vt220 special function keys
*/
#include stdio
#include ctype
#define TRUE -1
#define FALSE 0
main()
{
char line[80], prefix;
int good, key;
good = FALSE;
while(!good)
{
printf("Enter key to program (Fxx): ");
gets(line);
if(strlen(line) == 0 || strcmp(line, "exit") == 0 ||
strcmp(line,"EXIT") == 0)
{
good = TRUE;
continue;
}
if(strcmp(line,"clear") == 0 || strcmp(line,"CLEAR") == 0)
{
clearkeys();
continue;
}
if(strcmp(line,"lock") == 0 || strcmp(line,"LOCK") == 0)
{
lockkeys();
continue;
}
key = keyeval(line);
printf("Enter value to program into that key: ");
gets(line);
cook(line);
tohex(line);
program_key(key, line);
}
}
clearkeys()
{
printf("\033P0;1|\033\\");
}
program_key(key, string)
int key;
char *string;
{
printf("\033P1;1|%d/%s\033\\", key, string);
}
lockkeys()
{
printf("\033P1;0|\033\\");
}
int keyeval(string)
char *string;
{
int num, retval;
num = atoi(string);
retval = num + 11 + ((num>10) ? 1 : 0) + ((num>14) ? 1 : 0);
return(retval);
}
tohex(string)
char *string;
{
char retn[80];
int i;
strcpy(retn, string);
for(i=0; i<strlen(retn); i++)
sprintf(string+i*2, "%02x", (unsigned char)retn[i]);
string[i*2+1] = 0;
}
cook(string)
char *string;
{
char save[80], obuf[4];
int i, j, k;
strcpy(save, string);
j = 0;
for(i=0; i<strlen(save); i++)
{
if(save[i] != '\\')
{
string[j++] = save[i];
continue;
}
++i;
switch(save[i])
{
case 'r':
case 'R':
string[j++] = '\r';
break;
case 'e':
case 'E':
string[j++] = '\033';
break;
case 'n':
case 'N':
string[j++] = '\n';
break;
case 't':
case 'T':
string[j++] = '\t';
break;
case 'v':
case 'V':
string[j++] = '\v';
break;
case 'f':
case 'F':
string[j++] = '\f';
break;
case '\\':
string[j++] = '\\';
break;
case '\'':
string[j++] = '\'';
break;
default:
if(!isdigit(save[i]))
break;
k = 0;
while(k != 3 && isdigit(save[i]))
obuf[k++] = save[i++];
--i;
obuf[k] = 0;
string[j++] = (unsigned char)atoi(obuf);
}
}
string[j] = 0;
}
|
| re < Note 620.2 by KBOV06::KRATZ "Ulrich Kratz - Technical IS , KBO" >
-< again >-
> ...Now is there a way to define just one key for
> the <Ctrl>~ and <Ctrl> w, without having to change my TDMS code.
Go into terminal SETUP/KEYBOARD/ANSWERBACK (assuming that you use a
VT200 series terminal) and set the answerback message to <CTRL>~ <CTRL>W
(and save that). Now when you want to change the session, just type
<CTRL><F5>. That sends the answerback message to the host and does what
you want.
Regards,
-Peter
|