System Dependent Functions

These functions are listed separately as they all have some dependency on the operating system Open GENIE is running. By careful use of the Os() command, procedures can be written to work system independently.

Cd Change the default directory from within Open GENIE
Dir List the files in the current directory or the directory specified
Pwd Print the current working directory
Os Returns a string giving the operating system Open GENIE is running on
System Executes a single command or command session from within Open GENIE

Command Reference

Cd()

Change the default directory from within Open GENIE

CD [path=String] Change the working directory

example:

	# Change to the examples directory
	>> cd "/usr/local/genie/examples"
	>> dir

Cd

Select the directory which Open GENIE will read and write files to by default. This command avoids the need to exit Open GENIE to change directory.

Parameters:

Path (String)

Directory path as specified on the native operating system, eg VMS or Unix.

Dir()

List the files in the current directory or the directory specified

DIR [path=String] List the directory contents

example:

	# List the examples directory
	>> dir "[.examples]"

Dir

Display the contents of a directory on the host operating system.

Parameters:

Path (String)

Directory path as specified on the native operating system, eg VMS or Unix.

Pwd()

Print the current working directory

PWD   Show the working directory

example:

	# Change to the examples directory
	>> cd "/usr/local/genie/examples"
	>> pwd
	/usr/local/genie/examples

Pwd

Print the current working directory if called as a keyword command or return the directory as a string if called as a function.

Parameters:

RESULT (String)

String giving the current working directory.

Os()

Returns a string giving the operating system Open GENIE is running on

OS()   Returns the name of the operating system

example:

	# Print the current operating system
	>> printn Os()
	OSF

Os

When writing portable GCL programs is is sometimes necessary to know which operating system is being used. For example if VMS is being used, a disk name must be specified whereas none is needed on Unix. This command is provided to allow a procedure to check for differences which might occur and need to be handled.

Parameters:

RESULT = (String)

Currrently returns one of the strings "OSF", "VMS", "IRIX" or "LINUX" depending on the supported operating systems.

System()

Executes a single command or command session from within Open GENIE.

SYSTEM [command=String] Execute system commands from within Open GENIE

example:

	# find some user details on VMS
	>> system "$ SEARCH journal.txt \"flux\" "
	IRS14142ZAB/NJR Flux tests  18-FEB-1997 12:00:01 163.2
	IRS14143ZAB/NJR Flux tests  18-FEB-1997 13:43:40   6.1
	>>

Note: The Dir() command in Open GENIE is simply a procedure written using the System() command.

System

The System() command allows a user to execute native operating system commands from within Open GENIE. This can be very useful for accessing facilities not actually built into Open GENIE. To make a procedure Operating system independent, use the Os() command to choose which system command to use, see the example below.

PROCEDURE TIME
IF Os() = "VMS"
    system "show time"
ELSE   # assume Unix
    system "date"
ENDIF
ENDPROCEDURE

If no command is given as a parameter, the System() command starts a sub-shell process which must be terminated with an "exit" on Unix or a "LOGOUT" on VMS. This is a handy form of the command if you just want to type a few commands without closing down your Open GENIE session. Note that on VMS some normal logical name definitions may be missing in the sub process.

Parameters:

Command (String)

The command to be executed by the operating system.

RESULT = (Integer)

The execution status returned by the command.