EXEC

Execute a non–Synergy program

 

 

USupported on UNIX
VSupported on OpenVMS
xcall EXEC(program[, argument, …])

Arguments

program

An expression that contains the name of the program to execute. (a)

argument

(optional) One or more variables or literals that contain any arguments the program requires. A maximum of 31 arguments is allowed. (a or n)

Discussion

The EXEC subroutine terminates the calling Synergy program and executes a non–Synergy program using the execvp function call. On OpenVMS, you must set the logical VAXC$PATH to a search list where the program image will be found.

The EXEC subroutine performs the same cleanup as the STOP command. In effect, EXEC acts as a chain to a non–Synergy program, including shell scripts. You cannot return from a successful EXEC.

Important

Do not use this routine in an ELB that is being used with xfServerPlus.

The EXEC routine is also supported on Mono platforms.

Examples

The example below executes the program /usr/games/rogue with ‑s as an argument. Note that the WRITES statement is only executed if the EXEC subroutine fails.

.define TTCHN           ,1
record
    program             ,a*,    "/usr/games/rogue"
    arg1                ,a*,    "-s"
proc
    open(TTCHN, o, "tt:")
    onerror nope
    xcall exec(program, arg1)
nope,
    writes(TTCHN, "Cannot execute: " + program)
    stop
end