home *** CD-ROM | disk | FTP | other *** search
- /*
- * BORDER.C - Sets the colors of the border.
- *
- *
- * PROGRAMMER: Martti Ylikoski
- * CREATED: 21.2.1991
- * VERSION: 1.0
- *
- */
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #include <ctype.h> /* isdigit requires this */
- #include <param.h>
- #include <paramstd.h>
- #define INCL_DOS
- #define INCL_VIO
- #include <os2.h>
- #include "vioclr.h"
- static char *progname ;
-
- extern unsigned long pflags ;
-
- ParamEntry pentry[12] = {
- "P", &ParamSetPause, 0,
- "F", &ParamSetFold, 0,
- "V", &ParamSetVerbose, 0,
- "R", &ParamSetReport, 0,
- "S", &ParamSetSubDirs, 0,
- "?", &ParamSetHelp, 1,
- "H", &ParamSetHelp, 1,
- "NOD", &ParamSetNoDefault, 0,
- "TEST", &ParamSetTest, 0,
- "Y", &ParamSetYes, 0,
- "N", &ParamSetTest, 0,
- "\0", NULL, 0
- } ;
-
- ParamBlock params = {
- "/-", IGNORECASE | NOPRIORITY | NOTRIGGERSALLOWED ,
- pentry
- } ;
-
-
- int main(int argc, char *argv[])
- {
- int i, fint ;
- USHORT bint ;
- VIOOVERSCAN viooverscan ;
- USHORT ret ;
-
- progname = argv[0] ;
-
- ParamHandle(¶ms, &argc, argv) ;
-
- bint = 0 ;
-
- if (argc != 2 || pflags & PA_HELP)
- {
- printf("usage: %s border-color \n", progname) ;
- printf("Available colors:\n") ;
- printf(" DARK_BLUE LIGT_BLUE BLUE\n") ;
- printf(" DARK_RED LIGHT_BLUE RED\n") ;
- printf(" DARK_GREEN LIGHT_GREEN GREEN\n") ;
- printf(" DARK_YELLOW LIGHT_YELLOW YELLOW\n") ;
- printf(" DARK_MAGENTA LIGHT_MAGENTA MAGENTA\n") ;
- printf(" DARK_CYAN LIGHT_CYAN CYAN\n") ;
- printf(" BLACK WHITE DARK_GREY\n") ;
- printf(" LIGHT_GREY DEFAULT\n") ;
- printf(" OR an integer specifying the corresponding attribute\n" ) ;
- return( 0 ) ;
- }
-
- if ( isdigit( (int) argv[1][0]) != 0)
- bint = (USHORT) atoi(argv[1]) ;
- else
- {
- for (i = 0 ; i < (int) (sizeof(colors)/sizeof(TABLE_ENTRY)) ; i++)
- {
- if (strcmpi(colors[i].color, argv[1]) == 0)
- bint = colors[i].cint ;
- }
- }
-
- viooverscan.cb = sizeof(VIOOVERSCAN) ;
- viooverscan.type = 1 ;
- if (( ret = VioGetState(&viooverscan, 0)) != 0)
- {
- fputs("Error in VioGetState\nExiting...\n", stderr) ;
- return( 1 ) ;
- }
- /*
- if (bint == -1 )
- {
- fprintf(stderr,"%s: color was not valid\n", progname) ;
- fprintf(stderr,"Run command without arguments to see valid parameters\n") ;
- return( 1 ) ;
- }
- */
- viooverscan.color = bint ;
-
- if ((ret = VioSetState(&viooverscan, 0)) != 0)
- {
- fputs("Error in VioSetState\nExiting...\n", stderr) ;
- return( 1 ) ;
- }
- return( 0 ) ;
- }
-