home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / prof_c / 13ansi / sc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-08-11  |  928 b   |  43 lines

  1. /*
  2.  *    SetColor (sc) -- set foreground, background, and border
  3.  *    attributes on systems equipped with color display systems
  4.  *
  5.  *    Usage:    sc [foreground [background [border]]]
  6.  *        sc [attribute]
  7.  */
  8.  
  9. #include <stdio.h>
  10. #include <dos.h>
  11. #include <local\std.h>
  12. #include <local\ansi.h>
  13. #include <local\ibmcolor.h>
  14.  
  15. main(argc, argv)
  16. int argc;
  17. char **argv;
  18. {
  19.     extern void ansi_tst();
  20.     extern BOOLEAN iscolor();
  21.     extern void setattr(POSITION, int);
  22.     extern void menumode();
  23.     extern parse(int, char **);
  24.  
  25.     ansi_tst();
  26.     if (iscolor() == FALSE) {
  27.         fprintf(stderr, "\n\nSystem not in a color text mode.\n");
  28.         fprintf(stderr, "Use the MODE command to set the mode.\n");
  29.         exit(2);
  30.     }
  31.  
  32.     /* process either batch or interactive commands */
  33.     if (argc > 1)
  34.         /* batch mode processing */
  35.         parse(argc, argv);
  36.     else
  37.         /* no command-line args -- interactive mode */
  38.         menumode();
  39.  
  40.     ANSI_ED;
  41.     exit (0);
  42. }
  43.