|
|||||
|
||||||
Other Library Functions |
function |
SYSOUTSystemCall |
Library: General, System call (OMSYSOUT)
Include: omsysout.xin |
Return type: Source Returns: A source containing the standard output and standard error from 'Command'. |
define external source function SYSOUTSystemCall value stream command input-from value stream command-input optional
Argument definitions
This function is used to execute the external program specified in 'Command'.
If 'CommandInput' is specified, then that is streamed to Command's standard input.
This function returns a source containing the standard output and standard error from 'Command', which can then be used by repeat scan, do scan, set, submit and similar OmniMark keywords.
Example:
The following OmniMark program executes an external program called 'hello'. Two lines of input are streamed to its standard input, containing '2' and 'OmniMark'. The output from 'hello' is then scanned and echoed to the screen.
include "omsysout.xin" global stream command initial {'hello'} global stream cmd-args initial {'2%nOmniMark%n'} process repeat scan SYSOUTSystemCall command input-from cmd-args match value-start | line-end output '<%n' match any-text*=>line output '<<!%g(line)>%n' match any again
This program will copy the output from the external program named "hello", and surround each line of output with angle brackets.
The following example can be used on a UNIX system to execute the command "ls" and output the filenames and dates that it finds:
include "omsysout.xin" global stream command initial {'ls -lF'} process repeat scan SYSOUTSystemCall command match any-text{10} white-space+ digit+ white-space+ any++ white-space+ any++ white-space+ digit+ white-space any-text{12}=>filedate white-space any-text+=>filename '%n' output 'date: %g(filedate) name: %g(filename)%n' match any-text* '%n' again
Other Library Functions SYSOUTIsVersionCompatible SYSOUTLibraryVersion SYSOUTSystemCall |