annotate Gui/skin/cut.c @ 2902:d47cbcdce1a8

rewrite some header meg jol csinaltam menu -t koepso gombra gonosz mod ( bocs, tom, nem angol).
author pontscho
date Wed, 14 Nov 2001 16:05:33 +0000
parents 58dd326fcc4a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
2 #include <string.h>
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
3 #include <stdlib.h>
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
4
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
5 void cutItem( char * in,char * out,char sep,int num )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
6 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
7 int i,n,c;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
8 for ( c=0,n=0,i=0;i<strlen( in );i++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
9 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
10 if ( in[i] == sep ) n++;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
11 if ( n >= num && in[i] != sep ) out[c++]=in[i];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
12 if ( n >= num && in[i+1] == sep ) { out[c]=0; return; }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
13 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
14 out[c]=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
15 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
16
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1693
diff changeset
17 int cutItemToInt( char * in,char sep,int num )
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1693
diff changeset
18 {
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1693
diff changeset
19 char tmp[512];
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1693
diff changeset
20 cutItem( in,tmp,sep,num );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1693
diff changeset
21 return atoi( tmp );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1693
diff changeset
22 }
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1693
diff changeset
23
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1693
diff changeset
24 float cutItemToFloat( char * in,char sep,int num )
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1693
diff changeset
25 {
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1693
diff changeset
26 char tmp[512];
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1693
diff changeset
27 cutItem( in,tmp,sep,num );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1693
diff changeset
28 return atof( tmp );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1693
diff changeset
29 }
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1693
diff changeset
30
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
31 void cutChunk( char * in,char * s1 )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
32 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
33 cutItem( in,s1,'=',0 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
34 memmove( in,strchr( in,'=' )+1,strlen( in ) - strlen( s1 ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
35 }
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1693
diff changeset
36