[Mplayer-cvslog] CVS: main/linux strsep.c,NONE,1.1 Makefile,1.3,1.4

Jürgen Keil jkeil at mplayer.dev.hu
Fri Mar 29 22:24:38 CET 2002


Update of /cvsroot/mplayer/main/linux
In directory mplayer:/var/tmp.root/cvs-serv5135/linux

Modified Files:
	Makefile 
Added Files:
	strsep.c 
Log Message:
Add a configure test for the strsep function (it's missing on solaris)

Provide an implementation of strsep in libosdep.a, if it's missing in the
system's libc library.


--- NEW FILE ---
/* strsep implementation for systems that do not have it in libc */

#include <stdio.h>
#include <string.h>

#include "../config.h"

#ifndef HAVE_STRSEP
char *strsep(char **stringp, const char *delim) {
  char *begin, *end;

  begin = *stringp;
  if(begin == NULL)
    return NULL;

  if(delim[0] == '\0' || delim[1] == '\0') {
    char ch = delim[0];

    if(ch == '\0')
      end = NULL;
    else {
      if(*begin == ch)
        end = begin;
      else if(*begin == '\0')
        end = NULL;
      else
        end = strchr(begin + 1, ch);
    }
  }
  else
    end = strpbrk(begin, delim);

  if(end) {
    *end++ = '\0';
    *stringp = end;
  }
  else
    *stringp = NULL;
 
  return begin;
}
#endif

Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/linux/Makefile,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Makefile	24 Mar 2002 01:05:57 -0000	1.3
+++ Makefile	29 Mar 2002 21:24:36 -0000	1.4
@@ -3,7 +3,7 @@
 
 LIBNAME = libosdep.a
 
-SRCS=getch2.c timer-lx.c shmem.c # timer.c
+SRCS=getch2.c timer-lx.c shmem.c strsep.c # timer.c
 OBJS=$(SRCS:.c=.o)
 
 ifeq ($(TARGET_ARCH_X86),yes)




More information about the MPlayer-cvslog mailing list