swirl
Guide to OmniMark 7   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
      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'.


Declaration

  define external source function SYSOUTSystemCall
     value stream command
     input-from value stream command-input optional

Argument definitions

command
The command to be executed, containing any required parameters.
command-input
A stream which is to be written to command's standard input.


Purpose

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
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACYLIBRARIES ] [ ERRORS ]

OmniMark 7.1.2 Documentation Generated: June 28, 2005 at 5:45:48 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © Stilo Corporation, 1988-2005.