File:  [DVB] / dietlibc / lib / strtok_r.c
Revision 1.2: download - view: text, annotated - select for diffs
Sat Oct 11 09:36:49 2003 UTC (20 years, 7 months ago) by sanjiyan
Branches: MAIN
CVS tags: HEAD
fixing strtok_r (rewrite)
making the %m support NON DEFAULT as it is NOT SUSv3 or SUSv2
started to fix scanf

#include <string.h>

char*strtok_r(char*s,const char*delim,char**ptrptr) {
  char*tmp=0;

  if (s==0) s=*ptrptr;
  s+=strspn(s,delim);		/* overread leading delimiter */
  if (__likely(*s)) {
    tmp=s;
    s+=strcspn(s,delim);
    if (__likely(*s)) *s++=0;	/* not the end ? => terminate it */
  }
  *ptrptr=s;
  return tmp;
}

LinuxTV legacy CVS <linuxtv.org/cvs>