Mercurial > mplayer.hg
annotate osdep/strsep.c @ 13394:455a5056801f
New generic 'portable anymap' video output driver. It supports portable
pixmaps and graymaps in both raw and ASCII mode. Besides PPM and PGM, it
can also output PGMYUV files which are PGM files with the U and V plane
appended to the bottom of the Y image (bottom left and bottom right). All
files can be written to the current directory, to a specified output directory
or to multiple subdirectories if the filesystem can't handle the amount of
files in one directory anymore.
Note: This driver is not yet activated and will not be compiled and linked
to libvo. A separate patch will take care of that. This is just for adding
the file to the repository.
author | ivo |
---|---|
date | Mon, 20 Sep 2004 00:54:57 +0000 |
parents | edfe34c5405d |
children | 08cac43f1e38 |
rev | line source |
---|---|
5393
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
1 /* strsep implementation for systems that do not have it in libc */ |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
2 |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
3 #include <stdio.h> |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
4 #include <string.h> |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
5 |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
6 #include "../config.h" |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
7 |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
8 #ifndef HAVE_STRSEP |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
9 char *strsep(char **stringp, const char *delim) { |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
10 char *begin, *end; |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
11 |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
12 begin = *stringp; |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
13 if(begin == NULL) |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
14 return NULL; |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
15 |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
16 if(delim[0] == '\0' || delim[1] == '\0') { |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
17 char ch = delim[0]; |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
18 |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
19 if(ch == '\0') |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
20 end = NULL; |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
21 else { |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
22 if(*begin == ch) |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
23 end = begin; |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
24 else if(*begin == '\0') |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
25 end = NULL; |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
26 else |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
27 end = strchr(begin + 1, ch); |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
28 } |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
29 } |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
30 else |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
31 end = strpbrk(begin, delim); |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
32 |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
33 if(end) { |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
34 *end++ = '\0'; |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
35 *stringp = end; |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
36 } |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
37 else |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
38 *stringp = NULL; |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
39 |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
40 return begin; |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
41 } |
cbf0fed4d211
Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff
changeset
|
42 #endif |