|
Last change
on this file since 1054 was 900, checked in by Bruno Cornec, 19 years ago |
|
Huge patch to introduce low level functions that will bw used everywhere (mr_free, mr_asprintf, ...)
Nearly linking now due to that.
|
|
File size:
685 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 "my-stuff.h"
|
|---|
| 14 | #include "mr_str.h"
|
|---|
| 15 | #include "mr_mem.h"
|
|---|
| 16 |
|
|---|
| 17 | main() {
|
|---|
| 18 | const char delims[3] = ": \n";
|
|---|
| 19 |
|
|---|
| 20 | int lastpos = 0;
|
|---|
| 21 | char *token = NULL;
|
|---|
| 22 | char *string = NULL;
|
|---|
| 23 |
|
|---|
| 24 | mr_asprintf(&string, "%s", "md0 : active raid10 hda1[0] hda12[3] hda6[2] hda5[1]\n");
|
|---|
| 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 | exit(0);
|
|---|
| 34 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.