home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h> /* display/set command line switch char */
- #include <dos.h> /* compliments of Anthony LiCausi c/o */
- /* Allen Holub (DDJ). */
-
- /*****************************************
- * if c == 0, return current switch char, *
- * else change the switch char to c and *
- * return the old switch character. *
- * Note mild recursion.
- *****************************************/
- int switchar(c)
- int c;
- {
- union REGS regs;
- int rval = 0;
-
- if (c)
- rval = switchar(0);
- regs.x.dx = c;
- regs.x.ax = c ? 0x3701 : 0x3700;
- int86(0x21, ®s, ®s);
- return(rval ? rval : regs.h.dl);
- }
-
- void pscscs(char *s1, char c1, char *s2, char c2, char *s3)
- {
- write(1, s1, strlen(s1));
- write(1, &c1, 1);
- write(1, s2, strlen(s2));
- write(1, &c2, 1);
- write(1, s3, strlen(s3));
- }
-
- void pscs(char *s1, char c1, char *s2)
- {
- write(1, s1, strlen(s1));
- write(1, &c1, 1);
- write(1, s2, strlen(s2));
- }
-
- /*****************************************
- * main *
- *****************************************/
- main( argc, argv )
- int argc;
- char **argv;
- {
- argv++;
- if ( argc > 1 )
- pscscs( "Changing switch character from <", switchar( **argv ),
- "> to <", **argv, ">\n");
- else
- pscs( " Switch character is <", switchar( 0 ), ">\n");
- exit(0);
- }
-
-