From 655f0523f20333b08669567f5740de2033359427 Mon Sep 17 00:00:00 2001 From: Heimdal Developers Date: Tue, 23 Nov 2010 11:22:51 +0000 Subject: [PATCH] Import of code from heimdal This commit updates the code imported from heimdal to bd78baf668eca011257f05fef8334e0967500456 (switch-from-svn-to-git-1696-gbd78baf) New files are: roken/strsep.c Change-Id: I10c99e408db40f6bcdb0e2c243c3016cd2bf1faa Reviewed-on: http://gerrit.openafs.org/3370 Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/external/heimdal/roken/getopt.c | 3 -- src/external/heimdal/roken/strsep.c | 58 +++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 src/external/heimdal/roken/strsep.c diff --git a/src/external/heimdal/roken/getopt.c b/src/external/heimdal/roken/getopt.c index 942e5b4b5..653853543 100644 --- a/src/external/heimdal/roken/getopt.c +++ b/src/external/heimdal/roken/getopt.c @@ -34,9 +34,6 @@ static char sccsid[] = "@(#)getopt.c 8.1 (Berkeley) 6/4/93"; #ifndef __STDC__ #define const #endif -#include -#include "roken.h" - #include #include #include diff --git a/src/external/heimdal/roken/strsep.c b/src/external/heimdal/roken/strsep.c new file mode 100644 index 000000000..76b447c37 --- /dev/null +++ b/src/external/heimdal/roken/strsep.c @@ -0,0 +1,58 @@ +/* + * Copyright (c) 1997 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include + +#include "roken.h" + +#ifndef HAVE_STRSEP + +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL +strsep(char **str, const char *delim) +{ + char *save = *str; + if(*str == NULL) + return NULL; + *str = *str + strcspn(*str, delim); + if(**str == 0) + *str = NULL; + else{ + **str = 0; + (*str)++; + } + return save; +} + +#endif -- 2.39.5