lkml.org 
[lkml]   [2007]   [Jul]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Including STRTOK_R in a LSM

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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-07-16 12:19    [W:0.094 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site