Annotation of imach/src/strsep.c, revision 1.1

1.1     ! lievre      1: /*  lmpc -- the Little Movie Processing Centre
        !             2:     Copyright (C) 1994-99,2004 Uwe Girlich
        !             3: 
        !             4:     This program is free software; you can redistribute it and/or modify
        !             5:     it under the terms of the GNU General Public License as published by
        !             6:     the Free Software Foundation; either version 2 of the License, or
        !             7:     (at your option) any later version.
        !             8: 
        !             9:     This program is distributed in the hope that it will be useful,
        !            10:     but WITHOUT ANY WARRANTY; without even the implied warranty of
        !            11:     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        !            12:     GNU General Public License for more details.
        !            13: 
        !            14:     You should have received a copy of the GNU General Public License
        !            15:     along with this program; if not, write to the Free Software
        !            16:     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
        !            17: 
        !            18:     Uwe Girlich
        !            19:     Germany
        !            20:     E-mail: uwe@planetquake.com */
        !            21: 
        !            22: /****************************************************************************\
        !            23: |  strsep.c  -  implementation, missing standard C routine                   |
        !            24: \****************************************************************************/
        !            25: 
        !            26: 
        !            27: /*
        !            28:  *  Some cross-compilers don't have all standard C library functions.
        !            29:  *  I copied the following code from the GNU C Library source.
        !            30:  *  Look in COPYING.LIB for distribution hints of this code.
        !            31:  */                      
        !            32: 
        !            33: 
        !            34: #ifdef HAVE_CONFIG_H
        !            35:   #include <config.h>
        !            36: #endif
        !            37: 
        !            38: 
        !            39: #include <string.h>
        !            40: 
        !            41: 
        !            42: char * strsep(char **pp, const char *delim)
        !            43: {
        !            44:   char *p, *q;
        !            45:          
        !            46:   if ((p = *pp) == NULL)
        !            47:     return 0;
        !            48:   if ((q = strpbrk (p, delim)) != NULL)
        !            49:   {
        !            50:     *pp = q + 1;
        !            51:     *q = '\0';
        !            52:   }
        !            53:   else
        !            54:     *pp = 0;
        !            55:   return p;
        !            56: }
        !            57: 
        !            58: 
        !            59: /*-- file end strsep.c -----------------------------------------------------*/

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>