- Timestamp:
- Sep 25, 2009, 6:08:24 PM (15 years ago)
- Branches:
- master, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 7b4d90e
- Parents:
- dbe172d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
util.c
reea72a13 rda60ba9 557 557 * inefficient impelementation which reads the entire file into 558 558 * memory. 559 * 560 * Returns the number of lines removed 559 561 */ 560 voidowl_util_file_deleteline(const char *filename, const char *line, int backup)562 int owl_util_file_deleteline(const char *filename, const char *line, int backup) 561 563 { 562 564 char buff[LINE], *text; … … 564 566 FILE *file, *backupfile=NULL; 565 567 int size, newline; 568 int numremoved = 0; 566 569 567 570 /* open the file for reading */ … … 569 572 if (!file) { 570 573 owl_function_error("Error opening file %s", filename); 571 return ;574 return 0; 572 575 } 573 576 … … 580 583 owl_free(backupfilename); 581 584 fclose(file); 582 return ;585 return 0; 583 586 } 584 587 } … … 604 607 strcat(text, buff); 605 608 if (newline) strcat(text, "\n"); 609 } else { 610 numremoved++; 606 611 } 607 612 … … 628 633 owl_free(backupfilename); 629 634 owl_free(text); 635 636 return numremoved; 630 637 } 631 638
Note: See TracChangeset
for help on using the changeset viewer.