diff options
author | wens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-01-31 10:24:04 +0800 |
---|---|---|
committer | wens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-01-31 10:24:04 +0800 |
commit | 5cc73c88533fc91678213ac27ff3512ceb4b3178 (patch) | |
tree | 1b847d5f4f7b560866a2a9ee11e86bfa0618885b /innbbsd | |
parent | 9d5f00a692abfe6ba859ebf75c3a0138a7adde35 (diff) | |
download | pttbbs-5cc73c88533fc91678213ac27ff3512ceb4b3178.tar pttbbs-5cc73c88533fc91678213ac27ff3512ceb4b3178.tar.gz pttbbs-5cc73c88533fc91678213ac27ff3512ceb4b3178.tar.bz2 pttbbs-5cc73c88533fc91678213ac27ff3512ceb4b3178.tar.lz pttbbs-5cc73c88533fc91678213ac27ff3512ceb4b3178.tar.xz pttbbs-5cc73c88533fc91678213ac27ff3512ceb4b3178.tar.zst pttbbs-5cc73c88533fc91678213ac27ff3512ceb4b3178.zip |
Fix compile warnings
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4434 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'innbbsd')
-rw-r--r-- | innbbsd/bbslib.c | 16 | ||||
-rw-r--r-- | innbbsd/echobbslib.c | 16 | ||||
-rw-r--r-- | innbbsd/innbbsd.c | 20 | ||||
-rw-r--r-- | innbbsd/receive_article.c | 33 |
4 files changed, 43 insertions, 42 deletions
diff --git a/innbbsd/bbslib.c b/innbbsd/bbslib.c index 3ec5cf6d..1bc0db3c 100644 --- a/innbbsd/bbslib.c +++ b/innbbsd/bbslib.c @@ -258,42 +258,42 @@ initial_bbs(char *outgoing) } static int -nf_byboardcmp(newsfeeds_t **a, newsfeeds_t **b) +nf_byboardcmp(const void *a, const void *b) { /* * if (!a || !*a || !(*a)->board) return -1; if (!b || !*b || * !(*b)->board) return 1; */ - return strcasecmp((*a)->board, (*b)->board); + return strcasecmp((*((const newsfeeds_t **)a))->board, (*((const newsfeeds_t **)b))->board); } static int -nfcmp(newsfeeds_t *a, newsfeeds_t *b) +nfcmp(const void *a, const void *b) { /* * if (!a || !a->newsgroups) return -1; if (!b || !b->newsgroups) return * 1; */ - return strcasecmp(a->newsgroups, b->newsgroups); + return strcasecmp(((const newsfeeds_t *)a)->newsgroups, ((const newsfeeds_t *)b)->newsgroups); } static int -nlcmp(nodelist_t *a, nodelist_t *b) +nlcmp(const void *a, const void *b) { /* * if (!a || !a->host) return -1; if (!b || !b->host) return 1; */ - return strcasecmp(a->host, b->host); + return strcasecmp(((const nodelist_t *)a)->host, ((const nodelist_t *)b)->host); } static int -nl_bynodecmp(nodelist_t **a, nodelist_t **b) +nl_bynodecmp(const void *a, const void *b) { /* * if (!a || !*a || !(*a)->node) return -1; if (!b || !*b || !(*b)->node) * return 1; */ - return strcasecmp((*a)->node, (*b)->node); + return strcasecmp((*((const nodelist_t **)a))->node, (*((const nodelist_t **)b))->node); } /* read in newsfeeds.bbs and nodelist.bbs */ diff --git a/innbbsd/echobbslib.c b/innbbsd/echobbslib.c index 44f7739c..7a82f417 100644 --- a/innbbsd/echobbslib.c +++ b/innbbsd/echobbslib.c @@ -257,42 +257,42 @@ initial_bbs(char *outgoing) } static int -nf_byboardcmp(newsfeeds_t **a, newsfeeds_t **b) +nf_byboardcmp(const void *a, const void *b) { /* * if (!a || !*a || !(*a)->board) return -1; if (!b || !*b || * !(*b)->board) return 1; */ - return strcasecmp((*a)->board, (*b)->board); + return strcasecmp((*((const newsfeeds_t **)a))->board, (*((const newsfeeds_t **)b))->board); } static int -nfcmp(newsfeeds_t *a, newsfeeds_t *b) +nfcmp(const void *a, const void *b) { /* * if (!a || !a->newsgroups) return -1; if (!b || !b->newsgroups) return * 1; */ - return strcasecmp(a->newsgroups, b->newsgroups); + return strcasecmp(((const newsfeeds_t *)a)->newsgroups, ((const newsfeeds_t *)b)->newsgroups); } static int -nlcmp(nodelist_t *a, nodelist_t *b) +nlcmp(const void *a, const void *b) { /* * if (!a || !a->host) return -1; if (!b || !b->host) return 1; */ - return strcasecmp(a->host, b->host); + return strcasecmp(((const nodelist_t *)a)->host, ((const nodelist_t *)b)->host); } static int -nl_bynodecmp(nodelist_t **a, nodelist_t **b) +nl_bynodecmp(const void *a, const void *b) { /* * if (!a || !*a || !(*a)->node) return -1; if (!b || !*b || !(*b)->node) * return 1; */ - return strcasecmp((*a)->node, (*b)->node); + return strcasecmp((*((const nodelist_t **)a))->node, (*((const nodelist_t **)b))->node); } /* read in newsfeeds.bbs and nodelist.bbs */ diff --git a/innbbsd/innbbsd.c b/innbbsd/innbbsd.c index fc3625ad..e457ff76 100644 --- a/innbbsd/innbbsd.c +++ b/innbbsd/innbbsd.c @@ -433,16 +433,16 @@ CMDgetrusage(client) fprintf(argv->out, "system time used: %.6f\r\n", (double)ru.ru_stime.tv_sec + (double)ru.ru_stime.tv_usec / 1000000.0); fprintf(argv->out, "maximum resident set size: %lu\r\n", ru.ru_maxrss * getpagesize()); fprintf(argv->out, "integral resident set size: %lu\r\n", ru.ru_idrss * getpagesize()); - fprintf(argv->out, "page faults not requiring physical I/O: %d\r\n", ru.ru_minflt); - fprintf(argv->out, "page faults requiring physical I/O: %d\r\n", ru.ru_majflt); - fprintf(argv->out, "swaps: %d\r\n", ru.ru_nswap); - fprintf(argv->out, "block input operations: %d\r\n", ru.ru_inblock); - fprintf(argv->out, "block output operations: %d\r\n", ru.ru_oublock); - fprintf(argv->out, "messages sent: %d\r\n", ru.ru_msgsnd); - fprintf(argv->out, "messages received: %d\r\n", ru.ru_msgrcv); - fprintf(argv->out, "signals received: %d\r\n", ru.ru_nsignals); - fprintf(argv->out, "voluntary context switches: %d\r\n", ru.ru_nvcsw); - fprintf(argv->out, "involuntary context switches: %d\r\n", ru.ru_nivcsw); + fprintf(argv->out, "page faults not requiring physical I/O: %ld\r\n", ru.ru_minflt); + fprintf(argv->out, "page faults requiring physical I/O: %ld\r\n", ru.ru_majflt); + fprintf(argv->out, "swaps: %ld\r\n", ru.ru_nswap); + fprintf(argv->out, "block input operations: %ld\r\n", ru.ru_inblock); + fprintf(argv->out, "block output operations: %ld\r\n", ru.ru_oublock); + fprintf(argv->out, "messages sent: %ld\r\n", ru.ru_msgsnd); + fprintf(argv->out, "messages received: %ld\r\n", ru.ru_msgrcv); + fprintf(argv->out, "signals received: %ld\r\n", ru.ru_nsignals); + fprintf(argv->out, "voluntary context switches: %ld\r\n", ru.ru_nvcsw); + fprintf(argv->out, "involuntary context switches: %ld\r\n", ru.ru_nivcsw); } fprintf(argv->out, ".\r\n"); fflush(argv->out); diff --git a/innbbsd/receive_article.c b/innbbsd/receive_article.c index 627db083..f35fd19b 100644 --- a/innbbsd/receive_article.c +++ b/innbbsd/receive_article.c @@ -27,7 +27,9 @@ #include "bbs.h" #include "externs.h" #include <stdlib.h> +#ifndef _XOPEN_SOURCE #define _XOPEN_SOURCE /* glibc2 needs this */ +#endif #include <time.h> #ifndef PowerBBS #include "innbbsconf.h" @@ -249,7 +251,7 @@ receive_article() newsfeeds_t *nf; char *boardhome; char hispaths[4096]; - char firstpath[MAXPATHLEN], *firstpathbase; + char firstpath[PATHLEN], *firstpathbase; char *lesssym, *nameptrleft, *nameptrright; #ifdef HMM_USE_ANTI_SPAM @@ -502,7 +504,7 @@ int receive_control(void) { char *boardhome, *fname; - char firstpath[MAXPATHLEN], *firstpathbase; + char firstpath[PATHLEN], *firstpathbase; char **splitptr, *ngptr; newsfeeds_t *nf; @@ -544,7 +546,7 @@ cancel_article_front(msgid) char *ptr = (char *)DBfetch(msgid); char *filelist, filename[2048]; char histent[4096]; - char firstpath[MAXPATHLEN], *firstpathbase; + char firstpath[PATHLEN], *firstpathbase; if (ptr == NULL) { bbslog("cancel failed(DBfetch): %s\n", msgid); return 0; @@ -715,9 +717,9 @@ post_article(homepath, userid, board, writebody, pathname, firstpath) { struct fileheader_t header; char *subject = SUBJECT; - char index[MAXPATHLEN]; - static char name[MAXPATHLEN]; - char article[MAXPATHLEN]; + char index[PATHLEN]; + static char name[PATHLEN]; + char article[PATHLEN]; FILE *fidx; int fh, bid; time_t now; @@ -736,7 +738,7 @@ post_article(homepath, userid, board, writebody, pathname, firstpath) now = time(NULL); while (1) { - sprintf(name, "M.%d.A", ++now); + sprintf(name, "M.%ld.A", ++now); sprintf(article, "%s/%s", homepath, name); fh = open(article, O_CREAT | O_EXCL | O_WRONLY, 0644); if (fh >= 0) @@ -842,13 +844,12 @@ void cancelpost(fileheader_t * fhdr, char *boardname) { int fd; - char fpath[MAXPATHLEN]; + char fpath[PATHLEN]; sprintf(fpath, BBSHOME "/boards/%c/%s/%s", boardname[0], boardname, fhdr->filename); if ((fd = open(fpath, O_RDONLY)) >= 0) { fileheader_t postfile; - char fn2[MAXPATHLEN] = BBSHOME "/boards/d/deleted", - *junkdir; + char fn2[PATHLEN] = BBSHOME "/boards/d/deleted"; stampfile(fn2, &postfile); memcpy(postfile.owner, fhdr->owner, IDLEN + TTLEN + 10); @@ -865,10 +866,11 @@ cancelpost(fileheader_t * fhdr, char *boardname) /* new/old/lock file processing */ /* ---------------------------- */ +#if 0 typedef struct { - char newfn[MAXPATHLEN]; - char oldfn[MAXPATHLEN]; - char lockfn[MAXPATHLEN]; + char newfn[PATHLEN]; + char oldfn[PATHLEN]; + char lockfn[PATHLEN]; } nol; @@ -882,7 +884,6 @@ nolfilename(n, fpath) sprintf(n->lockfn, "%s.lock", fpath); } -#if 0 int delete_record(const char *fpath, int size, int id) { @@ -965,7 +966,7 @@ cancel_article(homepath, board, file) { struct fileheader_t header; struct stat state; - char dirname[MAXPATHLEN]; + char dirname[PATHLEN]; long size, time, now; int fd, lower, ent; @@ -1033,7 +1034,7 @@ post_article(homepath, userid, board, writebody, pathname, firstpath) READINFO readinfo; SHORT fileid; - char buf[MAXPATHLEN]; + char buf[PATHLEN]; struct stat stbuf; int fh; |