SYSTEM |
System makes possible the execution of system commands by recovering where possible the standard exit in an Adonix variable.
System [ variable '=' ] [ ! | !! ] [ [ server ] @ ] expr_c
|
Element |
Description |
Restrictions |
|
variable |
variable_name. |
None. |
|
server |
Alphanumeric expression where the result is the name of a server |
None |
|
expr_c |
Alphanumeric expression where the result is a system command. |
None. |
# Copy FILE1 -> FIILE2 with redirection of the exit error
# (under Unix)
System "cp "+FILE1+" "+FILE2-"2>/dev/null"
# Direcorty list on the server where the first is found
# reference application (under DOS).
Char FILES(100)(50)
Char DIRECTORY(100)
DIRECTORY = "D:\adonix\tmp"
System FILES = adxmac(1)+"@DIR/b/o:n"+DIRECTORY
Infbox num$(stat1)-"Read lines"
# Open a Word document from an Adonix process
Char FILES(100)(50)
System FILES = '#@"C:\Program Files\Microsoft Office\Office\WINWORD.EXE"
"E:\tmp\document.doc"'
"System expr_c" executes the system command given in the expression. It is possible to specify the machine on which it must be executed.
If the two characters "!!" are used before the system command, the following operations are carried out :
1. backup of the screen,
2. re-parameterisation of the Adonix exit terminal,
3. return of the Adonix exit sequence,
4. execution of the system command,
5. return the start-up sequence,
6. re-parameterisation of the Adonix exit terminal,
7. restore the screen.
If there is only one "!" before the system command, the operations 1 and 7 will be deleted.
It is not necessary to re-parameterise the line, nothing will be placed before the system command.
"System variable = expr_c" launches a system command and recovers the standard exit of the command in the corresponding variable. If there are several lines and the corresponding variable is a grid of character strings, all the corresponding lines in the grid will be found if this has been sufficiently sized.
The Adonix system variable stat1 returns the number of lines read (syntax with assignment). In the case of a Unix client executing a command in local mode (i.e. @expr_c), stat1 will contain the exit number (that corresponds often to an error number) for the command.
A system call made to an interactive programme (for example a text processing) MUST be made using one of the options "!" or "!!" for the System command. If this precaution is neglected, problems linked to the parameterisation of the line or a bad set of characters can appear on returning to Adonix.
It is necessary to launch system commands compatible with the operating system of the selected machine by respecting the syntax belonging to these environments.
It is OK to write the error exit in order to not pollute the screen, or to recover the message returned by the system.
Warning : if it is necessary to change the directory to execute the system command, it will be necessary to do it in the same system instruction. By default, the system command is launched in the directory from which the Adonix session was launched. The dir$ function returns the path for this directory.
The system command is launched by a command interpreter depending on the operating system and its parameterisation.
When the system command is executed in interactive mode on a local machine (therefore if it starts with the characters '!!@'), the variable [S]stat1 contains the Unix error number for the system command executed if this has failed.
|
Error |
Description |
|
ERMODE (10) |
expr_c or variable are not of the type string. |
STAT1 - ADXMAC - DIR$ - GETENV$ - FILPATH - FILINFO
|
|