From: Nathan Bryant Date: Thu, 8 Oct 1998 15:19:09 +0000 (+0000) Subject: * lots of warning fixes; builds with -std1 on dec unix X-Git-Tag: v7.86~8295 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=bb23faa2d3b2c59613814108be9f213c9fecb19f;p=citadel.git * lots of warning fixes; builds with -std1 on dec unix * aidepost.c, citadel.h, citmail.c, file_ops.c, msgbase.c, netmailer.c, netproc.c, rcit.c, server.h, stats.c, userlist.c: use time_t where needed * control.c, room_ops.c, serv_chat.c, sysdep.c: use memset() instead of bzero() * dynloader.c, dynloader.h, messages.c, server.h, sysdep.c, sysdep_decls.h: function pointer/prototyping fixes --- diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 6bfb9f114..908e422b1 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,3 +1,13 @@ +1998-10-08 Nathan Bryant + * lots of warning fixes; builds with -std1 on dec unix + * aidepost.c, citadel.h, citmail.c, file_ops.c, msgbase.c, netmailer.c, + netproc.c, rcit.c, server.h, stats.c, userlist.c: use time_t where + needed + * control.c, room_ops.c, serv_chat.c, sysdep.c: use memset() instead of + bzero() + * dynloader.c, dynloader.h, messages.c, server.h, sysdep.c, + sysdep_decls.h: function pointer/prototyping fixes + 1998-10-07 Nathan Bryant * snprintf.c, snprintf.h: new files * Makefile.in, configure.in, dynloader.c, sysdep.c: support for the diff --git a/citadel/aidepost.c b/citadel/aidepost.c index 096dacd75..e2c48f832 100644 --- a/citadel/aidepost.c +++ b/citadel/aidepost.c @@ -15,7 +15,8 @@ void make_message(char *filename) { FILE *fp; int a; - long bb,cc,now; + long bb,cc; + time_t now; time(&now); fp=fopen(filename,"wb"); if (fp==NULL) exit(22); putc(255,fp); diff --git a/citadel/citadel.h b/citadel/citadel.h index 89ef7a9c8..d8fb2ad46 100644 --- a/citadel/citadel.h +++ b/citadel/citadel.h @@ -135,7 +135,7 @@ struct quickroom { char QRpasswd[10]; /* Only valid if it's a private rm */ long QRroomaide; /* User number of room aide */ long QRhighest; /* Highest message NUMBER in room */ - long QRgen; /* Generation number of room */ + time_t QRgen; /* Generation number of room */ unsigned QRflags; /* See flag values below */ char QRdirname[15]; /* Directory name, if applicable */ long QRinfo; /* Info file update relative to msgs*/ diff --git a/citadel/citmail.c b/citadel/citmail.c index fe2437f36..f611ae48c 100644 --- a/citadel/citmail.c +++ b/citadel/citmail.c @@ -55,7 +55,7 @@ int RUN_NETPROC = 1; long conv_date(char *sdbuf) { int a,b,cpos,tend,tval; - long now; + time_t now; struct tm *tmbuf; char dbuf[128]; @@ -335,7 +335,7 @@ void loopcopy(FILE *to, FILE *from) { */ void do_citmail(char recp[], int dtype) { - long now; + time_t now; FILE *temp; int a; char buf[128]; diff --git a/citadel/control.c b/citadel/control.c index 6d63d214a..a093728d5 100644 --- a/citadel/control.c +++ b/citadel/control.c @@ -33,7 +33,7 @@ void get_control(void) { * the system functions with all control record fields initialized * to zero. */ - bzero(&CitControl, sizeof(struct CitControl)); + memset(&CitControl, 0, sizeof(struct CitControl)); fp = fopen("citadel.control", "rb"); if (fp == NULL) return; diff --git a/citadel/dynloader.c b/citadel/dynloader.c index 0f492be0b..1fe784826 100644 --- a/citadel/dynloader.c +++ b/citadel/dynloader.c @@ -100,7 +100,9 @@ void DLoader_Init(char *pathname) continue; } - h_init_fcn = dlsym(fcn_handle, "Dynamic_Module_Init"); + h_init_fcn = (struct DLModule_Info * (*)(void)) + dlsym(fcn_handle, "Dynamic_Module_Init"); + if ((dl_error = dlerror()) != NULL) { fprintf(stderr,"DLoader_Init dlsym failed (%s)\n", dl_error); @@ -117,7 +119,7 @@ void DLoader_Init(char *pathname) -void CtdlRegisterCleanupHook(void *fcn_ptr) { +void CtdlRegisterCleanupHook(void (*fcn_ptr)(void)) { struct CleanupFunctionHook *newfcn; @@ -131,7 +133,7 @@ void CtdlRegisterCleanupHook(void *fcn_ptr) { } -void CtdlRegisterSessionHook(void *fcn_ptr, int EventType) { +void CtdlRegisterSessionHook(void (*fcn_ptr)(void), int EventType) { struct SessionFunctionHook *newfcn; @@ -147,7 +149,7 @@ void CtdlRegisterSessionHook(void *fcn_ptr, int EventType) { } -void CtdlRegisterUserHook(void *fcn_ptr, int EventType) { +void CtdlRegisterUserHook(void (*fcn_ptr)(char*, long), int EventType) { struct UserFunctionHook *newfcn; diff --git a/citadel/dynloader.h b/citadel/dynloader.h index e65f78a45..55ac3b8c6 100644 --- a/citadel/dynloader.h +++ b/citadel/dynloader.h @@ -8,10 +8,10 @@ struct DLModule_Info void DLoader_Init(char *pathname); int DLoader_Exec_Cmd(char *cmdbuf); -void CtdlRegisterCleanupHook(void *fcn_ptr); -void CtdlRegisterSessionHook(void *fcn_ptr, int StartStop); +void CtdlRegisterCleanupHook(void (*fcn_ptr)(void)); +void CtdlRegisterSessionHook(void (*fcn_ptr)(void), int EventType); void PerformSessionHooks(int EventType); void PerformUserHooks(char *username, long usernum, int EventType); void CtdlRegisterProtoHook(void (*handler)(char *), char *cmd, char *desc); -void CtdlRegisterUserHook(void *fcn_ptr, int EventType); +void CtdlRegisterUserHook(void (*fcn_ptr)(char*, long), int EventType); struct DLModule_Info *Dynamic_Module_Init(void); diff --git a/citadel/file_ops.c b/citadel/file_ops.c index 3f2c6c36d..db36ffd00 100644 --- a/citadel/file_ops.c +++ b/citadel/file_ops.c @@ -138,7 +138,7 @@ void cmd_netf(char *cmdbuf) { char pathname[256],filename[256],destsys[256],buf[256],outfile[256]; int a,e; - long now; + time_t now; FILE *ofp; extract(filename,cmdbuf,0); @@ -502,7 +502,7 @@ void abort_upl(struct CitContext *who) void cmd_ucls(char *cmd) { FILE *fp; - long now; + time_t now; if (CC->upload_fp == NULL) { cprintf("%d You don't have an upload file open.\n",ERROR); diff --git a/citadel/messages.c b/citadel/messages.c index 9fb2997cc..dc8b5c210 100644 --- a/citadel/messages.c +++ b/citadel/messages.c @@ -72,10 +72,10 @@ extern int editor_pid; int lines_printed; -void ka_sigcatch(void) { +void ka_sigcatch(int signum) { char buf[256]; alarm(S_KEEPALIVE); - signal(SIGALRM, (void *)ka_sigcatch); + signal(SIGALRM, ka_sigcatch); serv_puts("NOOP"); serv_gets(buf); } @@ -89,7 +89,7 @@ pid_t ka_wait(pid_t *kstatus) pid_t p; alarm(S_KEEPALIVE); - signal(SIGALRM, (void *)ka_sigcatch); + signal(SIGALRM, ka_sigcatch); do { errno = 0; p = wait(kstatus); diff --git a/citadel/msgbase.c b/citadel/msgbase.c index eb14ebf28..d0a87cf16 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -334,7 +334,7 @@ void output_message(char *msgid, int mode, char snode[256]; char lnode[256]; char mid[256]; - long xtime; + time_t xtime; /* */ strcpy(boundary, ""); @@ -806,7 +806,7 @@ void save_message(char *mtmp, /* file containing proper message */ */ void aide_message(char *text) { - long now; + time_t now; FILE *fp; time(&now); @@ -841,7 +841,7 @@ void make_message( FILE *fp; int a; - long now; + time_t now; char dest_node[32]; char buf[256]; diff --git a/citadel/msgform.c b/citadel/msgform.c index efba635cd..26f6d614b 100644 --- a/citadel/msgform.c +++ b/citadel/msgform.c @@ -48,7 +48,7 @@ int main(int argc, char **argv) char bbb[1024]; char subject[1024]; FILE *fp; - long now; + time_t now; if (argc==2) if (!strcmp(argv[1],"-q")) qwk = 1; fp=stdin; diff --git a/citadel/netmailer.c b/citadel/netmailer.c index 913b64f16..3124fea6f 100644 --- a/citadel/netmailer.c +++ b/citadel/netmailer.c @@ -61,7 +61,7 @@ void fpgetfield(FILE *fp, char *string) * modified to format 80 columns into a temporary file, and extract the * sender and recipient names for use within the main() loop. */ -void msgform(char *msgfile, FILE *mfout, char *sbuf, char *rbuf, char *nbuf, char *pbuf, long int *mid_buf, char *rmname, char *subj) +void msgform(char *msgfile, FILE *mfout, char *sbuf, char *rbuf, char *nbuf, char *pbuf, time_t *mid_buf, char *rmname, char *subj) /* sender */ @@ -165,8 +165,8 @@ int main(int argc, char **argv) char sbuf[200],rbuf[200],cstr[100],fstr[128]; char nbuf[64],pbuf[128],rmname[128],buf[128]; char subject[200]; - long mid_buf; - long now; + time_t mid_buf; + time_t now; int mlist = 0; fprintf(stderr, "netmailer: started... sending mail to %s\n", argv[1]); diff --git a/citadel/netproc.c b/citadel/netproc.c index 83dd9c72c..2f13200fb 100644 --- a/citadel/netproc.c +++ b/citadel/netproc.c @@ -73,7 +73,7 @@ struct syslist { char s_name[16]; char s_type[4]; char s_nexthop[128]; - long s_lastcontact; + time_t s_lastcontact; char s_humannode[64]; char s_phonenum[32]; char s_gdom[64]; @@ -243,7 +243,7 @@ void setup_special_nodes(void) { void rewrite_syslist(void) { struct syslist *stemp; FILE *newfp; - long now; + time_t now; time(&now); newfp=fopen("network/mail.sysinfo","w"); @@ -612,7 +612,7 @@ void bounce(struct minfo *bminfo) FILE *bounce; char bfilename[64]; static int bseq = 1; - long now; + time_t now; sprintf(bfilename,"./network/spoolin/bounce.%d.%d",getpid(),bseq++); bounce = fopen(bfilename,"wb"); diff --git a/citadel/rcit.c b/citadel/rcit.c index 39afbcaed..71767ea3e 100644 --- a/citadel/rcit.c +++ b/citadel/rcit.c @@ -75,7 +75,8 @@ int main(int argc, char **argv) char subject[128]; char orgname[128]; long mid = 0L; - long now,bcount,aa; + time_t now; + long bcount,aa; int a; char flnm[128],tname[128]; FILE *minput,*mout,*mtemp; diff --git a/citadel/room_ops.c b/citadel/room_ops.c index 4aa538e80..28595541b 100644 --- a/citadel/room_ops.c +++ b/citadel/room_ops.c @@ -108,7 +108,7 @@ int getroom(struct quickroom *qrbuf, char *room_name) lowercase_name[a] = tolower(room_name[a]); } - bzero(qrbuf, sizeof(struct quickroom)); + memset(qrbuf, 0, sizeof(struct quickroom)); cdbqr = cdb_fetch(CDB_QUICKROOM, lowercase_name, strlen(lowercase_name)); if (cdbqr != NULL) { @@ -179,7 +179,7 @@ void getfloor(struct floor *flbuf, int floor_num) { struct cdbdata *cdbfl; - bzero(flbuf, sizeof(struct floor)); + memset(flbuf, 0, sizeof(struct floor)); cdbfl = cdb_fetch(CDB_FLOORTAB, &floor_num, sizeof(int)); if (cdbfl != NULL) { memcpy(flbuf, cdbfl->ptr, @@ -240,7 +240,7 @@ void ForEachRoom(void (*CallBack)(struct quickroom *EachRoom)) { cdb_rewind(CDB_QUICKROOM); while(cdbqr = cdb_next_item(CDB_QUICKROOM), cdbqr != NULL) { - bzero(&qrbuf, sizeof(struct quickroom)); + memset(&qrbuf, 0, sizeof(struct quickroom)); memcpy(&qrbuf, cdbqr->ptr, ( (cdbqr->len > sizeof(struct quickroom)) ? sizeof(struct quickroom) : cdbqr->len) ); @@ -716,7 +716,7 @@ void cmd_whok(void) { cprintf("%d Who knows room:\n",LISTING_FOLLOWS); cdb_rewind(CDB_USERSUPP); while(cdbus = cdb_next_item(CDB_USERSUPP), cdbus != NULL) { - bzero(&temp, sizeof(struct usersupp)); + memset(&temp, 0, sizeof(struct usersupp)); memcpy(&temp, cdbus->ptr, cdbus->len); cdb_free(cdbus); @@ -1140,7 +1140,7 @@ unsigned create_room(char *new_room_name, if (getroom(&qrbuf, new_room_name)==0) return(0); /* already exists */ - bzero(&qrbuf, sizeof(struct quickroom)); + memset(&qrbuf, 0, sizeof(struct quickroom)); strncpy(qrbuf.QRname,new_room_name,ROOMNAMELEN); strncpy(qrbuf.QRpasswd,new_room_pass,9); qrbuf.QRflags = QR_INUSE; diff --git a/citadel/serv_chat.c b/citadel/serv_chat.c index 72d368f07..57c6c852c 100644 --- a/citadel/serv_chat.c +++ b/citadel/serv_chat.c @@ -86,7 +86,7 @@ void allwrite(char *cmdbuf, int flag, char *roomname, char *username) } clnew = (struct ChatLine *) malloc(sizeof(struct ChatLine)); - bzero(clnew, sizeof(struct ChatLine)); + memset(clnew, 0, sizeof(struct ChatLine)); if (clnew == NULL) { fprintf(stderr, "citserver: cannot alloc chat line: %s\n", strerror(errno)); diff --git a/citadel/server.h b/citadel/server.h index 6e713647a..98acc5729 100644 --- a/citadel/server.h +++ b/citadel/server.h @@ -36,7 +36,7 @@ struct CitContext { struct ExpressMessage *FirstExpressMessage; int cs_pid; /* session ID */ char cs_room[20]; /* current room */ - long cs_lastupdt; /* time of last update */ + time_t cs_lastupdt; /* time of last update */ time_t lastcmd; /* time of last command executed */ time_t lastidle; /* For computing idle time */ char lastcmdname[5]; /* name of last command executed */ @@ -140,7 +140,7 @@ struct cdbdata { struct CleanupFunctionHook { struct CleanupFunctionHook *next; - void *(*h_function_pointer) (void); + void (*h_function_pointer) (void); }; extern struct CleanupFunctionHook *CleanupHookTable; @@ -153,7 +153,7 @@ extern struct CleanupFunctionHook *CleanupHookTable; */ struct SessionFunctionHook { struct SessionFunctionHook *next; - void *(*h_function_pointer) (void); + void (*h_function_pointer) (void); int eventtype; }; extern struct SessionFunctionHook *SessionHookTable; @@ -173,7 +173,7 @@ extern struct SessionFunctionHook *SessionHookTable; */ struct UserFunctionHook { struct UserFunctionHook *next; - void *(*h_function_pointer) (char *username, long usernum); + void (*h_function_pointer) (char *username, long usernum); int eventtype; }; extern struct UserFunctionHook *UserHookTable; diff --git a/citadel/stats.c b/citadel/stats.c index be8721880..7bb392eed 100644 --- a/citadel/stats.c +++ b/citadel/stats.c @@ -41,7 +41,7 @@ prompt (void) } int -halfhour (long int time) /* Returns half-hour time period of time */ +halfhour (time_t time) /* Returns half-hour time period of time */ { int a; @@ -106,7 +106,7 @@ main (int argc, char **argv) long cftime, cttime, aa; int calls, logins, newusers; int badpws, terms, drops, sleeps; - long from, to, tottime; + time_t from, to, tottime; int days, hours, minutes; char aaa[100]; struct tm *tm; @@ -139,8 +139,8 @@ main (int argc, char **argv) if (!batch_mode) printf ("Scanning call log, please wait...\n\n\n\n"); - from = 0L; - to = 0L; + from = 0; + to = 0; for (a = 0; a < 72; ++a) { timeon[a] = 0L; diff --git a/citadel/sysdep.c b/citadel/sysdep.c index b40cbcbd9..93cfa8e26 100644 --- a/citadel/sysdep.c +++ b/citadel/sysdep.c @@ -157,7 +157,7 @@ int ig_tcp_server(int port_number, int queue_len) struct sockaddr_in sin; int s, i; - bzero((char *)&sin, sizeof(sin)); + memset(&sin, 0, sizeof(sin)); sin.sin_family = AF_INET; sin.sin_addr.s_addr = INADDR_ANY; @@ -237,7 +237,7 @@ struct CitContext *CreateNewContext(void) { lprintf(1, "citserver: can't allocate memory!!\n"); pthread_exit(NULL); } - bzero(me, sizeof(struct CitContext)); + memset(me, 0, sizeof(struct CitContext)); begin_critical_section(S_SESSION_TABLE); me->next = ContextList; @@ -470,10 +470,11 @@ void kill_session(int session_to_kill) { /* * The system-dependent wrapper around the main context loop. */ -void sd_context_loop(struct CitContext *con) { +void *sd_context_loop(struct CitContext *con) { pthread_cleanup_push(*cleanup_stuff, NULL); context_loop(con); pthread_cleanup_pop(0); + return NULL; } @@ -716,8 +717,10 @@ int main(int argc, char **argv) /* now create the thread */ lprintf(9, "creating thread\n"); - if (pthread_create(&SessThread, &attr, (void *)sd_context_loop, - con) != 0) { + if (pthread_create(&SessThread, &attr, + (void* (*)(void*)) sd_context_loop, + con) + != 0) { lprintf(1, "citserver: can't create thread: %s\n", strerror(errno)); diff --git a/citadel/sysdep_decls.h b/citadel/sysdep_decls.h index 92eba8d6b..1e0b7a6be 100644 --- a/citadel/sysdep_decls.h +++ b/citadel/sysdep_decls.h @@ -16,7 +16,7 @@ int client_gets (char *buf); void sysdep_master_cleanup (void); void cleanup (int exit_code); void kill_session (int session_to_kill); -void sd_context_loop (struct CitContext *con); +void *sd_context_loop (struct CitContext *con); void start_daemon (int do_close_stdio); void cmd_nset (char *cmdbuf); int convert_login (char *NameToConvert); diff --git a/citadel/userlist.c b/citadel/userlist.c index 2bf663c05..1551daa9b 100644 --- a/citadel/userlist.c +++ b/citadel/userlist.c @@ -84,7 +84,7 @@ void userlist(void) { char buf[256]; char fl[256]; struct tm *tmbuf; - long lc; + time_t lc; serv_puts("LIST"); serv_gets(buf);