diff options
author | Christopher Faylor <me@cgf.cx> | 2003-01-27 00:16:01 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2003-01-27 00:16:01 +0000 |
commit | fea48988ea866e6ef4f29247a13a8b28eb9be7ce (patch) | |
tree | 40e1433368cfe58c000284730c207907c298c633 /winsup/cygwin/string.h | |
parent | 285d6b97b11d0516ba82b0deb59afe746ef8fb93 (diff) | |
download | cygnal-fea48988ea866e6ef4f29247a13a8b28eb9be7ce.tar.gz cygnal-fea48988ea866e6ef4f29247a13a8b28eb9be7ce.tar.bz2 cygnal-fea48988ea866e6ef4f29247a13a8b28eb9be7ce.zip |
* strings.h (strechr): New function.
* uinfo.cc (pwdgrp::next_str): Search only for input char in string. Return
EOS on failure. Don't check for NULL since it shouldn't be possible.
(pwdgrp::add_line): Revert to replacing '\n' in input line with '\0'.
(pwdgrp::next_num): Pass explicit separator character to next_str.
* grp.cc (pwdgrp::parse_group): Ditto.
* passwd.cc (pwdgrp::parse_passwd): Ditto. Revamp test for garbage input.
* pwdgrp.h (pwdgrp::next_str): Don't use default parameter.
Diffstat (limited to 'winsup/cygwin/string.h')
-rw-r--r-- | winsup/cygwin/string.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/winsup/cygwin/string.h b/winsup/cygwin/string.h index 6e410249b..0ac9745ad 100644 --- a/winsup/cygwin/string.h +++ b/winsup/cygwin/string.h @@ -38,6 +38,27 @@ strchr (const char *s, int c) return res; } +#undef strechr +#define strechr cygwin_strechr +static inline __stdcall char * +strechr (const char *s, int c) +{ + register char * res; + __asm__ __volatile__ ("\ + movb %%al,%%ah\n\ +1: movb (%1),%%al\n\ + cmpb %%ah,%%al\n\ + je 2f\n\ + incl %1\n\ + testb %%al,%%al\n\ + jne 1b\n\ + decl %1\n\ +2: movl %1,%0\n\ + ":"=a" (res), "=r" (s) + :"0" (c), "1" (s)); + return res; +} + extern const char isalpha_array[]; #undef strcasematch |