home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / prgramer / unix / emx / test / video.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-25  |  1.0 KB  |  54 lines

  1. /* video.c (emx+gcc) */
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6. #include <sys/video.h>
  7.  
  8. extern char *_v_mem;            /* Used for testing */
  9.  
  10. static void prt (const char *s)
  11. {
  12.   while (*s != 0)
  13.     {
  14.       v_putc (*s);
  15.       ++s;
  16.     }
  17. }
  18.  
  19.  
  20. int main (int argc, char *argv[])
  21. {
  22.   int width, height;
  23.   int x, y;
  24.   int start, end;
  25.   int no_mem_flag;
  26.  
  27.   no_mem_flag = 0;
  28.   if (argc == 2 && strcmp (argv[1], "-n") == 0)
  29.     no_mem_flag = 1;
  30.  
  31.   if (!v_init ())
  32.     {
  33.       fprintf (stderr, "v_init() failed.\n");
  34.       return (1);
  35.     }
  36.  
  37.   if (no_mem_flag)
  38.     _v_mem = NULL;
  39.  
  40.   v_dimen (&width, &height);
  41.   v_getxy (&x, &y);
  42.   v_getctype (&start, &end);
  43.   printf ("<- (%d,%d)\n", x, y);
  44.   printf ("Width=%d, height=%d\n", width, height);
  45.   printf ("Cursor: start=%d, end=%d\n", start, end);
  46.   v_gotoxy (10, 5);
  47.   printf ("<- (10,5)\n");
  48.   v_ctype (0, end);
  49.   v_gotoxy (0, height-2);
  50.   prt ("Hello 1\nHello 2\nHello 3");
  51.   v_printf (" -- hello, this is printf");
  52.   return (0);
  53. }
  54.