author | Markus Bröker <mbroeker@largo.dyndns.tv> |
Thu, 16 Apr 2009 12:50:39 +0200 | |
changeset 70 | ded389a5dc2a |
parent 61 | 4b4c97f179da |
child 77 | 49e0babccb23 |
permissions | -rw-r--r-- |
0 | 1 |
/** |
9
c3fecc82ade6
standard tags for git projects
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
8
diff
changeset
|
2 |
* test/demos/testcase.c |
c3fecc82ade6
standard tags for git projects
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
8
diff
changeset
|
3 |
* Copyright (C) 2008 Markus Broeker |
0 | 4 |
*/ |
5 |
||
6 |
#define _XOPEN_SOURCE 500 |
|
7 |
||
8 |
#include <stdio.h> |
|
9 |
#include <stdlib.h> |
|
10 |
#include <string.h> |
|
11 |
||
12 |
int main (int argc, char **argv) |
|
13 |
{ |
|
14 |
char line[83]; |
|
15 |
char *token; |
|
16 |
||
17 |
if (argc != 4) { |
|
61
4b4c97f179da
Lazy BNF / EBNF Help Messages
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
48
diff
changeset
|
18 |
printf ("Usage: %s <string> <delim> <delim>\n", argv[0]); |
48
b94d657a9acb
Policy Inonsistency on many files
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
29
diff
changeset
|
19 |
return EXIT_FAILURE; |
0 | 20 |
} |
21 |
||
22 |
snprintf (line, 80, "%s\r\n", argv[1]); |
|
23 |
||
24 |
token = strtok (line, argv[2]); |
|
25 |
||
26 |
while (token) { |
|
27 |
printf ("TOKEN: %s\n", token); |
|
28 |
token = strtok (NULL, argv[3]); |
|
29 |
} |
|
30 |
||
8
96d16dfe787a
We use return EXIT_SUCCESS instead of return 0
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
31 |
printf ("\nTest finished\n"); |
0 | 32 |
|
8
96d16dfe787a
We use return EXIT_SUCCESS instead of return 0
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
33 |
return EXIT_SUCCESS; |
0 | 34 |
} |