Last change
on this file since 1054 was
1054,
checked in by Bruno Cornec, 14 years ago
|
- Backporting more trunk content into stable
- Adding the test and lib directories
- Preparing for l10n
|
-
Property svn:eol-style set to
native
|
File size:
664 bytes
|
Line | |
---|
1 | /* |
---|
2 | * Test file to test the configuration file handling |
---|
3 | * |
---|
4 | * $Id$ |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #define _GNU_SOURCE |
---|
9 | #include <string.h> |
---|
10 | #include <stdlib.h> |
---|
11 | #include <stdio.h> |
---|
12 | |
---|
13 | #include "mr_str.h" |
---|
14 | #include "mr_mem.h" |
---|
15 | |
---|
16 | main() { |
---|
17 | const char delims[3] = ": \n"; |
---|
18 | |
---|
19 | int lastpos = 0; |
---|
20 | char *token = NULL; |
---|
21 | char *string = NULL; |
---|
22 | |
---|
23 | mr_asprintf(&string, "%s", "md0 : active raid10 hda1[0] hda12[3] hda6[2] hda5[1]\n"); |
---|
24 | fprintf(stdout, "string=|%s|\n", string); |
---|
25 | token = mr_strtok(string, delims, &lastpos); |
---|
26 | while (lastpos > 0) { |
---|
27 | fprintf(stdout, "token=|%s|, lastpos=%d\n", token, lastpos); |
---|
28 | mr_free(token); |
---|
29 | token = mr_strtok(string, delims, &lastpos); |
---|
30 | } |
---|
31 | mr_free(string); |
---|
32 | |
---|
33 | exit(0); |
---|
34 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.