consistency cosmetics
[mplayer/greg.git] / gui / skin / cut.c
blobcdb56c3d3d486736c6c8e3109c300142339e793a
2 #include <string.h>
3 #include <stdlib.h>
5 void cutItem( char * in,char * out,char sep,int num )
7 int i,n,c;
8 for ( c=0,n=0,i=0;i<strlen( in );i++ )
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; }
14 out[c]=0;
17 int cutItemToInt( char * in,char sep,int num )
19 char tmp[512];
20 cutItem( in,tmp,sep,num );
21 return atoi( tmp );
24 float cutItemToFloat( char * in,char sep,int num )
26 char tmp[512];
27 cutItem( in,tmp,sep,num );
28 return atof( tmp );
31 void cutChunk( char * in,char * s1 )
33 cutItem( in,s1,'=',0 );
34 memmove( in,strchr( in,'=' )+1,strlen( in ) - strlen( s1 ) );