Changeset 3294 for branches/3.2


Ignore:
Timestamp:
Jun 3, 2014, 8:20:52 AM (5 years ago)
Author:
bruno
Message:
  • Fix a compilation issue in libmondo-archive.c on mindi call with lack of parameter
  • Fix compilation warnings in mr_mem.c
  • Adds function mr_str_substitute in mr_str (not yet used) and test code
Location:
branches/3.2/mondo
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mondo/src/common/libmondo-archive.c

    r3293 r3294  
    8418416=\"%s\" 7=%ld 8=\"%s\" 9=\"%s\" 10=\"%s\" \
    84284211=\"%s\" 12=%s 13=%ld 14=\"%s\" 15=\"%s\" 16=\"%s\" 17=\"%s\" 18=%ld 19=%d",*/
    843     mr_asprintf(command, "mindi %s --custom %s %s/images '%s' '%s' '%s' %ld '%s' '%s' '%s' '%s' %s %ld '%s' '%s' '%s' '%s' %ld %d '%s' '%s' 2>&1 > %s",
     843    mr_asprintf(command,
     844            "mindi %s --custom %s %s/images '%s' '%s' '%s' '%ld' '%s' '%s' '%s' '%s' '%s' '%ld' '%s' '%s' '%s' '%s' '%ld' '%d' '%s' '%s' 2>&1 > %s",
     845            //     1           2   3          4   5    6     7     8    9   10   11   12   13    14   15   16   17   18    19   20   21         23
    844846            tmp2,
    845847            bkpinfo->tmpdir,    // parameter #2
     
    864866            use_lzma_sz,        // parameter #20 (STRING)
    865867            value,          // parameter #21 (STRING)
    866             MONDO_LOGFILE,      // redirect to log file
     868            MONDO_LOGFILE       // redirect to log file
    867869            );
    868870
  • branches/3.2/mondo/src/lib/mr_conf.c

    r3185 r3294  
    44 *
    55 * Based on the work done by Anton (c)2002-2004 Anton Kulchitsky  mailto:anton@kulchitsky.org
    6  * Code (c)2006 Bruno Cornec <bruno@mondorescue.org>
     6 * Code (c)2006-2014 Bruno Cornec <bruno@mondorescue.org>
    77 *   
    88 *     Main file of mr_conf : a very small and simple
     
    174174        p += strlen(field_name);
    175175        while ((*p != '\n') && (*p != '\0') && (*p != '=')) {
    176                 p++;
     176            p++;
    177177        }
    178178        if (*p != '=') {
  • branches/3.2/mondo/src/lib/mr_mem.c

    r3292 r3294  
    7777        /* free a variable which should be already free */
    7878        mr_msg_int(1,line,file,"mr_getline_ found a non freed variable here");
    79         mr_free_int(lineptr,line,file);
     79        mr_free_int((void **)lineptr,line,file);
    8080    }
    8181    ret = getline(lineptr,&n,fd);
     
    8686    /*  We reached end of file, allocating empty string */
    8787    if (ret == -1) {
    88         mr_free_int(lineptr,line,file);
     88        mr_free_int((void **)lineptr,line,file);
    8989        mr_asprintf_int(lineptr,line,file,"");
    9090    }
  • branches/3.2/mondo/src/lib/mr_str.c

    r3194 r3294  
    194194}
    195195
     196char *mr_str_substitute(const char *in, const char *token, const char *subst) {
     197
     198char *output = NULL;
     199char *tmp = NULL;
     200int i = 0;
     201
     202mr_asprintf(output, "%s", in);
     203tmp = strstr(output, token);
     204if (tmp == NULL) {
     205    // token not found returning initial string unmodified
     206    return(output);
     207}
     208// token found end string here for now
     209*tmp = '\0';
     210
     211// Add subst content to the string
     212mr_strcat(output,subst);
     213
     214// now add the rest of in
     215tmp = strstr(in, token);
     216for (; i < strlen(token) ; i++) {
     217    tmp++;
     218}
     219mr_strcat(output,tmp);
     220return(output);
     221}
     222
    196223
    197224/*
  • branches/3.2/mondo/test/Makefile.am

    r3144 r3294  
    33## The program
    44mrtestdir                 = $(pkglibdir)/test
    5 mrtest_PROGRAMS           = mrtest_mountlist mrtest_truncname mrtest_stresc
     5mrtest_PROGRAMS           = mrtest_mountlist mrtest_truncname mrtest_stresc mrtest_str_substitute
    66mrtest_mountlist_SOURCES  = test-mountlist.c ${top_builddir}/src/mondorestore/mondo-prep.c ${top_builddir}/src/mondorestore/mondo-rstr-newt.c ${top_builddir}/src/mondorestore/mondo-rstr-tools.c
    77mrtest_mountlist_LDADD    = ${top_builddir}/src/common/libmondo.a ${top_builddir}/src/lib/libmr.a @MONDORESTORE_STATIC@
     
    1010mrtest_stresc_SOURCES     = test-mr_stresc.c
    1111mrtest_stresc_LDADD       = ${top_builddir}/src/lib/libmr.a @MONDORESTORE_STATIC@
     12mrtest_str_substitute_SOURCES = test-mr_str_substitute.c
     13mrtest_str_substitute_LDADD   = ${top_builddir}/src/lib/libmr.a @MONDORESTORE_STATIC@
  • branches/3.2/mondo/test/test-mr_stresc.c

    r3171 r3294  
    3838        int i;
    3939
    40         for (i = 1; strl[i] != NULL ; i++) {
     40        for (i = 0; strl[i] != NULL ; i++) {
    4141                printf("Test %2d Original chain is %s\n",i,strl[i]);
    4242                p = mr_stresc(strl[i], "`$\\\"(){}'[]&*?|!#~", '\\', '"');
Note: See TracChangeset for help on using the changeset viewer.