update dev300-m58
[ooovba.git] / dmake / msdos / switchar.c
blob9638ec2290ac533b8386729aeac78284bcdfe030
1 /* RCS $Id: switchar.c,v 1.1.1.1 2000-09-22 15:33:27 hr Exp $
2 --
3 -- SYNOPSIS
4 -- switch char query.
5 --
6 -- DESCRIPTION
7 -- Get the current value of the command line switch char. Only useful
8 -- in a DOS environment, otherwise we #define it to be '-'.
9 --
10 -- AUTHOR
11 -- Dennis Vadura, dvadura@dmake.wticorp.com
13 -- WWW
14 -- http://dmake.wticorp.com/
16 -- COPYRIGHT
17 -- Copyright (c) 1996,1997 by WTI Corp. All rights reserved.
18 --
19 -- This program is NOT free software; you can redistribute it and/or
20 -- modify it under the terms of the Software License Agreement Provided
21 -- in the file <distribution-root>/readme/license.txt.
23 -- LOG
24 -- Use cvs log to obtain detailed change logs.
26 #if defined(_MSC_VER)
27 #include <stdlib.h>
28 #endif
29 #include <dos.h>
30 #include <stdio.h>
31 #include "stdmacs.h"
33 getswitchar()/*
34 ===============
35 Try the environment first. If you don't find SWITCHAR there, then use
36 the DOS call. The call is undocumented, and doesn't work for DOS versions
37 4.0 and up, so the check of the environment will fix that. */
39 #if defined(__MSDOS__) || defined(M_I86)
40 union REGS rg;
41 static char *_env_switchar = NIL(char);
43 if( _env_switchar != NIL(char) ||
44 (_env_switchar = (char *)getenv("SWITCHAR")) != NIL(char) )
45 return(*_env_switchar);
47 rg.h.ah = 0x37; /* switch char request */
48 rg.h.al = 0; /* get (not set) */
50 intdos(&rg, &rg);
51 return (rg.h.dl);
52 #endif /* M_I86 */
54 return ('-');