diff options
author | Chris Cleeland <chris.cleeland@gmail.com> | 1997-11-15 05:59:54 +0000 |
---|---|---|
committer | Chris Cleeland <chris.cleeland@gmail.com> | 1997-11-15 05:59:54 +0000 |
commit | cb16e590cc9c60c940de6d36adb919166b067fa4 (patch) | |
tree | 748f67695a335c1df28f1d3366254ae00e57f4c6 /ace/ACE.i | |
parent | aa82215c8e7bc939656b2ad19b2d7b59d1c94597 (diff) | |
download | ATCD-cb16e590cc9c60c940de6d36adb919166b067fa4.tar.gz |
* ace/ACE.cpp (ldfind): Changed uses of strsplit_r to be scoped
under ACE rather than ACE_OS.
Diffstat (limited to 'ace/ACE.i')
-rw-r--r-- | ace/ACE.i | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/ace/ACE.i b/ace/ACE.i index fea76a4c0ca..2b4a7ddfcb2 100644 --- a/ace/ACE.i +++ b/ace/ACE.i @@ -72,6 +72,42 @@ ACE::strecpy (char *s, const char *t) return dscan - 1; } +// Split a string up into 'token'-delimited pieces, ala Perl's "split". + +inline char * +ACE::strsplit_r (char *str, + const char *token, + char *&next_start) +{ + char *tok_loc; + char *ret = 0; + + if (str != 0) + next_start = str; + + if (next_start != 0) + { + tok_loc = strstr (next_start, token); + + if (tok_loc != 0) + { + // Return the beginning of the string. + ret = next_start; + + // Insure its terminated. + *tok_loc = '\0'; + next_start = tok_loc + strlen (token); + } + else + { + ret = next_start; + next_start = (char *)0; + } + } + + return ret; +} + // Return flags currently associated with handle. inline int |