Open System Services Library Calls Reference Manual (G06.27+, H06.04+)

step(3) OSS Library Calls Reference Manual
NAME
step - Compile and match regular expressions
LIBRARY
None. This application program interface is implemented as a macro. |
SYNOPSIS
#include <regexp.h>
int step (
const char *string,
const char *expbuf);
extern char *loc1, *loc2, *locs;
PARAMETERS
string Points to a null-terminated string of characters to be searched for a match.
expbuf Points to a character array where the compiled regular expression is stored.
DESCRIPTION
The compile(), advance(), and step() macros are used for general-purpose expression matching. |
The step() macro nds the rst substring of the string parameter that matches the compiled |
expression pointed to by the expbuf parameter. When there is no match, the step() macro returns |
a value of 0 (zero). When there is a match, the step() macro returns a nonzero value and sets two |
global character pointers:
loc1 which points to the rst character of the substring that matches the pattern
loc2 which points to the character immediately following the substring that matches
the pattern.
When the regular expression matches the entire expression, loc1 points to the rst character of
the string parameter and loc2 points to the null character at the end of the expression specied by
the string parameter.
The step() macro uses the integer variable circf, which is set by the compile() macro when the |
regular expression begins with a ˆ (circumex) character. When this variable is set, the step() |
macro only tries to match the regular expression to the beginning of the string. When you com-
pile more than one regular expression before executing the rst one, save the value of circf for
each compiled expression and set circf to the saved value before each call to step().
Using the same parameters that were passed to it, the step() macro calls the advance() macro. |
The step() macro increments a pointer through the string parameter characters and calls
advance() until a nonzero value, which indicates a match, is returned, or until the end of the
expression pointed to by the string parameter is reached. To unconditionally constrain string to
point to the beginning of the expression, call the advance( ) macro directly instead of calling |
step().
NOTES
The step() macro can be called by native processes only. |
The functionality provided by advance(), compile(), and step() is dened to be obsolete by |
POSIX. Functions such as regcomp() and regexec() should be used instead.
676 Hewlett-Packard Company 527187-004