diff options
-rw-r--r-- | mbbsd/file.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/mbbsd/file.c b/mbbsd/file.c index 8816776d..7d3518c9 100644 --- a/mbbsd/file.c +++ b/mbbsd/file.c @@ -30,7 +30,7 @@ int file_append_line(char *file, char *string) #ifndef _BBS_UTIL_C_ /* Rename() is in kaede.c but not linked to util/ */ -int file_delete_line(char *file, char *string) +int file_delete_line(char *file, char *string, char case_sensitive) { FILE *fp, *nfp = NULL; char fnew[80]; @@ -41,8 +41,11 @@ int file_delete_line(char *file, char *string) int length = strlen(string); while (fgets(genbuf, sizeof(genbuf), fp)) - if ((genbuf[0] > ' ') && strncmp(genbuf, string, length)) - fputs(genbuf, nfp); + if ((genbuf[0] > ' ')) { + if (((case_sensitive && strncmp(genbuf, string, length)) || + (!case_sensitive && strncasecmp(genbuf, string, length)))) + fputs(genbuf, nfp); + } Rename(fnew, file); } if(fp) |