From e7c8f48700a5f6e70f4c4d7e5f8171ffdc06ff6d Mon Sep 17 00:00:00 2001 From: wens Date: Sun, 1 Feb 2009 15:48:41 +0000 Subject: Fix some compile warnings Remove unused code git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4437 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- innbbsd/bbslink.c | 2 +- innbbsd/bbsnnrp.c | 4 ++-- innbbsd/daemon.c | 19 ++----------------- innbbsd/inntobbs.c | 36 ++++++++++++++++++------------------ innbbsd/receive_article.c | 4 ++-- innbbsd/rfc931.c | 4 ++-- 6 files changed, 27 insertions(+), 42 deletions(-) diff --git a/innbbsd/bbslink.c b/innbbsd/bbslink.c index a8bd3aea..f9d8cc61 100644 --- a/innbbsd/bbslink.c +++ b/innbbsd/bbslink.c @@ -356,7 +356,7 @@ save_outgoing(sover, filename, userid, poster, mtime) server = nf->path; } if (!server || !*server) { - sprintf(PATH_BUF, "%.*s (local)", sizeof PATH_BUF - 9, MYBBSID); + sprintf(PATH_BUF, "%.*s (local)", (int)(sizeof(PATH_BUF) - 9), MYBBSID); PATH = PATH_BUF; serveraddr = ""; sover->path = PATH; diff --git a/innbbsd/bbsnnrp.c b/innbbsd/bbsnnrp.c index f2dc3b98..11c4eb69 100644 --- a/innbbsd/bbsnnrp.c +++ b/innbbsd/bbsnnrp.c @@ -361,7 +361,7 @@ stdinreadnews(bbsnnrp) return 0; } -static char *ACT_BUF, *RC_BUF; +//static char *ACT_BUF, *RC_BUF; int ACT_COUNT; int @@ -1172,7 +1172,7 @@ main(argc, argv) if (dashf(active)) { strncpy(BBSNNRP.activefile, active, sizeof(BBSNNRP.activefile)); } else if (strchr(active, '/') == NULL) { - sprintf(BBSNNRP.activefile, "%s/innd/%.*s", BBSHOME, sizeof(BBSNNRP.activefile) - 7 - strlen(BBSHOME), active); + sprintf(BBSNNRP.activefile, "%s/innd/%.*s", BBSHOME, (int)(sizeof(BBSNNRP.activefile) - 7 - strlen(BBSHOME)), active); } else { strncpy(BBSNNRP.activefile, active, sizeof(BBSNNRP.activefile)); } diff --git a/innbbsd/daemon.c b/innbbsd/daemon.c index b764fda1..8709fa45 100644 --- a/innbbsd/daemon.c +++ b/innbbsd/daemon.c @@ -10,7 +10,6 @@ void deargify ARG((char ***)); static daemoncmd_t *dcmdp = NULL; static char *startupmessage = NULL; static int startupcode = 100; -static FILE *DIN, *DOUT, *DIO; typedef int (*F) (); void @@ -40,6 +39,8 @@ searchcmd(cmd) } #if 0 +static FILE *DIN, *DOUT, *DIO; + int daemon(dfd) int dfd; @@ -159,19 +160,3 @@ deargify(argv) * NULL; } free(*argv); argv = NULL; } */ } - -int -daemonprintf(format) - char *format; -{ - fprintf(DOUT, format); - fflush(DOUT); -} - -int -daemonputs(output) - char *output; -{ - fputs(output, DOUT); - fflush(DOUT); -} diff --git a/innbbsd/inntobbs.c b/innbbsd/inntobbs.c index b2ca4331..2a22f5aa 100644 --- a/innbbsd/inntobbs.c +++ b/innbbsd/inntobbs.c @@ -23,22 +23,22 @@ typedef struct Header { #include header_t headertable[] = { - "Subject", SUBJECT_H, - "From", FROM_H, - "Date", DATE_H, - "Message-ID", MID_H, - "Newsgroups", NEWSGROUPS_H, - "NNTP-Posting-Host", NNTPPOSTINGHOST_H, - "NNTP-Host", NNTPHOST_H, - "Control", CONTROL_H, - "Path", PATH_H, - "Organization", ORGANIZATION_H, - "X-Auth-From", X_Auth_From_H, - "Approved", APPROVED_H, - "Distribution", DISTRIBUTION_H, - "Keywords", KEYWORDS_H, - "Summary", SUMMARY_H, - "References", REFERENCES_H, + {"Subject", SUBJECT_H}, + {"From", FROM_H}, + {"Date", DATE_H}, + {"Message-ID", MID_H}, + {"Newsgroups", NEWSGROUPS_H}, + {"NNTP-Posting-Host", NNTPPOSTINGHOST_H}, + {"NNTP-Host", NNTPHOST_H}, + {"Control", CONTROL_H}, + {"Path", PATH_H}, + {"Organization", ORGANIZATION_H}, + {"X-Auth-From", X_Auth_From_H}, + {"Approved", APPROVED_H}, + {"Distribution", DISTRIBUTION_H}, + {"Keywords", KEYWORDS_H}, + {"Summary", SUMMARY_H}, + {"References", REFERENCES_H}, }; char *HEADER[LASTHEADER]; @@ -59,7 +59,7 @@ isexcluded(path1, nl) { char path2[1024]; /* path2 = (char*)mymalloc(strlen(nl->node) + 3); */ - sprintf(path2, "!%.*s!", sizeof path2 - 3, nl->node); + sprintf(path2, "!%.*s!", (int)(sizeof(path2) - 3), nl->node); if (strstr(path1, path2) != NULL) return 1; if (nl->exclusion && *nl->exclusion) { @@ -68,7 +68,7 @@ isexcluded(path1, nl) exclude && *exclude; ptr = strchr(exclude, ',')) { if (ptr) *ptr = '\0'; - sprintf(path2, "!%.*s!", sizeof path2 - 3, exclude); + sprintf(path2, "!%.*s!", (int)(sizeof(path2) - 3), exclude); if (strstr(path1, path2) != NULL) return 1; if (ptr) { diff --git a/innbbsd/receive_article.c b/innbbsd/receive_article.c index b7d309fc..28d2a4aa 100644 --- a/innbbsd/receive_article.c +++ b/innbbsd/receive_article.c @@ -408,7 +408,7 @@ receive_article() } #endif - sprintf(xpath, "%s!%.*s", MYBBSID, sizeof(xpath) - strlen(MYBBSID) - 2, PATH); + sprintf(xpath, "%s!%.*s", MYBBSID, (int)(sizeof(xpath) - strlen(MYBBSID) - 2), PATH); PATH = xpath; for (pathptr = PATH; pathptr != NULL && (pathptr = strstr(pathptr, ".edu.tw")) != NULL;) { if (pathptr != NULL) { @@ -547,7 +547,7 @@ cancel_article_front(msgid) char *ptr = (char *)DBfetch(msgid); char *filelist, filename[2048]; char histent[4096]; - char firstpath[PATHLEN], *firstpathbase; + char firstpath[PATHLEN], *firstpathbase = firstpath; if (ptr == NULL) { bbslog("cancel failed(DBfetch): %s\n", msgid); return 0; diff --git a/innbbsd/rfc931.c b/innbbsd/rfc931.c index 33ee49fd..ac4fe7f8 100644 --- a/innbbsd/rfc931.c +++ b/innbbsd/rfc931.c @@ -71,7 +71,7 @@ my_rfc931_name(herefd, there) /* Find out local address and port number of stdin. */ length = sizeof(here); - if (getsockname(herefd, (struct sockaddr *) & here, &length) == -1) { + if (getsockname(herefd, (struct sockaddr *) & here, (socklen_t *) &length) == -1) { syslog(LOG_ERR, "getsockname: %m"); return (result); } @@ -137,7 +137,7 @@ my_rfc931_name(herefd, there) && ntohs(here.sin_port) == local) { /* Strip trailing carriage return. */ - if (cp = strchr(user, '\r')) + if ((cp = strchr(user, '\r'))) *cp = 0; result = user; } -- cgit v1.2.3