Changeset 1168 in MondoRescue for branches/stable/mondo/src/common


Ignore:
Timestamp:
Feb 15, 2007, 12:27:39 AM (18 years ago)
Author:
Bruno Cornec
Message:

strip_spaces => mr_strip_spaces in mr_str.c and corrected at the same time :-)

Location:
branches/stable/mondo/src/common
Files:
8 edited

Legend:

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

    r1164 r1168  
    12451245if=/dev/urandom bs=16 count=1 2> /dev/null | \
    12461246hexdump | tr -s ' ' '0' | head -n1"));
    1247     strip_spaces(g_serial_string);
     1247    mr_strip_spaces(g_serial_string);
    12481248    strcat(g_serial_string, "...word.");
    12491249    mr_msg(2, "g_serial_string = '%s'", g_serial_string);
  • branches/stable/mondo/src/common/libmondo-devices.c

    r1166 r1168  
    1919#include "mr_mem.h"
    2020#include "mr_msg.h"
     21#include "mr_str.h"
    2122
    2223#include <sys/ioctl.h>
     
    11081109
    11091110    FILE *pin = NULL;
    1110     bool retval;
     1111    bool retval = FALSE;
    11111112    size_t n = 0;
    11121113    assert_string_is_neither_NULL_nor_zerolength(format);
     
    11271128    if (!pin) {
    11281129        log_OS_error("Unable to read good formats");
    1129         retval = FALSE;
    11301130    } else {
    11311131        mr_getline(&good_formats, &n , pin);
     
    11331133            log_OS_error("Cannot pclose good formats");
    11341134        }
    1135         strip_spaces(good_formats);
     1135        mr_strip_spaces(good_formats);
    11361136        // " ntfs 7 " -- um, cheating much? :)
    11371137        mr_asprintf(&tmp, " %s swap lvm raid ntfs 7 ",good_formats);
     
    11411141        if (strstr(good_formats, format_sz)) {
    11421142            retval = TRUE;
    1143         } else {
    1144             retval = FALSE;
    11451143        }
    11461144        mr_free(good_formats);
     
    17041702            // check whether already mounted - we better remove
    17051703            // surrounding spaces and trailing '/' for this
    1706             /* BERLIOS: Useless
    1707             strip_spaces(bkpinfo->nfs_mount);
    1708             */
     1704            mr_strip_spaces(bkpinfo->nfs_mount);
    17091705            if (bkpinfo->nfs_mount[strlen(bkpinfo->nfs_mount) - 1] == '/')
    17101706                bkpinfo->nfs_mount[strlen(bkpinfo->nfs_mount) - 1] = '\0';
     
    17681764        mr_free(tmp);
    17691765        // check whether writable - we better remove surrounding spaces for this
    1770         strip_spaces(bkpinfo->nfs_remote_dir);
     1766        mr_strip_spaces(bkpinfo->nfs_remote_dir);
    17711767        mr_asprintf(&command, "echo hi > '%s/%s/.dummy.txt'", bkpinfo->isodir,
    17721768                bkpinfo->nfs_remote_dir);
     
    17861782            mr_free(tmp);
    17871783            // check whether writable - we better remove surrounding space s for this
    1788             strip_spaces(bkpinfo->nfs_remote_dir);
     1784            mr_strip_spaces(bkpinfo->nfs_remote_dir);
    17891785
    17901786            mr_free(command);
     
    22932289    for (mr_getline(&current_drive, &n, pdrives); !feof(pdrives);
    22942290         mr_getline(&current_drive, &n, pdrives)) {
    2295         strip_spaces(current_drive);
     2291        mr_strip_spaces(current_drive);
    22962292        log_it("looking at drive %s's MBR", current_drive);
    22972293        if (does_string_exist_in_boot_block(current_drive, "GRUB")) {
  • branches/stable/mondo/src/common/libmondo-fork.c

    r1151 r1168  
    55#include "mr_mem.h"
    66#include "mr_msg.h"
     7#include "mr_str.h"
     8
    79#include "mondostructures.h"
    810#include "libmondo-fork.h"
     
    5557        log_OS_error("Unable to popen call");
    5658    }
    57     strip_spaces(result);
     59    mr_strip_spaces(result);
    5860    mr_free(tmp);
    5961    return (result);
     
    246248            }
    247249            /* end of patch */
    248             strip_spaces(incoming);
     250            mr_strip_spaces(incoming);
    249251            if ((res == 0 && log_if_success)
    250252                || (res != 0 && log_if_failure)) {
  • branches/stable/mondo/src/common/libmondo-raid.c

    r1123 r1168  
    442442    for (fgets(incoming, MAX_STR_LEN - 1, fin); !feof(fin);
    443443         fgets(incoming, MAX_STR_LEN - 1, fin)) {
    444         strip_spaces(incoming);
     444        mr_strip_spaces(incoming);
    445445        p = strchr(incoming, ' ');
    446446        if (strlen(incoming) < 3 || incoming[0] == '#' || !p) {
  • branches/stable/mondo/src/common/libmondo-string-EXT.h

    r831 r1168  
    2727extern int strcmp_inc_numbers(char *stringA, char *stringB);
    2828extern char *strip_afio_output_line(char *input);
    29 extern void strip_spaces(char *in_out);
    3029extern char *trim_empty_quotes(char *incoming);
    3130extern char *truncate_to_drive_name(char *partition);
  • branches/stable/mondo/src/common/libmondo-string.c

    r1148 r1168  
    99#include "my-stuff.h"
    1010#include "mr_mem.h"
     11#include "mr_str.h"
     12
    1113#include "mondostructures.h"
    1214#include "libmondo-string.h"
     
    98100    for (p = in_out; *p == ' '; p++);
    99101    strcpy(scratch, p);
    100     strip_spaces (scratch);
     102    mr_strip_spaces (scratch);
    101103    len = (int) strlen(scratch);
    102104    mid = width / 2;
     
    737739
    738740
    739 
    740 /**
    741  * Remove all characters whose ASCII value is less than or equal to 32
    742  * (spaces and control characters) from both sides of @p in_out.
    743  * @param in_out The string to strip spaces/control characters from (modified).
    744  */
    745 void strip_spaces(char *in_out)
    746 {
    747     /*@ buffers ***************************************************** */
    748     char *tmp = NULL;
    749 
    750     /*@ pointers **************************************************** */
    751     char *p;
    752 
    753     /*@ int ******************************************************** */
    754     int i;
    755     int j;
    756     int original_incoming_length;
    757 
    758     /*@ end vars *************************************************** */
    759 
    760     assert(in_out != NULL);
    761     original_incoming_length = (int)strlen(in_out);
    762 
    763     for (i = 0; (in_out[i] <= ' ' || in_out[i] == '\t' || in_out[i] == '\r')
    764                     && i < original_incoming_length ; i++);
    765     for (j = 0; in_out[i] > ' ' && in_out[i] != '\t' && in_out[i] != '\r'
    766                     && i < original_incoming_length ; i++, j++) {
    767         in_out[j] = in_out[i];
    768     }
    769     in_out[j] = '\0';
    770 
    771     /* BERLIOS: Old code
    772     malloc_string(tmp);
    773     strcpy(tmp, in_out + i);
    774     for (i = (int) strlen(tmp); i > 0 && tmp[i - 1] <= 32; i--);
    775     tmp[i] = '\0';
    776     for (i = 0; i < original_incoming_length && MAX_STR_LEN; i++) {
    777         in_out[i] = ' ';
    778     }
    779     in_out[i] = '\0';
    780     i = 0;
    781     p = tmp;
    782     while (*p != '\0') {
    783         in_out[i] = *p;
    784         p++;
    785         in_out[i + 1] = '\0';
    786         if (in_out[i] < 32 && i > 0) {
    787             if (in_out[i] == 8) {
    788                 i--;
    789             } else if (in_out[i] == 9) {
    790                 in_out[i++] = ' ';
    791             } else if (in_out[i] == '\r')   // added 1st October 2003 -- FIXME
    792             {
    793                 strcpy(tmp, in_out + i);
    794                 strcpy(in_out, tmp);
    795                 i = -1;
    796                 continue;
    797             } else if (in_out[i] == '\t') {
    798                 for (i++; i % 5; i++);
    799             } else if (in_out[i] >= 10 && in_out[i] <= 13) {
    800                 break;
    801             } else {
    802                 i--;
    803             }
    804         } else {
    805             i++;
    806         }
    807     }
    808     in_out[i] = '\0';
    809     mr_free(tmp);
    810     */
    811 }
    812 
    813 
    814741/**
    815742 * If there are double quotes "" around @p incoming then remove them.
  • branches/stable/mondo/src/common/libmondo-string.h

    r831 r1168  
    2222int strcmp_inc_numbers(char *stringA, char *stringB);
    2323char *strip_afio_output_line(char *input);
    24 void strip_spaces(char *in_out);
    2524char *trim_empty_quotes(char *incoming);
    2625char *truncate_to_drive_name(char *partition);
  • branches/stable/mondo/src/common/newt-specific.c

    r1123 r1168  
    2121#include "mr_mem.h"
    2222#include "mr_msg.h"
     23#include "mr_str.h"
     24
    2325#include "mondostructures.h"
    2426#include "newt-specific.h"
     
    466468                    (void) fgets(err_log_lines[i], MAX_NEWT_COMMENT_LEN,
    467469                                 fin);
    468                     strip_spaces(err_log_lines[i]);
     470                    mr_strip_spaces(err_log_lines[i]);
    469471                    if (!strncmp(err_log_lines[i], "root:", 5)) {
    470472                        strcpy(tmp, err_log_lines[i] + 6);
     
    12591261                printf(")\n--> ");
    12601262                (void) fgets(outstr, MAX_NEWT_COMMENT_LEN, stdin);
    1261                 strip_spaces(outstr);
     1263                mr_strip_spaces(outstr);
    12621264                for (i = 0; possible_responses[i]; i++) {
    12631265                    if (!strcmp(possible_responses[i], outstr)) {
Note: See TracChangeset for help on using the changeset viewer.