2 * This file is part of MPlayer.
4 * MPlayer is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * MPlayer is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 void cutItem( char * in
,char * out
,char sep
,int num
)
25 for ( c
=0,n
=0,i
=0;i
<strlen( in
);i
++ )
27 if ( in
[i
] == sep
) n
++;
28 if ( n
>= num
&& in
[i
] != sep
) out
[c
++]=in
[i
];
29 if ( n
>= num
&& in
[i
+1] == sep
) { out
[c
]=0; return; }
34 int cutItemToInt( char * in
,char sep
,int num
)
37 cutItem( in
,tmp
,sep
,num
);
41 float cutItemToFloat( char * in
,char sep
,int num
)
44 cutItem( in
,tmp
,sep
,num
);
48 void cutChunk( char * in
,char * s1
)
50 cutItem( in
,s1
,'=',0 );
51 memmove( in
,strchr( in
,'=' )+1,strlen( in
) - strlen( s1
) );