Rev 6857 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1665 | Nasarus | 1 | |
2 | #include "ctype.h" |
||
6857 | siemargl | 3 | |
1665 | Nasarus | 4 | |
5 | { |
||
6 | unsigned i; |
||
7 | |||
8 | |||
9 | *((char *)mem+i) = (char) c; |
||
10 | |||
11 | |||
12 | } |
||
13 | |||
14 | |||
15 | |||
16 | { |
||
17 | |||
18 | |||
19 | |||
20 | |||
21 | *(char *)(dst+i) = *(char *)(src+i); |
||
22 | |||
23 | |||
24 | } |
||
25 | |||
26 | |||
27 | |||
28 | { |
||
29 | int i; |
||
30 | for (i=0;i |
||
31 | { |
||
32 | if (*(unsigned char*)buf1<*(unsigned char*)buf2) |
||
33 | return -1; |
||
34 | if (*(unsigned char*)buf1>*(unsigned char*)buf2) |
||
35 | return 1; |
||
36 | } |
||
37 | return 0; |
||
38 | } |
||
39 | |||
40 | |||
41 | { |
||
42 | |||
43 | |||
44 | |||
45 | |||
46 | while (strDest[i] != '\0') |
||
47 | i++; |
||
48 | |||
49 | |||
50 | ; |
||
51 | } |
||
52 | |||
53 | |||
54 | |||
55 | { |
||
56 | |||
57 | |||
58 | { |
||
6825 | siemargl | 59 | if (*string1<*string2) |
60 | return -1; |
||
61 | if (*string1>*string2) |
||
62 | return 1; |
||
63 | |||
1665 | Nasarus | 64 | |
6825 | siemargl | 65 | return 0; |
66 | |||
1665 | Nasarus | 67 | |
6825 | siemargl | 68 | string2++; |
69 | } |
||
70 | |||
71 | |||
1665 | Nasarus | 72 | |
73 | |||
6825 | siemargl | 74 | { |
75 | int pc = 0; |
||
76 | while (1) |
||
77 | { |
||
78 | if (toupper(*string1) |
||
79 | return -1; |
||
80 | if (toupper(*string1)>toupper(*string2)) |
||
81 | return 1; |
||
82 | |||
83 | |||
84 | return 0; |
||
85 | |||
86 | |||
87 | string2++; |
||
88 | pc++; |
||
89 | } |
||
90 | } |
||
1665 | Nasarus | 91 | |
92 | |||
93 | { |
||
94 | unsigned i; |
||
95 | |||
96 | |||
97 | while ((strDest[i] = strSource[i]) != '\0') |
||
98 | i++; |
||
99 | |||
100 | |||
101 | |||
102 | |||
103 | |||
104 | { |
||
105 | unsigned i; |
||
106 | |||
107 | |||
108 | return strDest; |
||
109 | |||
110 | |||
111 | while ((strDest[i] = strSource[i]) != '\0') |
||
112 | if ( (n-1) == i ) |
||
113 | break; |
||
114 | else |
||
115 | i++; |
||
116 | |||
117 | |||
118 | } |
||
119 | |||
120 | |||
121 | |||
122 | { |
||
123 | int i; |
||
124 | |||
125 | |||
126 | while (*string++) i++; |
||
127 | return i; |
||
128 | } |
||
129 | |||
130 | |||
131 | |||
132 | |||
133 | { |
||
134 | while (*string) |
||
135 | { |
||
136 | if (*string==c) |
||
137 | return (char*)string; |
||
138 | string++; |
||
139 | } |
||
140 | return (char*)0; |
||
141 | } |
||
142 | |||
143 | |||
2502 | Albom | 144 | |
3988 | leency | 145 | { |
146 | char* last_found = 0; // ! |
||
7802 | rgimad | 147 | while (*string) |
3988 | leency | 148 | { |
149 | if (*string==c) |
||
150 | { |
||
151 | last_found = (char*)string; |
||
4001 | leency | 152 | } |
3988 | leency | 153 | string++; |
154 | } |
||
155 | return last_found; |
||
4001 | leency | 156 | } |
3988 | leency | 157 | |
2502 | Albom | 158 | |
3988 | leency | 159 | |
160 | |||
2502 | Albom | 161 | { |
162 | int a, b, c, d; |
||
163 | a = (i - i%1000)/1000; |
||
164 | b = (i - i%100)/100 - a*10; |
||
165 | c = (i - i%10)/10 - a*100 - b*10; |
||
166 | d = i%10; |
||
167 | s[0] = a + '0'; |
||
168 | s[1] = b + '0'; |
||
169 | s[2] = c + '0'; |
||
170 | s[3] = d + '0'; |
||
171 | s[4] = 0; |
||
172 | } |
||
173 | |||
174 | |||
2735 | Albom | 175 | |
176 | void reverse(char s[]) |
||
177 | { |
||
178 | int i, j; |
||
179 | char c; |
||
180 | |||
181 | |||
182 | c = s[i]; |
||
183 | s[i] = s[j]; |
||
184 | s[j] = c; |
||
185 | } |
||
186 | } |
||
187 | |||
188 | |||
189 | |||
190 | void itoa(int n, char s[]) |
||
191 | { |
||
192 | int i, sign; |
||
193 | |||
194 | |||
3245 | Albom | 195 | n = -n; |
196 | i = 0; |
||
2735 | Albom | 197 | do { |
3245 | Albom | 198 | s[i++] = n % 10 + '0'; |
199 | } while ((n /= 10) > 0); |
||
200 | if (sign < 0) |
||
2735 | Albom | 201 | s[i++] = '-'; |
202 | s[i] = '\0'; |
||
203 | reverse(s); |
||
204 | } |
||
205 | |||
206 | |||
3245 | Albom | 207 | |
208 | |||
209 | { |
||
210 | int i, n; |
||
211 | |||
212 | |||
213 | for ( i = 0; s[i]!= '\0'; ++i) |
||
214 | if ((s[i]<'0') || (s[i]>'9')) |
||
215 | return 0; |
||
216 | else |
||
217 | n = 10 * n + s[i] - '0'; |
||
218 | |||
219 | |||
220 | }'0')>>> |
||
221 | >*string2) |