ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

mbstok.c
Go to the documentation of this file.
00001 #include <stdlib.h>
00002 #include <mbstring.h>
00003 
00004 /*
00005  * @implemented
00006  */
00007 unsigned char * _mbstok(unsigned char *s, const unsigned char *delim)
00008 {
00009   const unsigned char *spanp;
00010   int c, sc;
00011   unsigned char *tok;
00012   static unsigned char *last;
00013 
00014 
00015   if (s == NULL && (s = last) == NULL)
00016     return (NULL);
00017 
00018   /*
00019    * Skip (span) leading delimiters (s += strspn(s, delim), sort of).
00020    */
00021  cont:
00022   c = *s;
00023   s = _mbsinc(s);
00024 
00025   for (spanp = delim; (sc = *spanp) != 0; spanp = _mbsinc(spanp)) {
00026     if (c == sc)
00027       goto cont;
00028   }
00029 
00030   if (c == 0) {         /* no non-delimiter characters */
00031     last = NULL;
00032     return (NULL);
00033   }
00034   tok = s - 1;
00035 
00036   /*
00037    * Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
00038    * Note that delim must have one NUL; we stop if we see that, too.
00039    */
00040   for (;;) {
00041     c = *s;
00042     s = _mbsinc(s);
00043     spanp = delim;
00044     do {
00045       if ((sc = *spanp) == c) {
00046     if (c == 0)
00047       s = NULL;
00048     else
00049       s[-1] = 0;
00050     last = s;
00051     return (tok);
00052       }
00053       spanp = _mbsinc(spanp);
00054     } while (sc != 0);
00055   }
00056   /* NOTREACHED */
00057 }

Generated on Sat May 26 2012 04:35:28 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.