source: MondoRescue/trunk/mondo/mondo/test/test-string.c@ 768

Last change on this file since 768 was 768, checked in by Bruno Cornec, 18 years ago

mktest generates again good results with the new split of libraries.

File size: 677 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_string.h"
15
16main() {
17 const char delims[3] = ": \n";
18
19 int lastpos = 0;
20 char *token = NULL;
21 char *string = NULL;
22
23 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 paranoid_free(token);
29 token = mr_strtok(string, delims, &lastpos);
30 }
31 paranoid_free(string);
32 exit(0);
33}
Note: See TracBrowser for help on using the repository browser.