David Richards wrote:
>
> Hi,
>
> First thing, the line:
>
> passwd = strtok(NULL,":\n");
>
> Should become:
>
> passwd = strtok(NULL,":");
>
> Because unix passwd files are in the form:
>
> user:passwd:etc.....
>
> So, the next match for ":\n" does not exist. Also, I believe that passwd
If I know strtok correctly, the second string contains _any_ delimiter
used, so the next token may end by any combination of ':' and '\n' ...
here's what a SVR4-system says:
strtok() considers the string s1 to consist of a sequence of zero
or
more text tokens separated by spans of one or more bytes from the
separator string s2. The first call, with pointer s1 specified,
Therefore, ":\n" is not wrong but should usually work ...
-gg
Received on Mon Oct 13 1997 - 01:01:24 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:37:17 MST