annotate osdep/strsep.c @ 32808:e67eb882f67a

100l: fix "gamma" equalizer setting to change red, green and blue gamma, not just red.
author reimar
date Sat, 12 Feb 2011 16:52:23 +0000
parents c70109fc98b2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28744
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
1 /*
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
2 * strsep implementation for systems that do not have it in libc
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
3 *
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
4 * This file is part of MPlayer.
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
5 *
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
6 * MPlayer is free software; you can redistribute it and/or modify
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
7 * it under the terms of the GNU General Public License as published by
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
9 * (at your option) any later version.
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
10 *
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
11 * MPlayer is distributed in the hope that it will be useful,
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
14 * GNU General Public License for more details.
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
15 *
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
16 * You should have received a copy of the GNU General Public License along
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
17 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
5cfef41a1771 Add standard license headers to files.
diego
parents: 21855
diff changeset
19 */
5393
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
20
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
21 #include <string.h>
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
22
16985
08cac43f1e38 Unify include paths, -I.. is in CFLAGS.
diego
parents: 9380
diff changeset
23 #include "config.h"
30313
7f7591482564 Add a proper header for our strsep implementation so strsep will
reimar
parents: 29263
diff changeset
24 #include "strsep.h"
5393
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
25
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
26 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
27 char *begin, *end;
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 begin = *stringp;
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
30 if(begin == NULL)
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
31 return NULL;
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(delim[0] == '\0' || delim[1] == '\0') {
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
34 char ch = delim[0];
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
35
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
36 if(ch == '\0')
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
37 end = NULL;
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
38 else {
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
39 if(*begin == ch)
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
40 end = begin;
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
41 else if(*begin == '\0')
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
42 end = NULL;
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
43 else
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
44 end = strchr(begin + 1, ch);
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
45 }
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
46 }
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
47 else
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
48 end = strpbrk(begin, delim);
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
49
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
50 if(end) {
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
51 *end++ = '\0';
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
52 *stringp = end;
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
53 }
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
54 else
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
55 *stringp = NULL;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28744
diff changeset
56
5393
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
57 return begin;
cbf0fed4d211 Add a configure test for the strsep function (it's missing on solaris)
jkeil
parents:
diff changeset
58 }