Changeset da60ba9
- 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
- Files:
-
- 2 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 -
zephyr.c
re440602 rda60ba9 993 993 #ifdef HAVE_LIBZEPHYR 994 994 char *line, *subsfile; 995 int linesdeleted; 995 996 996 997 line=owl_zephyr_makesubline(class, inst, recip); … … 1003 1004 } 1004 1005 1005 owl_util_file_deleteline(subsfile, line, 1); 1006 linesdeleted = owl_util_file_deleteline(subsfile, line, 1); 1007 if (linesdeleted > 0) { 1008 owl_function_makemsg("Subscription removed"); 1009 } else { 1010 owl_function_error("No subscription present in %s", subsfile); 1011 } 1006 1012 owl_free(subsfile); 1007 1013 owl_free(line); 1008 owl_function_makemsg("Subscription removed");1009 1014 #endif 1010 1015 }
Note: See TracChangeset
for help on using the changeset viewer.