Changeset 1168 in MondoRescue for branches/stable/mondo/src/common
- Timestamp:
- Feb 15, 2007, 12:27:39 AM (18 years ago)
- Location:
- branches/stable/mondo/src/common
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/src/common/libmondo-archive.c
r1164 r1168 1245 1245 if=/dev/urandom bs=16 count=1 2> /dev/null | \ 1246 1246 hexdump | tr -s ' ' '0' | head -n1")); 1247 strip_spaces(g_serial_string);1247 mr_strip_spaces(g_serial_string); 1248 1248 strcat(g_serial_string, "...word."); 1249 1249 mr_msg(2, "g_serial_string = '%s'", g_serial_string); -
branches/stable/mondo/src/common/libmondo-devices.c
r1166 r1168 19 19 #include "mr_mem.h" 20 20 #include "mr_msg.h" 21 #include "mr_str.h" 21 22 22 23 #include <sys/ioctl.h> … … 1108 1109 1109 1110 FILE *pin = NULL; 1110 bool retval ;1111 bool retval = FALSE; 1111 1112 size_t n = 0; 1112 1113 assert_string_is_neither_NULL_nor_zerolength(format); … … 1127 1128 if (!pin) { 1128 1129 log_OS_error("Unable to read good formats"); 1129 retval = FALSE;1130 1130 } else { 1131 1131 mr_getline(&good_formats, &n , pin); … … 1133 1133 log_OS_error("Cannot pclose good formats"); 1134 1134 } 1135 strip_spaces(good_formats);1135 mr_strip_spaces(good_formats); 1136 1136 // " ntfs 7 " -- um, cheating much? :) 1137 1137 mr_asprintf(&tmp, " %s swap lvm raid ntfs 7 ",good_formats); … … 1141 1141 if (strstr(good_formats, format_sz)) { 1142 1142 retval = TRUE; 1143 } else {1144 retval = FALSE;1145 1143 } 1146 1144 mr_free(good_formats); … … 1704 1702 // check whether already mounted - we better remove 1705 1703 // surrounding spaces and trailing '/' for this 1706 /* BERLIOS: Useless 1707 strip_spaces(bkpinfo->nfs_mount); 1708 */ 1704 mr_strip_spaces(bkpinfo->nfs_mount); 1709 1705 if (bkpinfo->nfs_mount[strlen(bkpinfo->nfs_mount) - 1] == '/') 1710 1706 bkpinfo->nfs_mount[strlen(bkpinfo->nfs_mount) - 1] = '\0'; … … 1768 1764 mr_free(tmp); 1769 1765 // 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); 1771 1767 mr_asprintf(&command, "echo hi > '%s/%s/.dummy.txt'", bkpinfo->isodir, 1772 1768 bkpinfo->nfs_remote_dir); … … 1786 1782 mr_free(tmp); 1787 1783 // 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); 1789 1785 1790 1786 mr_free(command); … … 2293 2289 for (mr_getline(¤t_drive, &n, pdrives); !feof(pdrives); 2294 2290 mr_getline(¤t_drive, &n, pdrives)) { 2295 strip_spaces(current_drive);2291 mr_strip_spaces(current_drive); 2296 2292 log_it("looking at drive %s's MBR", current_drive); 2297 2293 if (does_string_exist_in_boot_block(current_drive, "GRUB")) { -
branches/stable/mondo/src/common/libmondo-fork.c
r1151 r1168 5 5 #include "mr_mem.h" 6 6 #include "mr_msg.h" 7 #include "mr_str.h" 8 7 9 #include "mondostructures.h" 8 10 #include "libmondo-fork.h" … … 55 57 log_OS_error("Unable to popen call"); 56 58 } 57 strip_spaces(result);59 mr_strip_spaces(result); 58 60 mr_free(tmp); 59 61 return (result); … … 246 248 } 247 249 /* end of patch */ 248 strip_spaces(incoming);250 mr_strip_spaces(incoming); 249 251 if ((res == 0 && log_if_success) 250 252 || (res != 0 && log_if_failure)) { -
branches/stable/mondo/src/common/libmondo-raid.c
r1123 r1168 442 442 for (fgets(incoming, MAX_STR_LEN - 1, fin); !feof(fin); 443 443 fgets(incoming, MAX_STR_LEN - 1, fin)) { 444 strip_spaces(incoming);444 mr_strip_spaces(incoming); 445 445 p = strchr(incoming, ' '); 446 446 if (strlen(incoming) < 3 || incoming[0] == '#' || !p) { -
branches/stable/mondo/src/common/libmondo-string-EXT.h
r831 r1168 27 27 extern int strcmp_inc_numbers(char *stringA, char *stringB); 28 28 extern char *strip_afio_output_line(char *input); 29 extern void strip_spaces(char *in_out);30 29 extern char *trim_empty_quotes(char *incoming); 31 30 extern char *truncate_to_drive_name(char *partition); -
branches/stable/mondo/src/common/libmondo-string.c
r1148 r1168 9 9 #include "my-stuff.h" 10 10 #include "mr_mem.h" 11 #include "mr_str.h" 12 11 13 #include "mondostructures.h" 12 14 #include "libmondo-string.h" … … 98 100 for (p = in_out; *p == ' '; p++); 99 101 strcpy(scratch, p); 100 strip_spaces (scratch);102 mr_strip_spaces (scratch); 101 103 len = (int) strlen(scratch); 102 104 mid = width / 2; … … 737 739 738 740 739 740 /**741 * Remove all characters whose ASCII value is less than or equal to 32742 * (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 code772 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 -- FIXME792 {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 814 741 /** 815 742 * If there are double quotes "" around @p incoming then remove them. -
branches/stable/mondo/src/common/libmondo-string.h
r831 r1168 22 22 int strcmp_inc_numbers(char *stringA, char *stringB); 23 23 char *strip_afio_output_line(char *input); 24 void strip_spaces(char *in_out);25 24 char *trim_empty_quotes(char *incoming); 26 25 char *truncate_to_drive_name(char *partition); -
branches/stable/mondo/src/common/newt-specific.c
r1123 r1168 21 21 #include "mr_mem.h" 22 22 #include "mr_msg.h" 23 #include "mr_str.h" 24 23 25 #include "mondostructures.h" 24 26 #include "newt-specific.h" … … 466 468 (void) fgets(err_log_lines[i], MAX_NEWT_COMMENT_LEN, 467 469 fin); 468 strip_spaces(err_log_lines[i]);470 mr_strip_spaces(err_log_lines[i]); 469 471 if (!strncmp(err_log_lines[i], "root:", 5)) { 470 472 strcpy(tmp, err_log_lines[i] + 6); … … 1259 1261 printf(")\n--> "); 1260 1262 (void) fgets(outstr, MAX_NEWT_COMMENT_LEN, stdin); 1261 strip_spaces(outstr);1263 mr_strip_spaces(outstr); 1262 1264 for (i = 0; possible_responses[i]; i++) { 1263 1265 if (!strcmp(possible_responses[i], outstr)) {
Note:
See TracChangeset
for help on using the changeset viewer.