Changeset 3614 in MondoRescue for branches/3.2/mondo/src/common


Ignore:
Timestamp:
Nov 18, 2016, 5:31:43 PM (8 years ago)
Author:
Bruno Cornec
Message:

mr_strip_spaces now returns a dynamically allocated string

Location:
branches/3.2/mondo/src/common
Files:
5 edited

Legend:

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

    r3610 r3614  
    2424#include "libmondo-stream-EXT.h"
    2525
    26 extern void mr_strip_spaces(char *);
    27 
    28 #include <sys/types.h>
    2926#ifdef __FreeBSD__
    3027#define DKTYPENAMES
     
    10401037    } else {
    10411038        mr_getline(p, pin);
    1042         mr_asprintf(good_formats, " %s",p);
     1039        good_formats = mr_strip_spaces(p);
    10431040        mr_free(p);
    10441041        (void)pclose(pin);
    1045         mr_strip_spaces(good_formats);
    10461042        mr_strcat(good_formats, " swap lvm raid ntfs-3g ntfs 7 ");  // " ntfs 7 " -- um, cheating much? :)
    10471043        if (strstr(good_formats, format_sz)) {
     
    24612457            }
    24622458            mr_free(bkpinfo->netfs_mount);
    2463             mr_asprintf(bkpinfo->netfs_mount, "%s", p);
     2459            // check whether already mounted - we better remove
     2460            // surrounding spaces and trailing '/' for this
     2461            bkpinfo->netfs_mount = mr_strip_spaces(p);
    24642462            if (!bkpinfo->restore_data) {
    24652463                if ((compression_type = which_compression_type()) == NULL) {
     
    24732471                }
    24742472            }
    2475             // check whether already mounted - we better remove
    2476             // surrounding spaces and trailing '/' for this
    2477             mr_strip_spaces(bkpinfo->netfs_mount);
    24782473            if (bkpinfo->netfs_mount[strlen(bkpinfo->netfs_mount) - 1] == '/')
    24792474                bkpinfo->netfs_mount[strlen(bkpinfo->netfs_mount) - 1] = '\0';
     
    26072602        }
    26082603        mr_free(bkpinfo->netfs_remote_dir);
    2609         mr_asprintf(bkpinfo->netfs_remote_dir, "%s", tmp1);
    2610 
    26112604        // check whether writable - we better remove surrounding spaces for this
    2612         mr_strip_spaces(bkpinfo->netfs_remote_dir);
     2605        bkpinfo->netfs_remote_dir = mr_strip_spaces(tmp1);
    26132606
    26142607        if (!popup_and_get_string("Prefix.", "Please enter the prefix that will be prepended to your ISO filename.  Example: machine1 to obtain machine1-[1-9]*.iso files", bkpinfo->prefix, MAX_STR_LEN / 4)) {
  • branches/3.2/mondo/src/common/libmondo-fork-EXT.h

    r1999 r3614  
    11/* libmondo-fork-EXT.h */
    22
    3 extern char *call_program_and_get_last_line_of_output(char *call);
     3extern char *call_program_and_get_last_line_of_output(const char *call);
    44extern int run_program_and_log_to_screen(char *basic_call,
    55                                         char *what_i_am_doing);
  • branches/3.2/mondo/src/common/libmondo-raid.c

    r3610 r3614  
    426426    char *incoming = NULL;
    427427    char *p = NULL;
     428    char *res = NULL;
    428429
    429430    assert(fin != NULL);
     
    433434    }
    434435
    435     for (mr_getline(incoming, fin); !feof(fin); mr_getline(incoming, fin)) {
    436         log_msg(10,"Found in raidtab line: %s",incoming);
    437         mr_strip_spaces(incoming);
     436    for (mr_getline(res, fin); !feof(fin); mr_getline(res, fin)) {
     437        log_msg(10,"Found in raidtab line: %s",res);
     438        incoming = mr_strip_spaces(res);
     439        mr_free(res);
    438440        p = strchr(incoming, ' ');
    439441        if (strlen(incoming) < 3 || incoming[0] == '#' || !p) {
  • branches/3.2/mondo/src/common/libmondo-string.c

    r3611 r3614  
    9292    }
    9393    /*  skip initial spaces */
    94     mr_asprintf(scratch, "%s", in);
    95     mr_strip_spaces(scratch);
     94    scratch = mr_strip_spaces(in);
    9695    len = (int)strlen(scratch);
    9796    mid = width / 2;
  • branches/3.2/mondo/src/common/newt-specific.c

    r3508 r3614  
    12341234        static char *possible_responses[] = { "none", "cdr", "cdrw", "dvd", "tape", "cdstream", "udev", "netfs", "iso", NULL };
    12351235        char *outstr = NULL;
     1236        char *instr = NULL;
    12361237        t_bkptype backup_type;
    12371238        int i;
     
    12561257                }
    12571258                printf(")\n--> ");
    1258                 mr_getline(outstr, stdin);
    1259                 mr_strip_spaces(outstr);
     1259                mr_getline(instr, stdin);
     1260                outstr = mr_strip_spaces(instr);
     1261                mr_free(instr);
    12601262                for (i = 0; possible_responses[i]; i++) {
    12611263                    if (!strcmp(possible_responses[i], outstr)) {
Note: See TracChangeset for help on using the changeset viewer.