summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-08-05 14:40:15 +0800
committerwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-08-05 14:40:15 +0800
commitc2dc93601dea47e4ac09fc63670bc3f8b3b39ecd (patch)
tree32e756dc47265530e5a5d0c5b8cfb39f483deec1 /util
parentacc64c7026616cd9b811a5e6f0aa3818bcbc2704 (diff)
downloadpttbbs-c2dc93601dea47e4ac09fc63670bc3f8b3b39ecd.tar
pttbbs-c2dc93601dea47e4ac09fc63670bc3f8b3b39ecd.tar.gz
pttbbs-c2dc93601dea47e4ac09fc63670bc3f8b3b39ecd.tar.bz2
pttbbs-c2dc93601dea47e4ac09fc63670bc3f8b3b39ecd.tar.lz
pttbbs-c2dc93601dea47e4ac09fc63670bc3f8b3b39ecd.tar.xz
pttbbs-c2dc93601dea47e4ac09fc63670bc3f8b3b39ecd.tar.zst
pttbbs-c2dc93601dea47e4ac09fc63670bc3f8b3b39ecd.zip
Merged from ptt2 version
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4397 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'util')
-rw-r--r--util/mandex.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/util/mandex.c b/util/mandex.c
index aeb0740c..c1eebd49 100644
--- a/util/mandex.c
+++ b/util/mandex.c
@@ -21,7 +21,7 @@ int sortbyname(const void *a, const void *b)
int k_cmp(const void *x, const void *y)
{
- boardinfo_t *b = (boardinfo_t *)x, *a = (boardinfo_t *)y;
+ const boardinfo_t *b = (boardinfo_t *)x, *a = (boardinfo_t *)y;
return ((a->k / 100 + a->ndir + a->nfile) - (b->k / 100 + b->ndir + b->nfile));
}
@@ -37,7 +37,7 @@ mandex(const int level, const char *num_header, char *fpath)
int count;
fileheader_t fhdr;
- if ((fp_dir = fopen(fpath, "r+")) == NULL)
+ if ((fp_dir = fopen(fpath, "r")) == NULL)
return;
fname = strrchr(fpath, '/') + 1;
@@ -79,7 +79,7 @@ man_index(const char * brdname)
FILE *fp_dir;
struct stat st;
fileheader_t fhdr;
- boardheader_t *bptr;
+ const boardheader_t *bptr;
if ((i = getbnum(brdname)) == 0)
return;
@@ -198,23 +198,24 @@ output_chart(const boardinfo_t * board, const int nbrds)
}
fclose(fp);
}
+static boardinfo_t board[MAX_BOARD];
+static const char dirs[] = {
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
+ 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
+ 'u', 'v', 'w', 'x', 'y', 'z',
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
+ 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
+ 'U', 'V', 'W', 'X', 'Y', 'Z', 0};
int main(int argc, char* argv[])
{
- boardinfo_t board[MAX_BOARD], *biptr;
+ boardinfo_t *biptr;
int nSorted, nb;
DIR *dirp;
struct dirent *de;
int i, fd, checkrebuild = 0;
char *fname, fpath[PATHLEN];
- char dirs[] = {
- '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
- 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
- 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
- 'u', 'v', 'w', 'x', 'y', 'z',
- 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
- 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
- 'U', 'V', 'W', 'X', 'Y', 'Z', 0};
nice(10);
while ((i = getopt(argc, argv, "xh")) != -1) {
@@ -241,11 +242,11 @@ int main(int argc, char* argv[])
argc -= optind;
argv += optind;
+ chdir(BBSHOME);
+
attach_SHM();
resolve_boards();
- chdir(BBSHOME);
-
/* process boards given in arguments */
if (argc > 0) {
for (i = 0; i < argc; i++)