What I need is to ignore double delimiters such as (::). This can be
done trivially with a string comparison to check for "\0". What I want
to know is if it is ok to include the strtok_r code in my security
module, or if strtok was removed for a very good reason. I am porting a
lot of existing code which already uses strtok_r to a kernel security
module.
Thanks,
Cliffe.
Jan Engelhardt wrote:
On Jul 16 2007 16:52, Z. Cliffe Schreuders wrote:
I am aware strtok was removed from the kernel in 2002. However strtok_r is more
desirable than strsep as I do not want to know about 'blank fields' (2
consecutive delimiters). Is it acceptable to simply include the strtok_r code
in my security module? or should I create a wrapper for strsep to ignore
blanks?
12:16 ichi:/dev/shm > cat test.c
#include <stdio.h>
#include <string.h>
int main(void)
{
char x[] = "foo::bar";
char *w = x;
char *p;
while ((p = strsep(&w, ":")) != NULL)
printf("\"%s\"\n", p);
}
12:16 ichi:/dev/shm > ./a.out
"foo"
""
"bar"
q.e.d.
Jan
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]