Changeset 2331 in MondoRescue for branches/2.2.10/mondo/src/common/libmondo-stream.c
- Timestamp:
- Aug 18, 2009, 3:25:29 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-stream.c
r2325 r2331 256 256 257 257 log_to_screen("I am looking for your tape streamer. Please wait."); 258 if (find_home_of_exe("cdrecord")) { 259 mr_asprintf(&cdr_exe, "cdrecord"); 260 } else { 261 mr_asprintf(&cdr_exe, "dvdrecord"); 262 } 258 tmp = find_home_of_exe("cdrecord"); 259 if (tmp) { 260 mr_asprintf(cdr_exe, "cdrecord"); 261 } else { 262 mr_asprintf(cdr_exe, "dvdrecord"); 263 } 264 mr_free(tmp); 265 263 266 mr_asprintf(command, "%s -scanbus 2> /dev/null | grep -i tape | wc -l", cdr_exe); 264 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));267 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 265 268 mr_free(command); 266 269 … … 269 272 mr_asprintf(&dev, "%s", VANILLA_SCSI_TAPE); 270 273 mr_free(tmp); 274 mr_free(tmp); 271 275 return(dev); 272 276 } … … 274 278 275 279 mr_asprintf(command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | cut -d' ' -f2 | head -n1", cdr_exe); 276 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));280 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 277 281 mr_free(command); 278 282 … … 280 284 log_it("Could not find tape device"); 281 285 mr_free(tmp); 282 return( dev);286 return(NULL); 283 287 } 284 288 mr_free(tmp); 289 285 290 mr_asprintf(command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | cut -d' ' -f3 | cut -d')' -f1 | head -n1", cdr_exe); 286 291 mr_free(cdr_exe); 287 292 288 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));293 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 289 294 mr_free(command); 290 291 295 292 296 mr_asprintf(dev, "%s", "/dev/st"); 293 297 mr_strcat(dev, tmp); // e.g. '/dev/st0' becomes '/dev/stN' 294 298 mr_free(tmp); 299 295 300 res = 0; 296 301 if (!mt_says_tape_exists(dev)) { … … 321 326 } 322 327 323 mr_asprintf( &tmp, call_program_and_get_last_line_of_output("cdrecord -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE |awk '{for(i=1; i<NF; i++) { if (index($i, \"GB\")>0) { print $i;};};};'"));328 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(" cdrecord -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | awk '{for(i=1; i<NF; i++) { if (index($i, \"GB\")>0) { print $i;};};};'")); 324 329 325 330 if (mt_says_tape_exists(dev)) { … … 328 333 log_it("Turning %s", dev); 329 334 mr_free(tmp); 330 mr_asprintf( &tmp, (strrchr(dev, '/') != NULL) ? strrchr(dev, '/') : dev);335 mr_asprintf(tmp, "%s", (strrchr(dev, '/') != NULL) ? strrchr(dev, '/') : dev); 331 336 mr_free(dev); 332 337 mr_asprintf(&dev, "/dev/os%s", tmp); … … 342 347 log_it("res=%d; dev=%s", res, dev); 343 348 344 if (res) { 349 if (dev) { 350 log_it("At this new point, dev = %s and res = %d", dev, res); 351 } else { 352 log_it("At this new point, dev is NULL and res = %d", dev, res); 345 353 mr_free(tmp); 346 return (dev);354 return(NULL); 347 355 } 348 356 … … 351 359 } 352 360 mr_free(tmp); 353 return (NULL);361 return(dev); 354 362 } 355 363
Note:
See TracChangeset
for help on using the changeset viewer.