mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Solaris has no strsep(3).
This commit is contained in:
		
							
								
								
									
										7
									
								
								compat.h
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								compat.h
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
/* $Id: compat.h,v 1.9 2009-08-14 21:13:48 tcunha Exp $ */
 | 
			
		||||
/* $Id: compat.h,v 1.10 2009-08-16 16:15:53 nicm Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
			
		||||
@@ -133,6 +133,11 @@
 | 
			
		||||
char		*strcasestr(const char *, const char *);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef HAVE_STRSEP
 | 
			
		||||
/* strsep.c */
 | 
			
		||||
char		*strsep(char **, const char *);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef HAVE_STRTONUM
 | 
			
		||||
/* strtonum.c */
 | 
			
		||||
long long	 strtonum(const char *, long long, long long, const char **);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										72
									
								
								compat/strsep.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								compat/strsep.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,72 @@
 | 
			
		||||
/* $Id: strsep.c,v 1.1 2009-08-16 16:15:53 nicm Exp $ */
 | 
			
		||||
/*	$OpenBSD: strsep.c,v 1.6 2005/08/08 08:05:37 espie Exp $	*/
 | 
			
		||||
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990, 1993
 | 
			
		||||
 *	The Regents of the University of California.  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 University 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 REGENTS 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 REGENTS 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 <string.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Get next token from string *stringp, where tokens are possibly-empty
 | 
			
		||||
 * strings separated by characters from delim.  
 | 
			
		||||
 *
 | 
			
		||||
 * Writes NULs into the string at *stringp to end tokens.
 | 
			
		||||
 * delim need not remain constant from call to call.
 | 
			
		||||
 * On return, *stringp points past the last NUL written (if there might
 | 
			
		||||
 * be further tokens), or is NULL (if there are definitely no more tokens).
 | 
			
		||||
 *
 | 
			
		||||
 * If *stringp is NULL, strsep returns NULL.
 | 
			
		||||
 */
 | 
			
		||||
char *
 | 
			
		||||
strsep(char **stringp, const char *delim)
 | 
			
		||||
{
 | 
			
		||||
	char *s;
 | 
			
		||||
	const char *spanp;
 | 
			
		||||
	int c, sc;
 | 
			
		||||
	char *tok;
 | 
			
		||||
 | 
			
		||||
	if ((s = *stringp) == NULL)
 | 
			
		||||
		return (NULL);
 | 
			
		||||
	for (tok = s;;) {
 | 
			
		||||
		c = *s++;
 | 
			
		||||
		spanp = delim;
 | 
			
		||||
		do {
 | 
			
		||||
			if ((sc = *spanp++) == c) {
 | 
			
		||||
				if (c == 0)
 | 
			
		||||
					s = NULL;
 | 
			
		||||
				else
 | 
			
		||||
					s[-1] = 0;
 | 
			
		||||
				*stringp = s;
 | 
			
		||||
				return (tok);
 | 
			
		||||
			}
 | 
			
		||||
		} while (sc != 0);
 | 
			
		||||
	}
 | 
			
		||||
	/* NOTREACHED */
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										10
									
								
								configure
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								configure
									
									
									
									
										vendored
									
									
								
							@@ -1,5 +1,5 @@
 | 
			
		||||
#!/bin/sh
 | 
			
		||||
# $Id: configure,v 1.23 2009-08-14 21:13:48 tcunha Exp $
 | 
			
		||||
# $Id: configure,v 1.24 2009-08-16 16:15:53 nicm Exp $
 | 
			
		||||
 | 
			
		||||
TMUX_PLATFORM=${TMUX_PLATFORM:-`uname -s`}
 | 
			
		||||
 | 
			
		||||
@@ -29,6 +29,7 @@ cat <<EOF >>$CONFIG_H
 | 
			
		||||
#undef HAVE_STRCASESTR
 | 
			
		||||
#undef HAVE_STRLCAT
 | 
			
		||||
#undef HAVE_STRLCPY
 | 
			
		||||
#undef HAVE_STRSEP
 | 
			
		||||
#undef HAVE_STRTONUM
 | 
			
		||||
#undef HAVE_TREE_H
 | 
			
		||||
#undef HAVE_UTIL_H
 | 
			
		||||
@@ -53,6 +54,7 @@ case $TMUX_PLATFORM in
 | 
			
		||||
#define HAVE_STRCASESTR
 | 
			
		||||
#define HAVE_STRLCAT
 | 
			
		||||
#define HAVE_STRLCPY
 | 
			
		||||
#define HAVE_STRSEP
 | 
			
		||||
#define HAVE_STRTONUM
 | 
			
		||||
#define HAVE_TREE_H
 | 
			
		||||
#define HAVE_UTIL_H
 | 
			
		||||
@@ -76,6 +78,7 @@ EOF
 | 
			
		||||
#define HAVE_PROGNAME
 | 
			
		||||
#define HAVE_PTY_H
 | 
			
		||||
#define HAVE_STRCASESTR
 | 
			
		||||
#define HAVE_STRSEP
 | 
			
		||||
EOF
 | 
			
		||||
	cat <<EOF >>$CONFIG_MK
 | 
			
		||||
CFLAGS+= -std=c99 -D_GNU_SOURCE -D_POSIX_SOURCE
 | 
			
		||||
@@ -107,6 +110,7 @@ SRCS+= osdep-unknown.c \
 | 
			
		||||
	compat/strcasestr.c \
 | 
			
		||||
	compat/strlcat.c \
 | 
			
		||||
	compat/strlcpy.c \
 | 
			
		||||
	compat/strsep.c \
 | 
			
		||||
	compat/strtonum.c \
 | 
			
		||||
       	compat/fgetln.c \
 | 
			
		||||
       	compat/getopt.c \
 | 
			
		||||
@@ -139,6 +143,7 @@ SRCS+= osdep-unknown.c \
 | 
			
		||||
	compat/forkpty-sunos.c \
 | 
			
		||||
	compat/getopt.c \
 | 
			
		||||
	compat/strcasestr.c \
 | 
			
		||||
	compat/strsep.c \
 | 
			
		||||
	compat/strtonum.c \
 | 
			
		||||
	compat/vis.c \
 | 
			
		||||
	compat/unvis.c \
 | 
			
		||||
@@ -159,6 +164,7 @@ EOF
 | 
			
		||||
#define HAVE_STRCASESTR
 | 
			
		||||
#define HAVE_STRLCAT
 | 
			
		||||
#define HAVE_STRLCPY
 | 
			
		||||
#define HAVE_STRSEP
 | 
			
		||||
#define HAVE_UTIL_H
 | 
			
		||||
EOF
 | 
			
		||||
	cat <<EOF >>$CONFIG_MK
 | 
			
		||||
@@ -189,6 +195,7 @@ EOF
 | 
			
		||||
#define HAVE_STRLCAT
 | 
			
		||||
#define HAVE_STRLCPY
 | 
			
		||||
#define HAVE_STRTONUM
 | 
			
		||||
#define HAVE_STRSEP
 | 
			
		||||
#define HAVE_VIS
 | 
			
		||||
EOF
 | 
			
		||||
	cat <<EOF >>$CONFIG_MK
 | 
			
		||||
@@ -213,6 +220,7 @@ EOF
 | 
			
		||||
#define HAVE_STRCASESTR
 | 
			
		||||
#define HAVE_STRLCAT
 | 
			
		||||
#define HAVE_STRLCPY
 | 
			
		||||
#define HAVE_STRSEP
 | 
			
		||||
#define HAVE_UTIL_H
 | 
			
		||||
#define HAVE_VIS
 | 
			
		||||
EOF
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user