Mercurial > mplayer.hg
comparison gui/skin/cut.c @ 23077:17bf4f4b0715
Gui --> gui
author | diego |
---|---|
date | Mon, 23 Apr 2007 07:42:42 +0000 |
parents | |
children | b0a7b35b78d2 |
comparison
equal
deleted
inserted
replaced
23076:39dd908375b2 | 23077:17bf4f4b0715 |
---|---|
1 | |
2 #include <string.h> | |
3 #include <stdlib.h> | |
4 | |
5 void cutItem( char * in,char * out,char sep,int num ) | |
6 { | |
7 int i,n,c; | |
8 for ( c=0,n=0,i=0;i<strlen( in );i++ ) | |
9 { | |
10 if ( in[i] == sep ) n++; | |
11 if ( n >= num && in[i] != sep ) out[c++]=in[i]; | |
12 if ( n >= num && in[i+1] == sep ) { out[c]=0; return; } | |
13 } | |
14 out[c]=0; | |
15 } | |
16 | |
17 int cutItemToInt( char * in,char sep,int num ) | |
18 { | |
19 char tmp[512]; | |
20 cutItem( in,tmp,sep,num ); | |
21 return atoi( tmp ); | |
22 } | |
23 | |
24 float cutItemToFloat( char * in,char sep,int num ) | |
25 { | |
26 char tmp[512]; | |
27 cutItem( in,tmp,sep,num ); | |
28 return atof( tmp ); | |
29 } | |
30 | |
31 void cutChunk( char * in,char * s1 ) | |
32 { | |
33 cutItem( in,s1,'=',0 ); | |
34 memmove( in,strchr( in,'=' )+1,strlen( in ) - strlen( s1 ) ); | |
35 } | |
36 |