diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-06-07 05:35:23 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-06-07 05:35:23 +0800 |
commit | e8fc08b9800ba86163e5bf43469cdc9f4b478b13 (patch) | |
tree | eb2dcd75cad19ac57b7e9d9cc29c63a850d8ad86 /util/buildAnnounce.c | |
parent | c0a6419aeceaeb93d5d9ccde393236d67ff8c72f (diff) | |
download | pttbbs-e8fc08b9800ba86163e5bf43469cdc9f4b478b13.tar pttbbs-e8fc08b9800ba86163e5bf43469cdc9f4b478b13.tar.gz pttbbs-e8fc08b9800ba86163e5bf43469cdc9f4b478b13.tar.bz2 pttbbs-e8fc08b9800ba86163e5bf43469cdc9f4b478b13.tar.lz pttbbs-e8fc08b9800ba86163e5bf43469cdc9f4b478b13.tar.xz pttbbs-e8fc08b9800ba86163e5bf43469cdc9f4b478b13.tar.zst pttbbs-e8fc08b9800ba86163e5bf43469cdc9f4b478b13.zip |
only one shared memory
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@296 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'util/buildAnnounce.c')
-rw-r--r-- | util/buildAnnounce.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/util/buildAnnounce.c b/util/buildAnnounce.c index cd4b9877..1db151f9 100644 --- a/util/buildAnnounce.c +++ b/util/buildAnnounce.c @@ -1,26 +1,18 @@ /* 建立所有看板精華區的連結 */ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <sys/types.h> -#include <sys/ipc.h> -#include <sys/shm.h> -#include <sys/stat.h> -#include "config.h" -#include "pttstruct.h" -#include "proto.h" +#include "bbs.h" #define GROUPROOT BBSHOME"/man/group" -extern bcache_t *brdshm; extern boardheader_t *bcache; extern void resolve_boards(); extern int numboards; -int cmpboardclass(boardheader_t **brd, boardheader_t **tmp) { - return (strncmp((*brd)->title, (*tmp)->title, 4)<<8)+ - strcasecmp((*brd)->brdname, (*tmp)->brdname); +int cmpboardclass(const void *a, const void *b) +{ + boardheader_t **brd = (boardheader_t **)a; + boardheader_t **tmp = (boardheader_t **)b; + return (strncmp((*brd)->title, (*tmp)->title, 4)<<8)+ + strcasecmp((*brd)->brdname, (*tmp)->brdname); } void buildchilds(int level,char *path,int gid) { @@ -31,7 +23,7 @@ void buildchilds(int level,char *path,int gid) for(i=0; i<numboards; i++) { - ptr =&brdshm->bcache[i]; + ptr =&SHM->bcache[i]; if( ptr->gid != gid || (ptr->brdattr&(BRD_BAD | BRD_HIDE))!=0 @@ -41,7 +33,7 @@ void buildchilds(int level,char *path,int gid) selected[count++]=ptr; } qsort(&selected, count, sizeof(boardheader_t *), - cmpboardclass); + cmpboardclass); for(i=0;i<count;i++) { ptr=selected[i]; |