diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-03-18 13:34:45 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-03-18 13:34:45 +0800 |
commit | 1c5749ba49fb18290b7ec7968df8cdca90b375eb (patch) | |
tree | 5328e14046a39192a1f5672341a9a941ab103f14 | |
parent | 410588e13587887613b61fd520bf7374c99ca351 (diff) | |
download | pttbbs-1c5749ba49fb18290b7ec7968df8cdca90b375eb.tar pttbbs-1c5749ba49fb18290b7ec7968df8cdca90b375eb.tar.gz pttbbs-1c5749ba49fb18290b7ec7968df8cdca90b375eb.tar.bz2 pttbbs-1c5749ba49fb18290b7ec7968df8cdca90b375eb.tar.lz pttbbs-1c5749ba49fb18290b7ec7968df8cdca90b375eb.tar.xz pttbbs-1c5749ba49fb18290b7ec7968df8cdca90b375eb.tar.zst pttbbs-1c5749ba49fb18290b7ec7968df8cdca90b375eb.zip |
boards/<first>/<boardname>
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@46 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | util/expire.c | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/util/expire.c b/util/expire.c index c0ebdd09..c74ac6bf 100644 --- a/util/expire.c +++ b/util/expire.c @@ -1,4 +1,4 @@ -/* $Id: expire.c,v 1.2 2002/03/09 17:44:30 in2 Exp $ */ +/* $Id: expire.c,v 1.3 2002/03/18 05:34:45 in2 Exp $ */ /* 自動砍信工具程式 */ #include <stdio.h> @@ -25,7 +25,7 @@ #define EXPIRE_CONF BBSHOME "/etc/expire.conf" extern boardheader_t *bcache; -char *bpath = BBSHOME "/boards"; +char bpath[256]; struct life { @@ -144,7 +144,15 @@ char *argv[]; life db, table[MAX_BOARD], *key; struct dirent *de; DIR *dirp; - char *ptr, *bname, buf[256]; + int i; + char *ptr, *bname, buf[256]; + char dirs[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', + 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', + 'z', 'x', 'c', 'v', 'b', 'n', 'm', + 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', + 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', + 'Z', 'X', 'C', 'V', 'B', 'N', 'M', NULL}; resolve_boards(); db.days = ((argc > 1) && (number = atoi(argv[1])) > 0) ? number : DEF_DAYS; @@ -201,27 +209,26 @@ char *argv[]; /* visit all boards */ /* ---------------- */ - if (!(dirp = opendir(bpath))) - { - printf(":Err: unable to open %s\n", bpath); - return -1; - } - - while((de = readdir(dirp))) - { - ptr = de->d_name; - if (ptr[0] > ' ' && ptr[0] != '.') - { - if (count) - key = (life *) bsearch(ptr, table, count, sizeof(life), (QCAST)strcasecmp); - else - key = NULL; - if (!key) - key = &db; - strcpy(key->bname, ptr); - expire(key); + for( i = 0 ; dirs[i] != NULL ; ++i ){ + sprintf(bpath, BBSHOME "/boards/%c", dirs[i]); + if (!(dirp = opendir(bpath))){ + printf(":Err: unable to open %s\n", bpath); + //return -1; + } + while((de = readdir(dirp))){ + ptr = de->d_name; + if (ptr[0] > ' ' && ptr[0] != '.'){ + if (count) + key = (life *) bsearch(ptr, table, count, sizeof(life), (QCAST)strcasecmp); + else + key = NULL; + if (!key) + key = &db; + strcpy(key->bname, ptr); + expire(key); + } } + closedir(dirp); } - closedir(dirp); return 0; } |