equal
deleted
inserted
replaced
|
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 int i; |
|
18 |
|
19 if (argc != 4) { |
|
20 printf ("Usage: %s (char*)string (char*)delim1 (char*)delim2\n", argv[0]); |
|
21 return 0; |
|
22 } |
|
23 |
|
24 snprintf (line, 80, "%s\r\n", argv[1]); |
|
25 |
|
26 token = strtok (line, argv[2]); |
|
27 |
|
28 while (token) { |
|
29 printf ("TOKEN: %s\n", token); |
|
30 token = strtok (NULL, argv[3]); |
|
31 } |
|
32 |
|
33 i = 0; |
|
34 printf ("while i++ <5: "); |
|
35 while (i++ < 5) |
|
36 printf ("%d ", i); |
|
37 |
|
38 i = 0; |
|
39 printf ("\nwhile ++i <5: "); |
|
40 while (++i < 5) |
|
41 printf ("%d ", i); |
|
42 |
|
43 i = 0; |
|
44 printf ("\nwhile i <5 : "); |
|
45 while (i < 5) |
|
46 printf ("%d ", i++); |
|
47 |
|
48 i = 0; |
|
49 printf ("\nwhile i <5 : "); |
|
50 while (i < 5) |
|
51 printf ("%d ", ++i); |
|
52 |
|
53 printf ("\nTest finished\n"); |
|
54 return 0; |
|
55 } |