home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / s / snip1292.zip / BORDCOLR.C < prev    next >
C/C++ Source or Header  |  1991-07-22  |  3KB  |  108 lines

  1. /*
  2. **  BORDCOLR.C - set the border color
  3. **  by: Bob Jarvis
  4. */
  5.  
  6. #include <stdio.h>
  7. #include <dos.h>
  8.  
  9. char *usage = "BORDCOLR - sets the border color\n"
  10.               "Parameter: color to set - one of\n"
  11.               "\tBLK - black\n"
  12.               "\tBLU - blue\n"
  13.               "\tGRN - green\n"
  14.               "\tCYN - cyan\n"
  15.               "\tRED - red\n"
  16.               "\tMAG - magenta\n"
  17.               "\tBRN - brown\n"
  18.               "\tLTG - light gray\n"
  19.               "\tDKG - dark gray\n"
  20.               "\tLTB - light blue\n"
  21.               "\tLGN - light green\n"
  22.               "\tLTC - light cyan\n"
  23.               "\tLTR - light red\n"
  24.               "\tLTM - light magenta\n"
  25.               "\tYEL - yellow\n"
  26.               "\tWHT - white";
  27.  
  28. #define BLACK     0
  29. #define BLUE      1
  30. #define GREEN     2
  31. #define CYAN      3
  32. #define RED       4
  33. #define MAGENTA   5
  34. #define BROWN     6
  35. #define LTGRAY    7
  36. #define DKGRAY    8
  37. #define LTBLUE    9
  38. #define LTGREEN   10
  39. #define LTCYAN    11
  40. #define LTRED     12
  41. #define LTMAGENTA 13
  42. #define YELLOW    14
  43. #define WHITE     15
  44.  
  45. void set_border_color(int color)
  46. {
  47.       union REGS regs;
  48.  
  49.       printf("color = %d\n", color);
  50.  
  51.       regs.h.ah = 0x0B;
  52.       regs.h.bh = 0;
  53.       regs.h.bl = color;
  54.  
  55.       int86(0x10, ®s, ®s);
  56. }
  57.  
  58. main(int argc, char *argv[])
  59. {
  60.       int color; 
  61.  
  62.       if(argc < 2)
  63.       {
  64.             printf(usage);
  65.             exit(0);
  66.       }
  67.  
  68.       if(strcmpl(argv[1], "BLK") == 0)
  69.             color = BLACK;
  70.       else  if(strcmpl(argv[1], "BLU") == 0)
  71.             color = BLUE;
  72.       else  if(strcmpl(argv[1], "GRN") == 0)
  73.             color = GREEN;
  74.       else  if(strcmpl(argv[1], "CYN") == 0)
  75.             color = CYAN;
  76.       else  if(strcmpl(argv[1], "RED") == 0)
  77.             color = RED;
  78.       else  if(strcmpl(argv[1], "MAG") == 0)
  79.             color = MAGENTA;
  80.       else  if(strcmpl(argv[1], "BRN") == 0)
  81.             color = BROWN;
  82.       else  if(strcmpl(argv[1], "LTG") == 0)
  83.             color = LTGRAY;
  84.       else  if(strcmpl(argv[1], "DKG") == 0)
  85.             color = DKGRAY;
  86.       else  if(strcmpl(argv[1], "LTB") == 0)
  87.             color = LTBLUE;
  88.       else  if(strcmpl(argv[1], "LGN") == 0)
  89.             color = LTGREEN;
  90.       else  if(strcmpl(argv[1], "LTC") == 0)
  91.             color = LTCYAN;
  92.       else  if(strcmpl(argv[1], "LTR") == 0)
  93.             color = LTRED;
  94.       else  if(strcmpl(argv[1], "LTM") == 0)
  95.             color = LTMAGENTA;
  96.       else  if(strcmpl(argv[1], "YEL") == 0)
  97.             color = YELLOW;
  98.       else  if(strcmpl(argv[1], "WHT") == 0)
  99.             color = WHITE;
  100.       else
  101.       {
  102.             printf(usage);
  103.             exit(0);
  104.       }
  105.  
  106.       set_border_color(color);
  107. }
  108.