Can I use strtok() in a Linux Kernel Module?

前端 未结 3 510
暖寄归人
暖寄归人 2020-12-18 02:02

I need to do a parse on the data written to my module, and the use of the strtok() function of string.h would be useful. However I\'ve tried

#include 

        
3条回答
  •  长情又很酷
    2020-12-18 02:34

    The latest kernel library has this, which may do what you need:

    /**
     * strsep - Split a string into tokens
     * @s: The string to be searched
     * @ct: The characters to search for
     *
     * strsep() updates @s to point after the token, ready for the next call.
     *
     * It returns empty tokens, too, behaving exactly like the libc function
     * of that name. In fact, it was stolen from glibc2 and de-fancy-fied.
     * Same semantics, slimmer shape. ;)
     */
    

提交回复
热议问题