Changeset 3194 in MondoRescue for branches/3.2/mondo/src/common/libmondo-files.c
- Timestamp:
- Sep 29, 2013, 7:27:11 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/mondo/src/common/libmondo-files.c
r3191 r3194 291 291 log_it("Calling Mindi with kernel path of '%s'", kernel); 292 292 while (!kernel[0]) { 293 if (!ask_me_yes_or_no 294 ("Kernel not found or invalid. Choose another?")) { 293 if (!ask_me_yes_or_no("Kernel not found or invalid. Choose another?")) { 295 294 return (1); 296 295 } 297 if (!popup_and_get_string 298 ("Kernel path", 299 "What is the full path and filename of your kernel, please?", 300 kernel, MAX_STR_LEN / 4)) { 301 fatal_error 302 ("Kernel not found. Please specify with the '-k' flag."); 296 if (!popup_and_get_string("Kernel path", "What is the full path and filename of your kernel, please?", kernel, MAX_STR_LEN / 4)) { 297 fatal_error("Kernel not found. Please specify with the '-k' flag."); 303 298 } 304 299 log_it("User says kernel is at %s", kernel); … … 335 330 mr_free(incoming); 336 331 output[0] = '\0'; 337 return 332 return(NULL); // forget it :) 338 333 } 339 334 mr_asprintf(command, "file %s 2> /dev/null | cut -d':' -f1 2> /dev/null", incoming); 340 mr_free(incomi g);335 mr_free(incoming); 341 336 342 337 mr_asprintf(incoming, "%s", call_program_and_get_last_line_of_output(command)); … … 352 347 strcpy(output, incoming); 353 348 if (output[0] != '\0' && does_file_exist(output)) { 354 log_msg(4, "find_home_of_exe ()--- Found %s at %s", fname, incoming);349 log_msg(4, "find_home_of_exe --- Found %s at %s", fname, incoming); 355 350 } else { 356 351 output[0] = '\0'; 357 log_msg(4, "find_home_of_exe ()--- Could not find %s", fname);352 log_msg(4, "find_home_of_exe --- Could not find %s", fname); 358 353 } 359 354 mr_free(incoming); 360 355 if (!output[0]) { 361 return 356 return(NULL); 362 357 } else { 363 return 358 return(output); 364 359 } 365 360 } … … 433 428 if (!lastline[0]) { 434 429 mr_free(lastline); 435 return 430 return(0); 436 431 } 437 432 } else { … … 444 439 } else { 445 440 mr_free(lastline); 446 return 441 return(0); 447 442 } 448 443 … … 453 448 i = atoi(p); 454 449 mr_free(lastline); 455 return 450 return(i); 456 451 } 457 452 … … 471 466 static char output[MAX_STR_LEN]; 472 467 char *command = NULL; 468 char *p = NULL; 473 469 474 470 /*@ pointers **************************************************** */ … … 478 474 479 475 if (!does_file_exist(filename)) { 480 log_it("Tr ing to get last line of nonexistent file (%s)", filename);476 log_it("Trying to get last line of nonexistent file (%s)", filename); 481 477 output[0] = '\0'; 482 478 return (output); … … 493 489 output[strlen(output) - 1] = '\0'; 494 490 } 495 return 491 return(output); 496 492 } 497 493 … … 513 509 log_it("filename=%s", filename); 514 510 log_OS_error("Unable to openin filename"); 515 return 511 return(-1); 516 512 } 517 513 fseeko(fin, 0, SEEK_END); 518 514 length = ftello(fin); 519 515 paranoid_fclose(fin); 520 return 516 return(length); 521 517 } 522 518 … … 561 557 log_OS_error("Unable to fopen-in filelist"); 562 558 log_to_screen("Can't open filelist"); 563 return 559 return(1); 564 560 } 565 561 fout = fopen(cksumlist, "w"); … … 568 564 paranoid_fclose(fin); 569 565 log_to_screen("Can't open checksum list"); 570 return 566 return(1); 571 567 } 572 568 for (mr_getline(stub_fname, fin); !feof(fin); mr_getline(stub_fname, fin)) { 573 if (stub_fname[(i = strlen(stub_fname) - 1)] < 32) { 569 i = strlen(stub_fname) - 1; 570 if (stub_fname[i] < 32) { 574 571 stub_fname[i] = '\0'; 575 572 } … … 605 602 paranoid_fclose(fin); 606 603 log_it("Done."); 607 return 604 return(0); 608 605 } 609 606 … … 623 620 res = system(tmp); 624 621 mr_free(tmp); 625 return 622 return(res); 626 623 } 627 624 … … 659 656 660 657 unlink(outfile_fname); 661 return 658 return(0); 662 659 } 663 660 … … 687 684 if (!fin) { 688 685 log_OS_error("Unable to openin filelist_fname"); 689 return 686 return(0); 690 687 } 691 688 mr_getline(incoming, fin); … … 699 696 mr_free(incoming); 700 697 paranoid_fclose(fin); 701 return 698 return(matches); 702 699 } 703 700 … … 728 725 mr_free(command); 729 726 730 return 727 return(file_len_K); 731 728 } 732 729 … … 806 803 paranoid_fclose(fin); 807 804 log_it("Finished calculating total size of all biggiefiles"); 808 return 805 return(scratchL); 809 806 } 810 807 … … 848 845 mr_free(command); 849 846 850 return 847 return(llres); 851 848 } 852 849 … … 864 861 tmp = (crc >> 8) ^ c; 865 862 crc = (crc << 8) ^ crctttab[tmp & 255]; 866 return crc;863 return(crc); 867 864 } 868 865 … … 879 876 tmp = crc ^ c; 880 877 crc = (crc >> 8) ^ crc16tab[tmp & 0xff]; 881 return crc;878 return(crc); 882 879 } 883 880 … … 905 902 log_to_screen("There may be hyperlink at http://www.mondorescue.org which"); 906 903 log_to_screen("will take you to the relevant (missing) package."); 907 return 904 return(1); 908 905 } else { 909 return 906 return(0); 910 907 } 911 908 } … … 969 966 log_it("fname=%s", fname); 970 967 log_OS_error("Unable to openin fname"); 971 return 968 return(1); 972 969 } 973 970 res = fscanf(fin, "%s\n", contents); … … 978 975 paranoid_fclose(fin); 979 976 res = 0; 980 return (res); 981 } 982 983 984 977 return(res); 978 } 985 979 986 980 … … 1084 1078 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 1085 1079 } 1086 1087 1088 1089 1080 1090 1081 … … 1115 1106 char *p; 1116 1107 1117 if ( ! bkpinfo->netfs_mount) {1108 if (bkpinfo->netfs_mount == NULL) { 1118 1109 fatal_error("No netfs_mount found !"); 1119 1110 } … … 1152 1143 1153 1144 mr_asprintf(command, "ifconfig %s | head -1 | awk '{print $5}'", netfs_dev); 1154 mr_asprintf(netfs_client_hwaddr, "%s" call_program_and_get_last_line_of_output(command));1145 mr_asprintf(netfs_client_hwaddr, "%s", call_program_and_get_last_line_of_output(command)); 1155 1146 mr_free(command); 1156 1147 … … 1229 1220 mr_free(tmp); 1230 1221 1231 sprintf(tmp, "%s/NETFS-PROTO", bkpinfo->tmpdir);1222 mr_asprintf(tmp, "%s/NETFS-PROTO", bkpinfo->tmpdir); 1232 1223 write_one_liner_data_file(tmp, bkpinfo->netfs_proto); 1233 1224 mr_free(tmp);
Note:
See TracChangeset
for help on using the changeset viewer.