Environment Reference

Environment Hierarchy

The C/Base and C/Books programs in version 3.8+ look to two locations for their operating environments. All programs running under MS-DOS or Mircosoft Windows will initially check for environment variables in a standard Windows .ini file named CSSMENU.INI under the section [env]. The CSSMENU.INI file is located in the default directory location C:\. If the program fails to locate the environment variable in the .ini file it will then check if the variable is set in the standard MS-DOS environment. If the variable is not set in either locations, NULL is returned.

The default directory location for the CSSMENU.INI file can be altered by setting the variable ENVHOME in the standard MS-DOS environment, i.e. C:> set ENVHOME=C:\MYDIR will cause Conetic programs to look for the CSSMENU.INI file in the directory C:\MYDIR and to then check the standard environment. The ENVHOME variable is the only exception for checking the MS-DOS environment first, all other variables will be searched for in the CSSMENU.INI file first and the MS-DOS environment second.

C Language Functions

When programming in the C language the Conetic function GetEnv ( ) should be used in place of the standard C function getenv ( ). The syntax for the Conetic function is:

GetEnv(variable name, .ini filename, environment section);

example:

char *GetEnv();

char *homename;

homename=GetEnv("HOME","cssmenu.ini"."env");

This example will check the CSSMENU.INI file for the variable HOME and if not found then will check the standard MS-DOS environment. If the standard C function getenv() is used the program will check only the MS-DOS environment and may not interact correctly with other Conetic Windows programs. The Conetic function GetEnv ( ) may be used with either MS-DOS or Windows programs.

The Conetic function SetEnv() should be used for Windows programs in place of the standard C function putenv (). The syntax for the Conetic function is:

SetEnv(variable string, .ini filename, section name, mode);

mode = 1 Add variable to .ini file.

mode = 2 Remove variable from .ini file

example:

SetEnv("MYVAR=NAME1","cssmenu.ini","env",1);

This will write the environment variable MYVAR with a value of NAME1 to the CSSMENU.INI in the section "env". This function can be used only in Windows programs.

Standard Conetic Environment Variables

Variable Name Function

CBASE The directory location for the C/Base catalog files i.e.CBASE=C:\CBASE\LIB\CBASE .

DBASE The name of the database being presently utilized, i.e. DBASE=DEMO .

DBHOME The home directory of database.

PATH The path to the directories which contain the Conetic binary programs.

ENVHOME The directory name that contains the CSSMENU.INI (Must be set in the MS-DOS environment).

CSSOUT The name and directory location of the output file for a Windows Conetic command. (See Special Considerations below).

CSSIN The name and directory location of the input file for a Windows Conetic command. (See Special Considerations below).

TMPDIR The location of an existing directory which will hold temporary files.

EDITOR The name of the editor that report editor will use

PREM The name of the remote server for a client-server process, usually set by RMENU.EXE.

CSWAP The directory location for the swap space, used by Conetic programs making system calls.

ONPRINTER A boolean flag to determine whether reports go to the printer or not, usually set by GRACE.EXE, i.e. ONPRINTER=yes.

NCOPIES The number of copies of a report to be printed usually set by GRACE.EXE, i.e. NCOPIES=1.

DOSPRINT A boolean flag used to determine whether to print through MS-DOS or Microsoft Windows.

TOFILE A boolean flag used to determine whether to send a report to the screen or to a file.

TERM The name of a terminal type used by Conetics programs running under MS-DOS, i.e. TERM=DOS, TERM=BLUE, etc..

RPATH The path to the directory which contains the Conetic resource files, overrides the CBASE variable, i.e. RPATH=C:\CBASE\LIB\CBASE\RESOURCE.

COUNTRY The variable which contains the name of a country, used to change Conetic language resource files, i.e. COUNTRY=ITALY.

PRINTER The name of a printer to send a report file.

Special Considerations

Under the Windows environment a command line (run from a menu, icon, or Program Manager) cannot contain any redirection symbols or pipes, i.e. > , < , | . Conetic Windows command such as PULL.EXE and PUT.EXE check the environment as described above for variables CSSIN and CSSOUT. The variable CSSIN denotes a pathname to a file which will be used as input to the executed command, i.e. CSSIN=C:\TMP\INPUT. The variable CSSOUT denotes a pathname to a file to which the output of the given command will be sent, i.e. CSSOUT=C:\TMP\RESULT.

The variable TMPDIR must be set when running under both Microsoft Windows and MS-DOS in order for GRACE.EXE to work correctly. The TMPDIR variable is set to an existing directory which will be used to hold the intermediate report files used by GRACE.EXE, i.e. TMPDIR=C:\TMP.