Category : OS/2 Files
Archive   : EMXTST8F.ZIP
Filename : HW_IO.C

 
Output of file : HW_IO.C contained in archive : EMXTST8F.ZIP
/* hw_io.c (emx+gcc) */

#include
#include
#include
#include


static void usage (void)
{
fputs ("Usage: hw_io [-s] [-p ] [-a ]\n", stderr);
exit (1);
}


int main (int argc, char *argv[])
{
int opt_s, i, lo, hi, port, def_range;
unsigned char buf[256];
char *q;

opt_s = 0; port = 0x40; def_range = 1;
i = 1;
while (i < argc)
{
if (strcmp (argv[i], "-s") == 0)
{
opt_s = 1; ++i;
}
else if (strcmp (argv[i], "-p") == 0 && argc - i >= 2)
{
errno = 0;
port = strtol (argv[i+1], &q, 0);
if (errno != 0 || *q != 0 || port < 0 || port > 255)
usage ();
i += 2;
}
else if (strcmp (argv[i], "-a") == 0 && argc - i >= 3)
{
errno = 0;
lo = strtol (argv[i+1], &q, 0);
if (errno != 0 || *q != 0)
usage ();
hi = strtol (argv[i+2], &q, 0);
if (errno != 0 || *q != 0)
usage ();
def_range = 0;
i += 3;
}
else
usage ();
}
if (def_range)
{
lo = port; hi = port;
}
if (_portaccess (lo, hi) != 0)
{
perror ("_portaccess");
return (1);
}
if (opt_s)
for (;;)
{
_inps8 (port, buf, sizeof (buf));
for (i = 0; i < sizeof (buf); ++i)
printf (" %.2x", buf[i]);
}
else
for (;;)
printf (" %.2x", _inp8 (port));
return (0);
}


  3 Responses to “Category : OS/2 Files
Archive   : EMXTST8F.ZIP
Filename : HW_IO.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/