diff options
author | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-11-17 00:43:05 +0800 |
---|---|---|
committer | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-11-17 00:43:05 +0800 |
commit | 649820a64bd582ee721e2609d66538e765a844aa (patch) | |
tree | 3b66d853defc34c7b1a9098d9d204182ae4e3667 | |
parent | 8792f8321fa572f5e8749a3dc2f1d65fb16cee35 (diff) | |
download | pttbbs-649820a64bd582ee721e2609d66538e765a844aa.tar pttbbs-649820a64bd582ee721e2609d66538e765a844aa.tar.gz pttbbs-649820a64bd582ee721e2609d66538e765a844aa.tar.bz2 pttbbs-649820a64bd582ee721e2609d66538e765a844aa.tar.lz pttbbs-649820a64bd582ee721e2609d66538e765a844aa.tar.xz pttbbs-649820a64bd582ee721e2609d66538e765a844aa.tar.zst pttbbs-649820a64bd582ee721e2609d66538e765a844aa.zip |
case sensitive/insenstive option for file_delete_line, and fix friend deletion at the same time
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2328 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-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) |