From 0962e076d071925f26c00837468aa1aa42d5784f Mon Sep 17 00:00:00 2001 From: wens Date: Fri, 30 Jan 2009 04:17:56 +0000 Subject: reformat function decleration git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4429 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- innbbsd/bbslib.c | 124 +++++++++++++++++++------------------------------- innbbsd/echobbslib.c | 125 ++++++++++++++++++--------------------------------- 2 files changed, 90 insertions(+), 159 deletions(-) diff --git a/innbbsd/bbslib.c b/innbbsd/bbslib.c index 80d37ec8..2734f194 100644 --- a/innbbsd/bbslib.c +++ b/innbbsd/bbslib.c @@ -1,16 +1,10 @@ #include "bbs.h" #include -#if defined( LINUX ) -#include "innbbsconf.h" -#include "bbslib.h" -#include -#else #include -#include "innbbsconf.h" -#include "bbslib.h" -#endif #include "config.h" #include "externs.h" +#include "innbbsconf.h" +#include "bbslib.h" char INNBBSCONF[MAXPATHLEN]; char INNDHOME[MAXPATHLEN]; @@ -45,8 +39,7 @@ static char * static char verbosename[MAXPATHLEN]; void -verboseon(filename) - char *filename; +verboseon(char *filename) { verboseFlag = 1; if (filename != NULL) { @@ -57,6 +50,7 @@ verboseon(filename) } verboseFilename = filename; } + void verboseoff() { @@ -64,19 +58,19 @@ verboseoff() } void -setverboseon(void) +setverboseon() { verboseFlag = 1; } int -isverboselog(void) +isverboselog() { return verboseFlag; } void -setverboseoff(void) +setverboseoff() { verboseoff(); if (bbslogfp != NULL) { @@ -86,7 +80,7 @@ setverboseoff(void) } void -verboselog(char *fmt,...) +verboselog(char *fmt, ...) { va_list ap; char datebuf[40]; @@ -118,9 +112,9 @@ verboselog(char *fmt,...) void #ifdef PalmBBS -xbbslog(char *fmt,...) +xbbslog(char *fmt, ...) #else -bbslog(char *fmt,...) +bbslog(char *fmt, ...) #endif { va_list ap; @@ -146,8 +140,7 @@ bbslog(char *fmt,...) } int -initial_bbs(outgoing) - char *outgoing; +initial_bbs(char *outgoing) { /* reopen bbslog */ if (bbslogfp != NULL) { @@ -168,7 +161,7 @@ initial_bbs(outgoing) sprintf(INNBBSCONF, "%s/innbbs.conf", INNDHOME); sprintf(BBSFEEDS, "%s/bbsfeeds.log", INNDHOME); - if (isfile(INNBBSCONF)) { + if (dashf(INNBBSCONF)) { FILE *conf; char buffer[MAXPATHLEN]; conf = fopen(INNBBSCONF, "r"); @@ -260,8 +253,7 @@ initial_bbs(outgoing) } static int -nf_byboardcmp(a, b) - newsfeeds_t **a, **b; +nf_byboardcmp(newsfeeds_t **a, newsfeeds_t **b) { /* * if (!a || !*a || !(*a)->board) return -1; if (!b || !*b || @@ -271,8 +263,7 @@ nf_byboardcmp(a, b) } static int -nfcmp(a, b) - newsfeeds_t *a, *b; +nfcmp(newsfeeds_t *a, newsfeeds_t *b) { /* * if (!a || !a->newsgroups) return -1; if (!b || !b->newsgroups) return @@ -282,8 +273,7 @@ nfcmp(a, b) } static int -nlcmp(a, b) - nodelist_t *a, *b; +nlcmp(nodelist_t *a, nodelist_t *b) { /* * if (!a || !a->host) return -1; if (!b || !b->host) return 1; @@ -292,8 +282,7 @@ nlcmp(a, b) } static int -nl_bynodecmp(a, b) - nodelist_t **a, **b; +nl_bynodecmp(nodelist_t **a, nodelist_t **b) { /* * if (!a || !*a || !(*a)->node) return -1; if (!b || !*b || !(*b)->node) @@ -304,9 +293,7 @@ nl_bynodecmp(a, b) /* read in newsfeeds.bbs and nodelist.bbs */ int -readnlfile(inndhome, outgoing) - char *inndhome; - char *outgoing; +readnlfile(char *inndhome, char *outgoing) { FILE *fp; char buff[1024]; @@ -429,8 +416,7 @@ readnlfile(inndhome, outgoing) } int -readnffile(inndhome) - char *inndhome; +readnffile(char *inndhome) { FILE *fp; char buff[1024]; @@ -513,9 +499,8 @@ readnffile(inndhome) return 0; } -newsfeeds_t * -search_board(board) - char *board; +newsfeeds_t * +search_board(char *board) { newsfeeds_t nft, *nftptr, **find; if (NONENEWSFEEDS) @@ -528,9 +513,8 @@ search_board(board) return NULL; } -nodelist_t * -search_nodelist_bynode(node) - char *node; +nodelist_t * +search_nodelist_bynode(char *node) { nodelist_t nlt, *nltptr, **find; if (LOCALNODELIST) @@ -544,10 +528,8 @@ search_nodelist_bynode(node) } -nodelist_t * -search_nodelist(site, identuser) - char *site; - char *identuser; +nodelist_t * +search_nodelist(char *site, char *identuser) { nodelist_t nlt, *find; char buffer[1024]; @@ -563,9 +545,8 @@ search_nodelist(site, identuser) return find; } -newsfeeds_t * -search_group(newsgroup) - char *newsgroup; +newsfeeds_t * +search_group(char *newsgroup) { newsfeeds_t nft, *find; if (NONENEWSFEEDS) @@ -575,9 +556,8 @@ search_group(newsgroup) return find; } -char * -ascii_date(now) - time_t now; +char * +ascii_date(time_t now) { static char datebuf[40]; /* @@ -587,10 +567,8 @@ ascii_date(now) return datebuf; } -char * -restrdup(ptr, string) - char *ptr; - char *string; +char * +restrdup(char *ptr, char *string) { int len; if (string == NULL) { @@ -607,13 +585,10 @@ restrdup(ptr, string) return ptr; } - - -void * -mymalloc(size) - int size; +void * +mymalloc(int size) { - char *ptr = (char *)malloc(size); + void *ptr = malloc(size); if (ptr == NULL) { fprintf(stderr, "cant allocate memory\n"); syslog(LOG_ERR, "cant allocate memory %m"); @@ -622,12 +597,10 @@ mymalloc(size) return ptr; } -void * -myrealloc(optr, size) - void *optr; - int size; +void * +myrealloc(void *optr, int size) { - char *ptr = (char *)realloc(optr, size); + void *ptr = realloc(optr, size); if (ptr == NULL) { fprintf(stderr, "cant allocate memory\n"); syslog(LOG_ERR, "cant allocate memory %m"); @@ -637,8 +610,7 @@ myrealloc(optr, size) } void -testandmkdir(dir) - char *dir; +testandmkdir(char *dir) { if (!isdir(dir)) { char path[MAXPATHLEN + 12]; @@ -651,9 +623,9 @@ static char splitbuf[2048]; static char joinbuf[1024]; #define MAXTOK 50 static char *Splitptr[MAXTOK]; -char ** -split(line, pat) - char *line, *pat; + +char ** +split(char *line, char *pat) { char *p; int i; @@ -672,9 +644,8 @@ split(line, pat) return Splitptr; } -char ** -BNGsplit(line) - char *line; +char ** +BNGsplit(char *line) { char **ptr = split(line, ","); newsfeeds_t *nf1, *nf2; @@ -722,9 +693,8 @@ BNGsplit(line) return ptr; } -char ** -ssplit(line, pat) - char *line, *pat; +char ** +ssplit(char *line, char *pat) { char *p; int i; @@ -742,10 +712,8 @@ ssplit(line, pat) return Splitptr; } -char * -join(lineptr, pat, num) - char **lineptr, *pat; - int num; +char * +join(char **lineptr, char *pat, int num) { int i; joinbuf[0] = '\0'; diff --git a/innbbsd/echobbslib.c b/innbbsd/echobbslib.c index ab417eff..a151e16e 100644 --- a/innbbsd/echobbslib.c +++ b/innbbsd/echobbslib.c @@ -1,17 +1,10 @@ #include "bbs.h" #include -#if defined( LINUX ) -#include "innbbsconf.h" -#include "bbslib.h" -#include -#else #include -#include "innbbsconf.h" -#include "bbslib.h" -#endif #include "config.h" - #include "externs.h" +#include "innbbsconf.h" +#include "bbslib.h" char INNBBSCONF[MAXPATHLEN]; char INNDHOME[MAXPATHLEN]; @@ -46,8 +39,7 @@ static char * static char verbosename[MAXPATHLEN]; void -verboseon(filename) - char *filename; +verboseon(char *filename) { verboseFlag = 1; if (filename != NULL) { @@ -58,6 +50,7 @@ verboseon(filename) } verboseFilename = filename; } + void verboseoff() { @@ -87,7 +80,7 @@ setverboseoff() } void -verboselog(char *fmt,...) +verboselog(char *fmt, ...) { va_list ap; char datebuf[40]; @@ -119,9 +112,9 @@ verboselog(char *fmt,...) void #ifdef PalmBBS -xbbslog(char *fmt,...) +xbbslog(char *fmt, ...) #else -bbslog(char *fmt,...) +bbslog(char *fmt, ...) #endif { va_list ap; @@ -147,12 +140,8 @@ bbslog(char *fmt,...) } int -initial_bbs(outgoing) - char *outgoing; +initial_bbs(char *outgoing) { - FILE *FN; - char *bbsnameptr = NULL; - /* reopen bbslog */ if (bbslogfp != NULL) { fclose(bbslogfp); @@ -172,7 +161,7 @@ initial_bbs(outgoing) sprintf(INNBBSCONF, "%s/innbbs.conf", INNDHOME); sprintf(BBSFEEDS, "%s/bbsfeeds.log", INNDHOME); - if (isfile(INNBBSCONF)) { + if (dashf(INNBBSCONF)) { FILE *conf; char buffer[MAXPATHLEN]; conf = fopen(INNBBSCONF, "r"); @@ -242,7 +231,7 @@ initial_bbs(outgoing) } } #ifdef WITH_ECHOMAIL - bbsnameptr = fileglue("%s/bbsname.bbs", INNDHOME); + bbsnameptr = (char *)fileglue("%s/bbsname.bbs", INNDHOME); if ((FN = fopen(bbsnameptr, "r")) == NULL) { fprintf(stderr, "can't open file %s\n", bbsnameptr); return 0; @@ -263,8 +252,7 @@ initial_bbs(outgoing) } static int -nf_byboardcmp(a, b) - newsfeeds_t **a, **b; +nf_byboardcmp(newsfeeds_t **a, newsfeeds_t **b) { /* * if (!a || !*a || !(*a)->board) return -1; if (!b || !*b || @@ -274,8 +262,7 @@ nf_byboardcmp(a, b) } static int -nfcmp(a, b) - newsfeeds_t *a, *b; +nfcmp(newsfeeds_t *a, newsfeeds_t *b) { /* * if (!a || !a->newsgroups) return -1; if (!b || !b->newsgroups) return @@ -285,8 +272,7 @@ nfcmp(a, b) } static int -nlcmp(a, b) - nodelist_t *a, *b; +nlcmp(nodelist_t *a, nodelist_t *b) { /* * if (!a || !a->host) return -1; if (!b || !b->host) return 1; @@ -295,8 +281,7 @@ nlcmp(a, b) } static int -nl_bynodecmp(a, b) - nodelist_t **a, **b; +nl_bynodecmp(nodelist_t **a, nodelist_t **b) { /* * if (!a || !*a || !(*a)->node) return -1; if (!b || !*b || !(*b)->node) @@ -307,9 +292,7 @@ nl_bynodecmp(a, b) /* read in newsfeeds.bbs and nodelist.bbs */ int -readnlfile(inndhome, outgoing) - char *inndhome; - char *outgoing; +readnlfile(char *inndhome, char *outgoing) { FILE *fp; char buff[1024]; @@ -432,8 +415,7 @@ readnlfile(inndhome, outgoing) } int -readnffile(inndhome) - char *inndhome; +readnffile(char *inndhome) { FILE *fp; char buff[1024]; @@ -509,7 +491,6 @@ readnffile(inndhome) NEWSFEEDS[NFCOUNT].path = nptr; for (nptr++; *nptr && !strchr("\r\n", *nptr);) nptr++; - /* if (*nptr == '\0') continue; */ *nptr = '\0'; } qsort(NEWSFEEDS, NFCOUNT, sizeof(newsfeeds_t), nfcmp); @@ -517,9 +498,8 @@ readnffile(inndhome) return 0; } -newsfeeds_t * -search_board(board) - char *board; +newsfeeds_t * +search_board(char *board) { newsfeeds_t nft, *nftptr, **find; if (NONENEWSFEEDS) @@ -532,9 +512,8 @@ search_board(board) return NULL; } -nodelist_t * -search_nodelist_bynode(node) - char *node; +nodelist_t * +search_nodelist_bynode(char *node) { nodelist_t nlt, *nltptr, **find; if (LOCALNODELIST) @@ -548,10 +527,8 @@ search_nodelist_bynode(node) } -nodelist_t * -search_nodelist(site, identuser) - char *site; - char *identuser; +nodelist_t * +search_nodelist(char *site, char *identuser) { nodelist_t nlt, *find; char buffer[1024]; @@ -567,9 +544,8 @@ search_nodelist(site, identuser) return find; } -newsfeeds_t * -search_group(newsgroup) - char *newsgroup; +newsfeeds_t * +search_group(char *newsgroup) { newsfeeds_t nft, *find; if (NONENEWSFEEDS) @@ -579,9 +555,8 @@ search_group(newsgroup) return find; } -char * -ascii_date(now) - time_t now; +char * +ascii_date(time_t now) { static char datebuf[40]; /* @@ -591,10 +566,8 @@ ascii_date(now) return datebuf; } -char * -restrdup(ptr, string) - char *ptr; - char *string; +char * +restrdup(char *ptr, char *string) { int len; if (string == NULL) { @@ -611,13 +584,10 @@ restrdup(ptr, string) return ptr; } - - -void * -mymalloc(size) - int size; +void * +mymalloc(int size) { - char *ptr = (char *)malloc(size); + void *ptr = malloc(size); if (ptr == NULL) { fprintf(stderr, "cant allocate memory\n"); syslog(LOG_ERR, "cant allocate memory %m"); @@ -626,12 +596,10 @@ mymalloc(size) return ptr; } -void * -myrealloc(optr, size) - void *optr; - int size; +void * +myrealloc(void *optr, int size) { - char *ptr = (char *)realloc(optr, size); + void *ptr = realloc(optr, size); if (ptr == NULL) { fprintf(stderr, "cant allocate memory\n"); syslog(LOG_ERR, "cant allocate memory %m"); @@ -641,8 +609,7 @@ myrealloc(optr, size) } void -testandmkdir(dir) - char *dir; +testandmkdir(char *dir) { if (!isdir(dir)) { char path[MAXPATHLEN + 12]; @@ -655,9 +622,9 @@ static char splitbuf[2048]; static char joinbuf[1024]; #define MAXTOK 50 static char *Splitptr[MAXTOK]; -char ** -split(line, pat) - char *line, *pat; + +char ** +split(char *line, char *pat) { char *p; int i; @@ -676,9 +643,8 @@ split(line, pat) return Splitptr; } -char ** -BNGsplit(line) - char *line; +char ** +BNGsplit(char *line) { char **ptr = split(line, ","); newsfeeds_t *nf1, *nf2; @@ -726,9 +692,8 @@ BNGsplit(line) return ptr; } -char ** -ssplit(line, pat) - char *line, *pat; +char ** +ssplit(char *line, char *pat) { char *p; int i; @@ -746,10 +711,8 @@ ssplit(line, pat) return Splitptr; } -char * -join(lineptr, pat, num) - char **lineptr, *pat; - int num; +char * +join(char **lineptr, char *pat, int num) { int i; joinbuf[0] = '\0'; -- cgit v1.2.3