home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari FTP
/
ATARI_FTP_0693.zip
/
ATARI_FTP_0693
/
Mint
/
Telecomm
/
st52.zoo
/
st52.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-01-28
|
2KB
|
116 lines
/* Alpha release version */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <osbind.h>
#include <mintbind.h>
#include <signal.h>
#include "st52.h"
#define AUX 1
#define CON 2
#define MINTID "MiNT"
#define MAXWAIT 1000
int
main(int argc, char *argv[], char *envp[])
{
long mintcookie = 0L;
int outtran[256];
int x;
long key;
register int gnsrgh = MAXWAIT;
#ifdef JUNK
char *terminal;
char *etmp;
char *newenv;
etmp = (char *) envp;
terminal = getenv("TERM");
#ifdef DEBUG
Cconws("Terminal type: ");
puts(terminal);
#endif
if (strcmp(terminal, "mgr") == 0)
{
#ifdef DEBUG
puts("yep");
printf("value: %d\n",
#else
(void)
#endif
Pexec(200, "e:\\mint\\mgr\\bin\\vt52.prg",
"e:\\mint\\mgr\\bin\\vt52.prg st52", envp)
#ifdef DEBUG
)
#endif
;
}
#endif /* JUNK */
for (x = 0; x < 256; x++)
outtran[x] = x;
outtran[127] = 8;
outtran[8] = 127;
mintcookie = getcookie(MINTID);
#ifdef DEBUG
printf("MiNT cookie %lx detected\n", mintcookie);
#endif
for (;;)
{
if (Bconstat(AUX) && gnsrgh--)
{
Bconout(CON, (int) Bconin(AUX));
}
else
{
gnsrgh = MAXWAIT;
if (Bconstat(CON))
{
key = Bconin(CON);
#ifdef DEBUG
printf("-%lx-\n", key);
#endif
switch (key)
{
case 0x000000E3: /* alt-c */
case 0x002E0000: config();
break;
case 0x000000F1: /* alt-q */
case 0x00100000: Cconws("\n");
exit(0);
case 0x000000FA: /* alt-z */
case 0x002C0000: if (mintcookie)
{
Cconws("\n");
(void) Pkill(Pgetpid(), SIGTSTP);
}
break;
default: Bconout(AUX, outtran[(int) (key & KEYMASK)]);
}
}
else
{
if (mintcookie)
(void) Syield();
}
}
}
}