Next: str_interp, Previous: str_dtoksplit, Up: Strings
scan a string for $VAR or ${VAR}
#include <suplib/str.h>int str_varscan( const char *string, void (*callback)(const char *,const char *,const char *,const char *,void *), void *udata, const char **errptr );
const char *string
- the string to process
void (*callback)(const char *,const char *,const char *,const char *,void *)
- callback
void *udata
- extra data to pass to the callback routine
const char **errptr
- place to store a pointer to a bad spot in the string
str_varscan
scans a strings for substrings of the form
${VAR}
or $VAR
. VAR
's first
character must be in the set [a-zA-Z_]
, with the remaining
characters being in the set [a-zA-Z0-9_]
.
When such a string is found, the passed callback function is called
with the addresses of the first and last characters of the entire
substring, as well as the first and last characters in VAR
.
Upon success, it returns 0
;
Upon error, *errptr is set to point the the character that evoked
the error, and one of the following is returned:
EDOM
Diab Jerius