/* os2test.c (emx+gcc) */

#include <stdio.h>
#include <string.h>
#define INCL_DOS
#include <os2.h>

char upper_case[] = "upper case";

int main (void)
{
  COUNTRYCODE cc;
  ULONG aul[100];
  ULONG cb, i, rc;
  CHAR ach[256];

  cc.country = 0;
  cc.codepage = 0;
  if ((rc = DosMapCase (strlen (upper_case), &cc, upper_case)) != 0)
    printf ("DosMapCase failed: %lu\n", rc);
  else
    printf ("DosMapCase: %s\n", upper_case);
  if ((rc = DosQueryCp (sizeof (aul), aul, &cb)) != 0)
    printf ("DosQueryCp failed: %lu\n", rc);
  else
    {
      printf ("Code pages:");
      for (i = 0; i < cb / sizeof (aul[0]); ++i)
        printf (" %lu", aul[i]);
      putchar ('\n');
    }
  if ((rc = DosQueryCollate (sizeof (ach), &cc, ach, &cb)) != 0)
    printf ("DosQueryCollate failed: %lu\n", rc);
  else
    {
      printf ("DosQueryCollate:");
      for (i = 0; i < cb / sizeof (ach[0]); ++i)
        printf (" %d", (int)(UCHAR)ach[i]);
      putchar ('\n');
    }
  return 0;
}
