Changeset 768 in MondoRescue


Ignore:
Timestamp:
Aug 8, 2006, 3:51:12 PM (18 years ago)
Author:
Bruno Cornec
Message:

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

Location:
trunk/mondo/mondo
Files:
1 added
2 deleted
5 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/mondo/mondo/common/libmondo-string.c

    r688 r768  
    11381138    return (type_of_backup);
    11391139}
    1140 
    1141 
    1142 /* New functions safe from a memory manageemnt point of view */
    1143 /* Developped by Andree Leidenfrost */
    1144 
    1145 char *mr_strtok(char *instr, const char *delims, int *lastpos) {
    1146 
    1147 char *token = NULL;
    1148 char *strptr = NULL;
    1149 size_t pos1 = 0;
    1150 size_t pos2 = 0;
    1151 
    1152 if (strlen(instr) <= *lastpos) {
    1153     *lastpos = 0;
    1154     return token;
    1155 }
    1156 
    1157 strptr = instr + *lastpos;
    1158 pos2 = strspn(strptr, delims);
    1159 strptr += pos2;
    1160 pos1 = strcspn(strptr, delims);
    1161 token = malloc(sizeof(*token)*(pos1+1));
    1162 strncpy(token, strptr, pos1);
    1163 token[pos1] = '\0';
    1164 *lastpos = *lastpos + pos1 + pos2 + 1;
    1165 
    1166 return token;
    1167 }
    1168 /* @} - end of stringGroup */
  • trunk/mondo/mondo/lib/mr_conf.h

    r767 r768  
    66 * Review for mondorescue (c) 2006 Bruno Cornec <bruno@mondorescue.org>
    77 *   
    8  *     Header file of libmondo-conf (mr_conf): a very small and simple
     8 *     Header file of mr_conf: a very small and simple
    99 *     library for mondorescue configuration file reading
    1010 *
  • trunk/mondo/mondo/lib/mr_string.c

    r767 r768  
    22   $Id$
    33*/
     4
     5#include <stdio.h>
     6#include <string.h>
    47
    58/* New functions safe from a memory manageemnt point of view */
  • trunk/mondo/mondo/test/mktest

    r561 r768  
    66#
    77
    8 gcc -O2 -I../common test-conf.c ../common/libmondo-conf.c ../common/libmondo-msg.c -o test-conf
    9 gcc -O2 -I../common test-string.c ../common/libmondo-string.c ../common/libmondo-msg.c -o test-string
     8gcc -O2 -I../common -I../lib test-conf.c ../lib/mr_conf.c ../common/libmondo-msg.c -o test-conf
     9gcc -O2 -I../common -I../lib test-string.c ../lib/mr_string.c -o test-string
    1010
    1111for f in "test-conf"; do
  • trunk/mondo/mondo/test/test-conf.c

    r531 r768  
    88#include <stdio.h>
    99#include "my-stuff.h"
    10 #include "libmondo-conf.h"
     10#include "mr_conf.h"
    1111
    1212int g_main_pid = 0;
     
    1919    char *s = NULL;
    2020   
    21     if ((ret = mrconf_open("mondo.conf")) != 0) {
     21    if ((ret = mr_conf_open("mondo.conf")) != 0) {
    2222        fprintf(stderr,"Unable to open conf file (%d)\n",ret);
    2323        exit(-1);
    2424    }
    25     if ((i = mrconf_iread("testinteger")) == 0) {
     25    if ((i = mr_conf_iread("testinteger")) == 0) {
    2626        fprintf(stderr,"Unable to get integer\n");
    2727        exit(-1);
    2828    }
    2929    fprintf(stdout, "Integer : ***%d***\n",i);
    30     if ((f = mrconf_fread("testfloat")) == 0.0) {
     30    if ((f = mr_conf_fread("testfloat")) == 0.0) {
    3131        fprintf(stderr,"Unable to get float\n");
    3232        exit(-1);
    3333    }
    3434    fprintf(stdout, "Float : ***%f***\n",f);
    35     if (! (s = mrconf_sread("teststring"))) {
     35    if (! (s = mr_conf_sread("teststring"))) {
    3636        fprintf(stderr,"Unable to get string\n");
    3737        exit(-1);
     
    3939    fprintf(stdout, "String : ***%s***\n",s);
    4040    paranoid_free(s);
    41     mrconf_close();
     41    mr_conf_close();
    4242    exit(0);
    4343}
  • trunk/mondo/mondo/test/test-string.c

    r561 r768  
    1010#include <stdlib.h>
    1111#include <stdio.h>
     12
    1213#include "my-stuff.h"
    13 #include "libmondo-string.h"
     14#include "mr_string.h"
    1415
    1516main() {
Note: See TracChangeset for help on using the changeset viewer.