author | Markus Bröker <mbroeker@largo.dyndns.tv> |
Sat, 13 Dec 2008 17:58:00 +0100 | |
changeset 8 | 96d16dfe787a |
parent 0 | af501b0c1716 |
child 9 | c3fecc82ade6 |
permissions | -rw-r--r-- |
0 | 1 |
/** |
2 |
* $Id: testcase.c,v 1.1.1.1 2008-04-28 17:32:53 mbroeker Exp $ |
|
3 |
* $Source: /development/c/demos/testcase.c,v $ |
|
4 |
* |
|
5 |
*/ |
|
6 |
||
7 |
#define _XOPEN_SOURCE 500 |
|
8 |
||
9 |
#include <stdio.h> |
|
10 |
#include <stdlib.h> |
|
11 |
#include <string.h> |
|
12 |
||
13 |
int main (int argc, char **argv) |
|
14 |
{ |
|
15 |
char line[83]; |
|
16 |
char *token; |
|
17 |
||
18 |
if (argc != 4) { |
|
19 |
printf ("Usage: %s (char*)string (char*)delim1 (char*)delim2\n", argv[0]); |
|
20 |
return 0; |
|
21 |
} |
|
22 |
||
23 |
snprintf (line, 80, "%s\r\n", argv[1]); |
|
24 |
||
25 |
token = strtok (line, argv[2]); |
|
26 |
||
27 |
while (token) { |
|
28 |
printf ("TOKEN: %s\n", token); |
|
29 |
token = strtok (NULL, argv[3]); |
|
30 |
} |
|
31 |
||
8
96d16dfe787a
We use return EXIT_SUCCESS instead of return 0
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
32 |
printf ("\nTest finished\n"); |
0 | 33 |
|
8
96d16dfe787a
We use return EXIT_SUCCESS instead of return 0
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
34 |
return EXIT_SUCCESS; |
0 | 35 |
} |