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