Ignore:
Timestamp:
Sep 20, 2013, 2:29:57 PM (11 years ago)
Author:
Bruno Cornec
Message:

Simplify the interface of mr_getline and mr_asprintf. With 3.1 compatibility now will allow backports from this branch into 3.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/mondo/src/common/libmondo-fifo.c

    r2519 r3185  
    8888    for (bufsize = wise_upper_limit, res = -1;
    8989         res != 0 && bufsize >= wise_lower_limit; bufsize--) {
    90         mr_asprintf(&tmp,
     90        mr_asprintf(tmp,
    9191                "dd if=/dev/zero bs=1024 count=16k 2> /dev/null | buffer -o /dev/null -s %ld -m %d%c",
    9292                internal_tape_block_size, bufsize, 'm');
     
    9696    if (!res) {
    9797        bufsize++;
    98         mr_asprintf(&tmp, "Negotiated max buffer of %d MB ", bufsize);
     98        mr_asprintf(tmp, "Negotiated max buffer of %d MB ", bufsize);
    9999        log_to_screen(tmp);
    100100        mr_free(tmp);
     
    120120    }
    121121    log_msg(2, "Calling buffer --- command = '%s'", g_sz_call_to_buffer);
    122     mr_asprintf(&sz_dir, "%c", direction);
     122    mr_asprintf(sz_dir, "%c", direction);
    123123    fres = popen(g_sz_call_to_buffer, sz_dir);
    124124    mr_free(sz_dir);
     
    132132    }
    133133    sleep(2);
    134     mr_asprintf(&tmp, "ps %s | grep \"%s\"", ps_options, g_sz_call_to_buffer);
     134    mr_asprintf(tmp, "ps %s | grep \"%s\"", ps_options, g_sz_call_to_buffer);
    135135    if (run_program_and_log_output(tmp, 2)) {
    136136        log_msg(2, "Warning - I think I failed to open tape, actually.");
     
    138138    mr_free(tmp);
    139139    g_tape_buffer_size_MB = bufsize;
    140     mr_asprintf(&command, "ps %s | grep buffer | grep -v grep", ps_options);
     140    mr_asprintf(command, "ps %s | grep buffer | grep -v grep", ps_options);
    141141    if (run_program_and_log_output(command, 1)) {
    142142        fres = NULL;
     
    167167    }
    168168    paranoid_system("sync");
    169     mr_asprintf(&command, "ps %s | grep -F \"%s\" | grep -Fv grep | awk '{print $2;}' | grep -v PID | head -1", ps_options, g_sz_call_to_buffer);
     169    mr_asprintf(command, "ps %s | grep -F \"%s\" | grep -Fv grep | awk '{print $2;}' | grep -v PID | head -1", ps_options, g_sz_call_to_buffer);
    170170    log_msg(2, "kill_buffer() --- command = %s", command);
    171     mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     171    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    172172    mr_free(command);
    173173
    174     mr_asprintf(&command, "kill %s", tmp);
     174    mr_asprintf(command, "kill %s", tmp);
    175175    log_msg(2, "kill_buffer() --- command = %s", command);
    176176    if (strlen(tmp) > 0) {
Note: See TracChangeset for help on using the changeset viewer.