Changeset 353 in MondoRescue for branches/stable/monitas/from-mondo.c
- Timestamp:
- Jan 28, 2006, 6:42:59 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/monitas/from-mondo.c
r352 r353 8 8 9 9 10 extern void log_it_SUB(char*, t_loglevel, char*);10 //extern void log_it_SUB(char*, t_loglevel, char*); 11 11 char *call_program_and_get_last_line_of_output(char*); 12 12 int call_program_and_log_output (char *); … … 17 17 18 18 19 extern char g_logfile[MAX_STR_LEN+1];20 19 21 20 … … 215 214 /************************************************************************* 216 215 * strip_spaces() -- Hugo Rabson * 217 * * 218 * Purpose: * 216 * rewitten Stefan Huebner * 217 * * 218 * Purpose: remove leading whitespaces and control characters, replace * 219 * TABs by SPACES, remove previous char when followed with BS,* 220 * skip control chars, terminate string with '\0' when CR or * 221 * NL is detected * 222 * afterwards remove trailing whitespace * 219 223 * Called by: * 220 224 * Returns: * … … 223 227 strip_spaces (char *in_out) 224 228 { 229 char *r, *w; 230 r = w = in_out; // initialize read and write pointer 231 232 while ( *r && *r <= ' ' ) 233 ++r; // skip leading whitespace and control chars 234 235 for ( ; *r ; ++r ) // until end of existing string do: 236 { 237 if (*r == '\t') // TAB 238 { *w++ = ' '; // write SPACE instead 239 continue; } 240 if (*r == (char) 8) // BACKSPACE 241 { if (w > in_out) --w; // remove previous character (if any ;-) 242 continue; } 243 if (*r == '\n' || *r == '\r') // CR and LF 244 break; // terminate copying 245 if (*r < ' ') // Control chars 246 continue; // are ignored (skipped) 247 *w++ = *r; // all other chars are copied 248 } 249 // all characters are copied 250 *w = '\0'; // terminate the copied string 251 for (--w; w>in_out && *w == ' '; --w) 252 *w = '\0'; // remove trailing whitespaces 253 return; 225 254 /** buffers ******************************************************/ 226 char tmp[MAX_STR_LEN+1];255 // char tmp[MAX_STR_LEN+1]; 227 256 228 257 /** pointers *****************************************************/ 229 char *p;258 // char *p; 230 259 231 260 /** int *********************************************************/ 232 int i;261 // int i; 233 262 234 263 /** end vars ****************************************************/ 235 for (i = 0; in_out[i] <= ' ' && i < strlen (in_out); i++);264 /* for (i = 0; in_out[i] <= ' ' && i < strlen (in_out); i++); 236 265 strcpy (tmp, in_out + i); 237 266 for (i = strlen (tmp); i>0 && tmp[i - 1] <= 32; i--); … … 277 306 } 278 307 in_out[i] = '\0'; 308 */ 279 309 /* for(i=strlen(in_out); i>0 && in_out[i-1]<=32; i--) {in_out[i-1]='\0';} */ 280 310 }
Note:
See TracChangeset
for help on using the changeset viewer.