diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-09-11 22:48:28 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-09-11 22:48:28 +0800 |
commit | 3799b481afbc1b90f4600368b7c9cc615db4d956 (patch) | |
tree | 03e390211b1c2bbecc8d9a8853c93ccadc91ded3 | |
parent | 540cfa70e8e8b4db3cc2addccfcbeeb69fffa033 (diff) | |
download | pttbbs-3799b481afbc1b90f4600368b7c9cc615db4d956.tar pttbbs-3799b481afbc1b90f4600368b7c9cc615db4d956.tar.gz pttbbs-3799b481afbc1b90f4600368b7c9cc615db4d956.tar.bz2 pttbbs-3799b481afbc1b90f4600368b7c9cc615db4d956.tar.lz pttbbs-3799b481afbc1b90f4600368b7c9cc615db4d956.tar.xz pttbbs-3799b481afbc1b90f4600368b7c9cc615db4d956.tar.zst pttbbs-3799b481afbc1b90f4600368b7c9cc615db4d956.zip |
ignore \e and \b in title
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2190 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | util/buildir.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/util/buildir.c b/util/buildir.c index 6b0917e7..cc69f57e 100644 --- a/util/buildir.c +++ b/util/buildir.c @@ -15,7 +15,8 @@ int mysort(const void *a, const void *b) return atoi(((*((struct dirent **)a))->d_name+2))-atoi(((*((struct dirent **)b))->d_name+2)); } -int main(int argc, char **argv) { +int main(int argc, char **argv) +{ int k; if(argc < 2) { @@ -90,11 +91,17 @@ int main(int argc, char **argv) { while(fgets(buf, sizeof(buf), fp)) if(strncmp(buf, "標題: ", 6) == 0 || strncmp(buf, "標 題: ", 8) == 0) { - for(i = 5; buf[i] != ' '; i++); - for(; buf[i] == ' '; i++); - strtok(buf + i-1, "\n"); + for( i = 5 ; buf[i] != ' ' ; ++i ) + ; + for( ; buf[i] == ' ' ; ++i ) + ; + strtok(buf + i - 1, "\n"); strncpy(fhdr.title, buf + i, TTLEN); fhdr.title[TTLEN] = '\0'; + for( i = 0 ; fhdr.title[i] != 0 ; ++i ) + if( fhdr.title[i] == '\e' || + fhdr.title[i] == '\b' ) + fhdr.title[i] = ' '; break; } } else if(strncmp(buf, "☉ 歡迎光臨", 11) == 0) { |