From 3799b481afbc1b90f4600368b7c9cc615db4d956 Mon Sep 17 00:00:00 2001 From: in2 Date: Sat, 11 Sep 2004 14:48:28 +0000 Subject: ignore \e and \b in title git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2190 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- util/buildir.c | 15 +++++++++++---- 1 file 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) { -- cgit v1.2.3