Last change
on this file since 2605 was 2334, checked in by Bruno Cornec, 15 years ago |
r3369@localhost: bruno | 2009-08-18 16:57:27 +0200
- Transform bout 100 strcpy in dyn. allocation. Quality is improving
- function figure_out_kernel_path_interactively_if_necessary now return a dynamically allocated string
- mondoarchive checked with valgrind in text an newt modes
|
-
Property svn:eol-style
set to
native
|
File size:
685 bytes
|
Rev | Line | |
---|
[2310] | 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>
|
---|
| 11 |
|
---|
| 12 | #include "mr_str.h"
|
---|
| 13 | #include "mr_mem.h"
|
---|
| 14 |
|
---|
| 15 | void (*mr_cleanup)(void) = NULL;
|
---|
| 16 |
|
---|
| 17 | int main(void) {
|
---|
| 18 | const char delims[3] = ": \n";
|
---|
| 19 |
|
---|
| 20 | int lastpos = 0;
|
---|
| 21 | char *token = NULL;
|
---|
| 22 | char *string = NULL;
|
---|
| 23 |
|
---|
[2334] | 24 | mr_asprintf(string, "%s", "md0 : active raid10 hda1[0] hda12[3] hda6[2] hda5[1]\n");
|
---|
[2310] | 25 | fprintf(stdout, "string=|%s|\n", string);
|
---|
| 26 | token = mr_strtok(string, delims, &lastpos);
|
---|
| 27 | while (lastpos > 0) {
|
---|
| 28 | fprintf(stdout, "token=|%s|, lastpos=%d\n", token, lastpos);
|
---|
| 29 | mr_free(token);
|
---|
| 30 | token = mr_strtok(string, delims, &lastpos);
|
---|
| 31 | }
|
---|
| 32 | mr_free(string);
|
---|
| 33 |
|
---|
| 34 | exit(0);
|
---|
| 35 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.