From ae822088bca5cce3d6c3ef7f6d312a6d5de7a77c Mon Sep 17 00:00:00 2001 From: Nathan Bryant Date: Tue, 18 Aug 1998 04:50:10 +0000 Subject: [PATCH] Tue Aug 18 00:42:33 EDT 1998 Nathan Bryant * Makefile.in: `clean' target no longer rm's sysdep.h; new target `realclean' removes everything clean does, plus sysdep.h, plus target binaries. * *.[ch]: protoized. Added several new header files containing prototypes and other external declarations; many duplicated declarations still should be moved to header files. proto.h must die as well, IMHO. --- citadel/ChangeLog | 9 ++ citadel/Makefile.in | 20 ++-- citadel/aidepost.c | 13 +-- citadel/citadel.c | 141 ++++++++------------------- citadel/citadel.h | 2 +- citadel/citadel_decls.h | 1 + citadel/citadelapi.c | 17 ++-- citadel/citadelapi.h | 1 + citadel/citmail.c | 51 ++++------ citadel/citserver.c | 16 +-- citadel/citserver.h | 2 + citadel/client_chat.c | 19 ++-- citadel/client_chat.h | 1 + citadel/commands.c | 116 ++++++++++------------ citadel/commands.h | 14 +++ citadel/config.c | 2 +- citadel/{config_decls.h => config.h} | 2 +- citadel/control.c | 8 +- citadel/database.c | 15 +-- citadel/database.h | 3 + citadel/file_ops.c | 2 +- citadel/housekeeping.c | 5 +- citadel/internetmail.c | 2 +- citadel/internetmail.h | 2 + citadel/ipc.h | 4 + citadel/ipc_c_tcp.c | 48 ++++----- citadel/ipcdef.h | 4 +- citadel/mailinglist.c | 12 +-- citadel/messages.c | 29 +++--- citadel/messages.h | 4 + citadel/msgbase.c | 1 + citadel/msgform.c | 27 +++-- citadel/netmailer.c | 38 ++++---- citadel/netpoll.c | 45 ++++----- citadel/netproc.c | 110 ++++++++++----------- citadel/netsetup.c | 50 +++++----- citadel/rcit.c | 20 ++-- citadel/readlog.c | 6 +- citadel/room_ops.c | 1 + citadel/rooms.c | 111 ++++++++++----------- citadel/rooms.h | 19 ++++ citadel/routines.c | 138 ++++++++++++-------------- citadel/routines.h | 15 +++ citadel/routines2.c | 70 ++++++------- citadel/routines2.h | 12 +++ citadel/serv_info.c | 1 + citadel/serv_info.h | 1 + citadel/setup.c | 64 ++++++------ citadel/stats.c | 16 ++- citadel/support.h | 1 + citadel/sysdep.c | 10 +- citadel/sysdep_decls.h | 1 + citadel/user_ops.c | 1 + citadel/userlist.c | 37 +++---- citadel/whobbs.c | 30 +++--- 55 files changed, 668 insertions(+), 722 deletions(-) create mode 100644 citadel/citadel_decls.h create mode 100644 citadel/citadelapi.h create mode 100644 citadel/citserver.h create mode 100644 citadel/client_chat.h create mode 100644 citadel/commands.h rename citadel/{config_decls.h => config.h} (80%) create mode 100644 citadel/database.h create mode 100644 citadel/internetmail.h create mode 100644 citadel/ipc.h create mode 100644 citadel/messages.h create mode 100644 citadel/rooms.h create mode 100644 citadel/routines.h create mode 100644 citadel/routines2.h create mode 100644 citadel/serv_info.h create mode 100644 citadel/support.h create mode 100644 citadel/sysdep_decls.h diff --git a/citadel/ChangeLog b/citadel/ChangeLog index e1de90c51..2f48cb84e 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,3 +1,12 @@ +Tue Aug 18 00:42:33 EDT 1998 Nathan Bryant + * Makefile.in: `clean' target no longer rm's sysdep.h; new target + `realclean' removes everything clean does, plus sysdep.h, plus + target binaries. + * *.[ch]: protoized. Added several new header files containing + prototypes and other external declarations; many duplicated + declarations still should be moved to header files. proto.h must die + as well, IMHO. + Mon Aug 17 23:52:13 EDT 1998 Art Cancro * Implemented a bunch of user account related functions in the CitadelAPI library. diff --git a/citadel/Makefile.in b/citadel/Makefile.in index d58f8e2b5..3649423bc 100644 --- a/citadel/Makefile.in +++ b/citadel/Makefile.in @@ -10,12 +10,16 @@ # ######################################################################## -client: citadel whobbs +CLIENT_TARGETS=citadel whobbs +SERVER_TARGETS=citserver setup citadelapi.a +UTIL_TARGETS=aidepost netmailer netproc netsetup msgform \ + readlog rcit stats sysoputil citmail netpoll mailinglist userlist -server: citserver setup citadelapi.a +client: $(CLIENT_TARGETS) -utils: aidepost netmailer netproc netsetup msgform \ -readlog rcit stats sysoputil citmail netpoll mailinglist userlist +server: $(SERVER_TARGETS) + +utils: $(UTIL_TARGETS) # # @@ -109,7 +113,7 @@ control.o: control.c citadel.h logging.o: logging.c citadel.h $(CC) $(CFLAGS) -D_REENTRANT -c logging.c -config.o: config.c config_decls.h citadel.h axdefs.h +config.o: config.c citadel.h axdefs.h $(CC) -O $(CFLAGS) -D_REENTRANT -c config.c sysdep.o: sysdep.c citadel.h @@ -186,7 +190,7 @@ rcit: rcit.c config.o citadel.h stats: stats.c config.o citadel.h $(CC) -O $(CFLAGS) stats.c config.o $(LFLAGS) -o stats -sysoputil: sysoputil.c config.o config_decls.h citadel.h +sysoputil: sysoputil.c config.o citadel.h $(CC) -O $(CFLAGS) sysoputil.c config.o $(LFLAGS) -o sysoputil chmod 4750 sysoputil @@ -195,4 +199,6 @@ citadel.h: sysdep.h sysconfig.h ipcdef.h server.h clean: find . -name \*.[o] -print -exec rm -f {} \; - rm -f sysdep.h + +realclean: clean + rm -f sysdep.h $(CLIENT_TARGETS) $(SERVER_TARGETS) $(UTIL_TARGETS) diff --git a/citadel/aidepost.c b/citadel/aidepost.c index 7a9f96bbd..f71a0af8c 100644 --- a/citadel/aidepost.c +++ b/citadel/aidepost.c @@ -7,13 +7,12 @@ #include #include #include +#include #include "citadel.h" +#include "config.h" -void get_config(); -struct config config; - -void make_message(filename) -char *filename; { +void make_message(char *filename) +{ FILE *fp; int a; long bb,cc,now; @@ -42,9 +41,7 @@ char *filename; { fclose(fp); } -void main(argc,argv) -int argc; -char *argv[]; +void main(int argc, char **argv) { char tempbase[32]; char temptmp[64]; diff --git a/citadel/citadel.c b/citadel/citadel.c index 80a63c09e..39ab5a7da 100644 --- a/citadel/citadel.c +++ b/citadel/citadel.c @@ -23,6 +23,16 @@ #include "citadel.h" #include "axdefs.h" +#include "serv_info.h" +#include "routines.h" +#include "routines2.h" +#include "commands.h" +#include "rooms.h" +#include "messages.h" +#include "support.h" +#include "ipc.h" +#include "client_chat.h" +#include "citadel_decls.h" struct march { struct march *next; @@ -36,72 +46,6 @@ struct march { #define IFNAIDE if (axlevel<6) struct march *march = NULL; -long finduser(); -void extract(); -long extract_long(); -int extract_int(); -void load_command_set(); -void updatelsa(); -void movefile(); -void deletefile(); -void netsendfile(); -void listzrooms(); -int ka_system(); -void interr(); -int struncmp(); -int yesno(); -void sttybbs(); -void newprompt(); -void strprompt(); -int fmout(); -int checkpagin(); -int pattern(); -int pattern2(); -void readinfo(); -int num_parms(); -void attach_to_server(); -void strproc(); -void enter_config(); -void entregis(); -int entmsg(); -void updatels(); -void forget(); -void readmsgs(); -int getcmd(); -void subshell(); -void entroom(); -void killroom(); -void invite(); -void kickout(); -void editthisroom(); -void roomdir(); -void download(); -void upload(); -void cli_upload(); -void ungoto(); -void whoknows(); -void validate(); -void enterinfo(); -void display_help(); -void edituser(); -void knrooms(); -void locate_host(); -void chatmode(); -void load_floorlist(); -void create_floor(); -void edit_floor(); -void kill_floor(); -void enter_bio(); -void read_bio(); -void misc_server_cmd(); -int nukedir(); -void color(); -void cls(); -void edit_system_message(); -void send_ansi_detect(); -void look_for_ansi(); -void cli_image_upload(); - /* globals associated with the client program */ char temp[16]; /* Name of general temp file */ @@ -140,13 +84,11 @@ char floorlist[128][256]; /* names of floors */ char express_msgs = 0; /* express messages waiting! */ char last_paged[32]=""; -extern char server_is_local; /* defined in ipc module */ - /* * here is our 'clean up gracefully and exit' routine */ -void logoff(code) -int code; { +void logoff(int code) +{ if (editor_pid>0) { /* kill the editor if it's running */ kill(editor_pid,SIGHUP); } @@ -183,8 +125,8 @@ int code; { * We handle "next" and "stop" much differently than in earlier versions. * The signal catching routine simply sets a flag and returns. */ -void sighandler(which_sig) -int which_sig; { +void sighandler(int which_sig) +{ signal(SIGINT,SIG_IGN); signal(SIGQUIT,SIG_IGN); sigcaught = which_sig; @@ -195,7 +137,7 @@ int which_sig; { /* * signal catching function for hangups... */ -void dropcarr() { +void dropcarr(int signum) { logoff(SIGHUP); } @@ -203,8 +145,8 @@ void dropcarr() { /* general purpose routines */ -void formout(name) /* display a file */ -char name[]; +void formout(char *name) /* display a file */ + { char cmd[256]; sprintf(cmd,"MESG %s",name); @@ -220,7 +162,7 @@ char name[]; } -void userlist() { +void userlist(void) { char buf[256]; char fl[256]; struct tm *tmbuf; @@ -266,8 +208,8 @@ void userlist() { /* * grab assorted info about the user... */ -void load_user_info(params) -char *params; { +void load_user_info(char *params) +{ extract(fullname,params,0); axlevel = extract_int(params,1); timescalled = extract_int(params,2); @@ -282,9 +224,8 @@ char *params; { * 'roomname' is set to _FLOOR_, in which case all rooms on the requested * floor will be removed from the march list. */ -void remove_march(roomname,floornum) -char *roomname; -int floornum; { +void remove_march(char *roomname, int floornum) +{ struct march *mptr,*mptr2; if (march==NULL) return; @@ -317,7 +258,7 @@ int floornum; { /* * sort the march list by floor */ -void sort_march_list() { +void sort_march_list(void) { struct march *mlist[129]; struct march *mptr = NULL; int a; @@ -368,9 +309,8 @@ void sort_march_list() { /* * jump directly to a room */ -void dotgoto(towhere,display_name) -char *towhere; -int display_name; { +void dotgoto(char *towhere, int display_name) +{ char aaa[256],bbb[256],psearch[256]; static long ls = 0L; int newmailcount; @@ -480,7 +420,7 @@ int display_name; { * We start the search in the current room rather than the beginning to prevent * two or more concurrent users from dragging each other back to the same room. */ -void gotonext() { +void gotonext(void) { char buf[256]; struct march *mptr,*mptr2; char next_room[32]; @@ -546,8 +486,8 @@ void gotonext() { /* * forget all rooms on a given floor */ -void forget_all_rooms_on(ffloor) -int ffloor; { +void forget_all_rooms_on(int ffloor) +{ char buf[256]; struct march *flist,*fptr; @@ -586,9 +526,8 @@ int ffloor; { /* * routine called by gotofloor() to move to a new room on a new floor */ -void gf_toroom(towhere,mode) -char *towhere; -int mode; { +void gf_toroom(char *towhere, int mode) +{ int floor_being_left; floor_being_left = curr_floor; @@ -614,9 +553,8 @@ int mode; { /* * go to a new floor */ -void gotofloor(towhere,mode) -char *towhere; -int mode; { +void gotofloor(char *towhere, int mode) +{ int a,tofloor; struct march *mptr; char buf[256],targ[256]; @@ -671,7 +609,7 @@ int mode; { /* * forget all rooms on current floor */ -void forget_this_floor() { +void forget_this_floor(void) { if (curr_floor == 0) { printf("Can't forget this floor.\n"); @@ -690,7 +628,7 @@ void forget_this_floor() { /* * Figure out the physical screen dimensions, if we can */ -void check_screen_dims() { +void check_screen_dims(void) { #ifdef TIOCGWINSZ struct { unsigned short height; /* rows */ @@ -712,7 +650,7 @@ void check_screen_dims() { /* * set floor mode depending on client, server, and user settings */ -void set_floor_mode() { +void set_floor_mode(void) { if (serv_info.serv_ok_floors == 0) { floor_mode = 0; /* Don't use floors if the server */ } /* doesn't support them! */ @@ -732,7 +670,7 @@ void set_floor_mode() { /* * Set or change the user's password */ -int set_password() { +int set_password(void) { char pass1[20]; char pass2[20]; char buf[256]; @@ -764,7 +702,7 @@ int set_password() { /* * get info about the server we've connected to */ -void get_serv_info() { +void get_serv_info(void) { char buf[256]; CtdlInternalGetServInfo(&serv_info); @@ -847,9 +785,8 @@ void enternew(char *desc, char *buf, int maxlen) /* * main */ -void main(argc,argv) -int argc; -char *argv[]; { +void main(int argc, char **argv) +{ int a,b,mcmd; int termn8 = 0; char aaa[100],bbb[100],ccc[100],eee[100]; /* general purpose variables */ diff --git a/citadel/citadel.h b/citadel/citadel.h index 1ac342999..2cf6bef74 100644 --- a/citadel/citadel.h +++ b/citadel/citadel.h @@ -7,7 +7,7 @@ #include "sysdep.h" #include "sysconfig.h" #include "ipcdef.h" -#define CITADEL "Citadel/UX DR19980806" +#define CITADEL "Citadel/UX DR19980815" #define REV_LEVEL 503 #define SERVER_TYPE 0 /* zero for stock Citadel/UX; other developers please obtain SERVER_TYPE codes for your implementations */ diff --git a/citadel/citadel_decls.h b/citadel/citadel_decls.h new file mode 100644 index 000000000..d858f0b53 --- /dev/null +++ b/citadel/citadel_decls.h @@ -0,0 +1 @@ +extern char fullname[32]; diff --git a/citadel/citadelapi.c b/citadel/citadelapi.c index 4ada1e108..199ea68c1 100644 --- a/citadel/citadelapi.c +++ b/citadel/citadelapi.c @@ -6,6 +6,9 @@ #include #include #include "citadel.h" +#include "serv_info.h" +#include "ipc.h" +#include "citadelapi.h" struct CtdlInternalList { @@ -18,9 +21,7 @@ struct CtdlServerHandle CtdlAppHandle; struct CtdlServInfo CtdlAppServInfo; int CtdlErrno = 0; -void CtdlMain(); - -void logoff(exitcode) { +void logoff(int exitcode) { exit(exitcode); } @@ -123,9 +124,9 @@ long CtdlInternalExtractLong(char *source, long int parmnum) * */ -main(argc, argv) -int argc; -char *argv[]; { +int +main(int argc, char *argv[]) +{ int a; char buf[256]; @@ -168,7 +169,7 @@ char *argv[]; { /* Set up the server environment to our liking */ - CtdlInternalGetServInfo(&CtdlAppServInfo, 0); + CtdlInternalGetServInfo(&CtdlAppServInfo); sprintf(buf, "IDEN 0|5|006|CitadelAPI Client"); serv_puts(buf); @@ -206,7 +207,7 @@ char *argv[]; { } -int CtdlGetLastError() { +int CtdlGetLastError(void) { return CtdlErrno; } diff --git a/citadel/citadelapi.h b/citadel/citadelapi.h new file mode 100644 index 000000000..3da2adb8a --- /dev/null +++ b/citadel/citadelapi.h @@ -0,0 +1 @@ +void CtdlMain(void); diff --git a/citadel/citmail.c b/citadel/citmail.c index f2c367fcc..1dbc5da36 100644 --- a/citadel/citmail.c +++ b/citadel/citmail.c @@ -26,7 +26,10 @@ #include #include #include +#include #include "citadel.h" +#include "config.h" +#include "internetmail.h" #define LOCAL 0 #define REMOTE 1 @@ -39,13 +42,6 @@ char *monthdesc[] = { "Jan","Feb","Mar","Apr","May","Jun", "Jul","Aug","Sep","Oct","Nov","Dec" }; - - -void LoadInternetConfig(); -void get_config(); -int IsHostLocal(); -struct config config; - char ALIASES[128]; char CIT86NET[128]; char SENDMAIL[128]; @@ -56,8 +52,8 @@ char OUTGOING_FQDN[128]; int RUN_NETPROC = 1; -long conv_date(sdbuf) -char sdbuf[]; { +long conv_date(char *sdbuf) +{ int a,b,cpos,tend,tval; long now; struct tm *tmbuf; @@ -131,8 +127,8 @@ char sdbuf[]; { /* * replacement strerror() for systems that don't have it */ -char *strerror(e) -int e; { +char *strerror(int e) +{ static char buf[32]; sprintf(buf,"errno = %d",e); @@ -140,24 +136,23 @@ int e; { } #endif -int haschar(st,ch) -char st[]; -int ch; { +int haschar(char *st, int ch) +{ int a,b; b=0; for (a=0; a0) && (buf[0]==32) ) strcpy(buf,&buf[1]); while (buf[strlen(buf)-1] == 32) buf[strlen(buf)-1] = 0; } @@ -196,11 +191,8 @@ void host_alias(char host[]) { /* * Split an RFC822-style address into userid, host, and full name */ -void process_rfc822_addr(rfc822,user,node,name) -char rfc822[]; -char user[]; -char node[]; -char name[]; { +void process_rfc822_addr(char *rfc822, char *user, char *node, char *name) +{ int a; /* extract full name - first, it's From minus */ @@ -434,8 +426,8 @@ void do_citmail(char recp[], int dtype) { } -void do_uudecode(target) -char *target; { +void do_uudecode(char *target) +{ static char buf[1024]; FILE *fp; @@ -450,8 +442,8 @@ char *target; { } -int alias(name) -char *name; { +int alias(char *name) +{ FILE *fp; int a; char abuf[256]; @@ -516,9 +508,8 @@ void deliver(char recp[], int is_test, int deliver_to_ignet) { -void main(argc,argv) -int argc; -char *argv[]; { +void main(int argc, char **argv) +{ int is_test = 0; int deliver_to_ignet = 0; int smtp = 0; diff --git a/citadel/citserver.c b/citadel/citserver.c index 3c6d61dfd..94ed1d3cd 100644 --- a/citadel/citserver.c +++ b/citadel/citserver.c @@ -12,17 +12,17 @@ #include "citadel.h" #include "server.h" #include "proto.h" - -struct config config; +#include "sysdep_decls.h" +#include "citserver.h" +#include "config.h" struct CitContext *ContextList = NULL; int ScheduledShutdown = 0; - /* * Various things that need to be initialized at startup */ -void master_startup() { +void master_startup(void) { lprintf(7, "Opening databases\n"); open_databases(); @@ -33,7 +33,7 @@ void master_startup() { /* * Cleanup routine to be called when the server is shutting down. */ -void master_cleanup() { +void master_cleanup(void) { /* Cancel all running sessions */ lprintf(7, "Cancelling running sessions...\n"); @@ -62,7 +62,7 @@ void master_cleanup() { * All NON-system-dependent stuff is done in this function. * System-dependent session/thread cleanup is in cleanup() in sysdep.c */ -void cleanup_stuff() +void cleanup_stuff(void *arg) { struct ExpressMessage *emptr; @@ -178,7 +178,7 @@ void cmd_uchg(char *newusername) cprintf("%d\n",OK); } -void cmd_time() +void cmd_time(void) { time_t tv; @@ -1059,7 +1059,7 @@ void *context_loop(struct CitContext *con) } else if (!strncasecmp(cmdbuf, "TIME", 4)) { - cmd_time(&cmdbuf[5]); + cmd_time(); } else if (!strncasecmp(cmdbuf, "HCHG", 4)) { diff --git a/citadel/citserver.h b/citadel/citserver.h new file mode 100644 index 000000000..0b70e0b68 --- /dev/null +++ b/citadel/citserver.h @@ -0,0 +1,2 @@ +void master_cleanup(void); +void cleanup_stuff(void *); diff --git a/citadel/client_chat.c b/citadel/client_chat.c index 6316a138e..a57d09f82 100644 --- a/citadel/client_chat.c +++ b/citadel/client_chat.c @@ -21,20 +21,13 @@ #include #endif #include "citadel.h" +#include "client_chat.h" +#include "commands.h" +#include "routines.h" +#include "ipc.h" +#include "citadel_decls.h" -extern char fullname[]; - -int inkey(); -void set_keepalives(); -int num_parms(); -void extract(); -int struncmp(); -int getsockfd(); -char serv_getc(); -void color(); - - -void chatmode() { +void chatmode(void) { char wbuf[256]; char buf[256]; char c_user[256]; diff --git a/citadel/client_chat.h b/citadel/client_chat.h new file mode 100644 index 000000000..4243c503a --- /dev/null +++ b/citadel/client_chat.h @@ -0,0 +1 @@ +void chatmode(void); diff --git a/citadel/commands.c b/citadel/commands.c index 55a90dcfd..a0b35bb67 100644 --- a/citadel/commands.c +++ b/citadel/commands.c @@ -31,6 +31,7 @@ #include #include #include "citadel.h" +#include "commands.h" struct citcmd { struct citcmd *next; @@ -64,14 +65,14 @@ char *gl_string; struct citcmd *cmdlist = NULL; -void sighandler(); -void logoff(); -int struncmp(); -void formout(); -int room_prompt(); -void back(); -int checkpagin(); -void color(); +void sighandler(int which_sig); +void logoff(int code); +int struncmp(char *lstr, char *rstr, int len); +void formout(char *name); +int room_prompt(int qrflags); +void back(int spaces); +int checkpagin(int lp, int pagin, int height); +void color(int colornum); /* these variables are local to this module */ @@ -84,7 +85,7 @@ int enable_color = 0; /* nonzero for ANSI color */ /* * print_express() - print express messages if there are any */ -void print_express() { +void print_express(void) { char buf[256]; FILE *outpipe; @@ -119,15 +120,15 @@ void print_express() { } -void set_keepalives(s) -int s; { +void set_keepalives(int s) +{ keepalives_enabled = (char)s; } /* * This loop handles the "keepalive" messages sent to the server when idling. */ -void do_keepalive() { +void do_keepalive(void) { char buf[256]; static long idlet = 0L; long now; @@ -155,7 +156,7 @@ void do_keepalive() { } -int inkey() { /* get a character from the keyboard, with */ +int inkey(void) { /* get a character from the keyboard, with */ int a; /* the watchdog timer in effect if necessary */ fd_set rfds; struct timeval tv; @@ -205,9 +206,9 @@ int inkey() { /* get a character from the keyboard, with */ return(a); } -void getline(string,lim) /* Gets a line from the terminal */ -char string[]; /* Pointer to string buffer */ -int lim; /* Maximum length - if negative, no-show */ +void getline(char *string, int lim) /* Gets a line from the terminal */ + /* Pointer to string buffer */ + /* Maximum length - if negative, no-show */ { int a,b; char flag = 0; @@ -240,10 +241,8 @@ GLA: a=inkey(); a=(a&127); * strprompt() - prompt for a string, print the existing value and * allow the user to press return to keep it... */ -void strprompt(prompt,str,len) -char *prompt; -char *str; -int len; { +void strprompt(char *prompt, char *str, int len) +{ char buf[128]; print_express(); color(3); @@ -262,11 +261,8 @@ int len; { * intprompt() - like strprompt(), except for an integer * (note that it RETURNS the new value!) */ -int intprompt(prompt,ival,imin,imax) -char *prompt; -int ival; -int imin; -int imax; { +int intprompt(char *prompt, int ival, int imin, int imax) +{ char buf[16]; int i; i = ival; @@ -284,10 +280,8 @@ int imax; { * newprompt() - prompt for a string with no existing value * (clears out string buffer first) */ -void newprompt(prompt,str,len) -char *prompt; -char *str; -int len; { +void newprompt(char *prompt, char *str, int len) +{ color(3); printf("%s",prompt); color(2); @@ -296,7 +290,7 @@ int len; { } -int lkey() { /* returns a lower case value */ +int lkey(void) { /* returns a lower case value */ int a; a=inkey(); if (isupper(a)) a=tolower(a); @@ -306,7 +300,7 @@ int lkey() { /* returns a lower case value */ /* * parse the citadel.rc file */ -void load_command_set() { +void load_command_set(void) { FILE *ccfile; char buf[256]; struct citcmd *cptr; @@ -420,8 +414,8 @@ void load_command_set() { /* * return the key associated with a command */ -char keycmd(cmdstr) -char cmdstr[]; { +char keycmd(char *cmdstr) +{ int a; for (a=0; aommand key highlighting */ -char *cmd_expand(strbuf,mode) -char strbuf[]; -int mode; { +char *cmd_expand(char *strbuf, int mode) +{ int a; static char exp[64]; char buf[256]; @@ -483,10 +476,8 @@ int mode; { * Comparison function to determine if entered commands match a * command loaded from the config file. */ -int cmdmatch(cmdbuf,cptr,ncomp) -char cmdbuf[]; -struct citcmd *cptr; -int ncomp; { +int cmdmatch(char *cmdbuf, struct citcmd *cptr, int ncomp) +{ int a; int cmdax; @@ -506,9 +497,8 @@ int ncomp; { /* * This function returns 1 if a given command requires a string input */ -int requires_string(cptr,ncomp) -struct citcmd *cptr; -int ncomp; { +int requires_string(struct citcmd *cptr, int ncomp) +{ int a; char buf[64]; @@ -525,8 +515,8 @@ int ncomp; { * This function returns an integer command number. If the command prompts * for a string then it is placed in the supplied buffer. */ -int getcmd(argbuf) -char *argbuf; { +int getcmd(char *argbuf) +{ char cmdbuf[5]; int cmdspaces[5]; int cmdpos; @@ -625,8 +615,8 @@ char *argbuf; { * 3 - restore saved settings */ #ifdef POSIX_TERMIO -void sttybbs(cmd) /* SysV version of sttybbs() */ -int cmd; { +void sttybbs(int cmd) /* SysV version of sttybbs() */ + { struct termios live; static struct termios saved_settings; @@ -668,8 +658,8 @@ int cmd; { } } #else -void sttybbs(cmd) /* BSD version of sttybbs() */ -int cmd; { +void sttybbs(int cmd) /* BSD version of sttybbs() */ +{ struct sgttyb live; static struct sgttyb saved_settings; @@ -695,8 +685,8 @@ int cmd; { /* * display_help() - help file viewer */ -void display_help(name) -char name[]; { +void display_help(char *name) +{ formout(name); } @@ -704,13 +694,13 @@ char name[]; { /* * fmout() - Citadel text formatter and paginator */ -int fmout(width,fp,pagin,height,starting_lp,subst) -int width; /* screen width to use */ -FILE *fp; /* file to read from, or NULL to read from server */ -char pagin; /* nonzero if we should use the paginator */ -int height; /* screen height to use */ -int starting_lp; /* starting value for lines_printed, -1 for global */ -char subst; /* nonzero if we should use hypertext mode */ +int fmout(int width, FILE *fp, char pagin, int height, int starting_lp, char subst) + /* screen width to use */ + /* file to read from, or NULL to read from server */ + /* nonzero if we should use the paginator */ + /* screen height to use */ + /* starting value for lines_printed, -1 for global */ + /* nonzero if we should use hypertext mode */ { int a,b,c,d,old; int real = (-1); @@ -816,8 +806,8 @@ FMTEND: printf("\n"); /* * support ANSI color if defined */ -void color(colornum) -int colornum; { +void color(int colornum) +{ #ifdef ANSI_COLOR if (enable_color) { @@ -828,7 +818,7 @@ int colornum; { #endif } -void cls() { +void cls(void) { #ifdef ANSI_COLOR fflush(stdout); printf("%c[2J%c[H", 27, 27); @@ -840,7 +830,7 @@ void cls() { /* * Detect whether ANSI color is available (answerback) */ -void send_ansi_detect() { +void send_ansi_detect(void) { #ifdef ANSI_COLOR printf("%c[c", 27); fflush(stdout); @@ -848,7 +838,7 @@ void send_ansi_detect() { #endif } -void look_for_ansi() { +void look_for_ansi(void) { #ifdef ANSI_COLOR fd_set rfds; struct timeval tv; diff --git a/citadel/commands.h b/citadel/commands.h new file mode 100644 index 000000000..c2e01bbfd --- /dev/null +++ b/citadel/commands.h @@ -0,0 +1,14 @@ +void load_command_set(void); +void sttybbs(int cmd); +void newprompt(char *prompt, char *str, int len); +void strprompt(char *prompt, char *str, int len); +int fmout(int width, FILE *fp, char pagin, int height, int starting_lp, + char subst); +int getcmd(char *argbuf); +void display_help(char *name); +void color(int colornum); +void cls(void); +void send_ansi_detect(void); +void look_for_ansi(void); +int inkey(void); +void set_keepalives(int s); diff --git a/citadel/config.c b/citadel/config.c index 68fa84b40..d41c0f0b1 100644 --- a/citadel/config.c +++ b/citadel/config.c @@ -11,7 +11,7 @@ #include #include #include "citadel.h" -#include "config_decls.h" +#include "config.h" struct config config; char bbs_home_directory[PATH_MAX]; diff --git a/citadel/config_decls.h b/citadel/config.h similarity index 80% rename from citadel/config_decls.h rename to citadel/config.h index d68084487..87bd2ead4 100644 --- a/citadel/config_decls.h +++ b/citadel/config.h @@ -1,4 +1,4 @@ -void get_config(); +void get_config(void); extern struct config config; extern char bbs_home_directory[PATH_MAX]; extern int home_specified; diff --git a/citadel/control.c b/citadel/control.c index b0cc45f23..4aa5baf77 100644 --- a/citadel/control.c +++ b/citadel/control.c @@ -25,7 +25,7 @@ struct CitControl CitControl; /* * get_control - read the control record into memory. */ -void get_control() { +void get_control(void) { FILE *fp; /* Zero it out. If the control record on disk is missing or short, @@ -43,7 +43,7 @@ void get_control() { /* * put_control - write the control record to disk. */ -void put_control() { +void put_control(void) { FILE *fp; fp = fopen("citadel.control", "wb"); @@ -57,7 +57,7 @@ void put_control() { /* * get_new_message_number() - Obtain a new, unique ID to be used for a message. */ -long get_new_message_number() { +long get_new_message_number(void) { begin_critical_section(S_CONTROL); get_control(); ++CitControl.MMhighest; @@ -70,7 +70,7 @@ long get_new_message_number() { /* * get_new_user_number() - Obtain a new, unique ID to be used for a user. */ -long get_new_user_number() { +long get_new_user_number(void) { begin_critical_section(S_CONTROL); get_control(); ++CitControl.MMnextuser; diff --git a/citadel/database.c b/citadel/database.c index ea390bf01..3f47453bd 100644 --- a/citadel/database.c +++ b/citadel/database.c @@ -16,6 +16,7 @@ #include "citadel.h" #include "server.h" #include "proto.h" +#include "database.h" /* @@ -35,7 +36,7 @@ datum dtkey[MAXKEYS]; * Reclaim unused space in the databases. We need to do each one of * these discretely, rather than in a loop. */ -void defrag_databases() { +void defrag_databases(void) { /* defrag the message base */ begin_critical_section(S_MSGMAIN); @@ -65,7 +66,7 @@ void defrag_databases() { * Open the various gdbm databases we'll be using. Any database which * does not exist should be created. */ -void open_databases() { +void open_databases(void) { int a; gdbms[CDB_MSGMAIN] = gdbm_open("msgmain.gdbm", 8192, @@ -122,7 +123,7 @@ void open_databases() { * Close all of the gdbm database files we've opened. This can be done * in a loop, since it's just a bunch of closes. */ -void close_databases() { +void close_databases(void) { int a; defrag_databases(); @@ -145,8 +146,8 @@ void close_databases() { * datum already exists it should be overwritten. */ int cdb_store(int cdb, - char *key, int keylen, - char *data, int datalen) { + void *key, int keylen, + void *data, int datalen) { datum dkey, ddata; @@ -167,7 +168,7 @@ int cdb_store(int cdb, /* * Delete a piece of data. Returns 0 if the operation was successful. */ -int cdb_delete(int cdb, char *key, int keylen) { +int cdb_delete(int cdb, void *key, int keylen) { datum dkey; @@ -186,7 +187,7 @@ int cdb_delete(int cdb, char *key, int keylen) { * a struct cdbdata which it is the caller's responsibility to free later on * using the cdb_free() routine. */ -struct cdbdata *cdb_fetch(int cdb, char *key, int keylen) { +struct cdbdata *cdb_fetch(int cdb, void *key, int keylen) { struct cdbdata *tempcdb; datum dkey, dret; diff --git a/citadel/database.h b/citadel/database.h new file mode 100644 index 000000000..52d00de40 --- /dev/null +++ b/citadel/database.h @@ -0,0 +1,3 @@ +struct cdbdata *cdb_fetch(int cdb, void *key, int keylen); +int cdb_store(int cdb, void *key, int keylen, void *data, int datalen); +int cdb_delete(int cdb, void *key, int keylen); diff --git a/citadel/file_ops.c b/citadel/file_ops.c index 340915874..b0ae01a67 100644 --- a/citadel/file_ops.c +++ b/citadel/file_ops.c @@ -219,7 +219,7 @@ void cmd_netf(char *cmdbuf) * It examines the file and displays the OK result code and some information * about the file. NOTE: this stuff is Unix dependent. */ -void OpenCmdResult() { +void OpenCmdResult(void) { struct stat statbuf; fstat(fileno(CC->download_fp), &statbuf); diff --git a/citadel/housekeeping.c b/citadel/housekeeping.c index e1c15e492..b4d76e970 100644 --- a/citadel/housekeeping.c +++ b/citadel/housekeeping.c @@ -15,6 +15,7 @@ #include "citadel.h" #include "server.h" #include "proto.h" +#include "citserver.h" /* * Terminate idle sessions. This function pounds through the session table @@ -42,7 +43,7 @@ void terminate_idle_sessions(void) { /* * Main housekeeping function. This gets run whenever a session terminates. */ -void do_housekeeping() { +void do_housekeeping(void) { begin_critical_section(S_HOUSEKEEPING); /* @@ -68,7 +69,7 @@ void do_housekeeping() { * Check (and fix) floor reference counts. This doesn't need to be done * very often, since the counts should remain correct during normal operation. */ -void check_ref_counts() { +void check_ref_counts(void) { int ref[MAXFLOORS]; struct quickroom qrbuf; struct floor flbuf; diff --git a/citadel/internetmail.c b/citadel/internetmail.c index d0471d664..17b18fca2 100644 --- a/citadel/internetmail.c +++ b/citadel/internetmail.c @@ -33,7 +33,7 @@ void StripLeadingAndTrailingWhitespace(char *str) { while (isspace(str[strlen(str)-1])) str[strlen(str)-1] = 0; } -void LoadInternetConfig() { +void LoadInternetConfig(void) { char ParamName[256], ParamValue[256], buf[256]; FILE *conf; int a, eqpos; diff --git a/citadel/internetmail.h b/citadel/internetmail.h new file mode 100644 index 000000000..00c565297 --- /dev/null +++ b/citadel/internetmail.h @@ -0,0 +1,2 @@ +void LoadInternetConfig(void); +int IsHostLocal(char *WhichHost); diff --git a/citadel/ipc.h b/citadel/ipc.h new file mode 100644 index 000000000..930550654 --- /dev/null +++ b/citadel/ipc.h @@ -0,0 +1,4 @@ +void attach_to_server(int argc, char **argv); +extern char server_is_local; +int getsockfd(void); +char serv_getc(void); diff --git a/citadel/ipc_c_tcp.c b/citadel/ipc_c_tcp.c index df0844455..744feb6d9 100644 --- a/citadel/ipc_c_tcp.c +++ b/citadel/ipc_c_tcp.c @@ -19,12 +19,14 @@ #include #include #include +#include #include #include #include #include +#include "ipc.h" -void logoff(); +void logoff(int code); /* * If server_is_local is set to nonzero, the client assumes that it is running @@ -45,17 +47,13 @@ char server_is_local = 0; int serv_sock; -u_long inet_addr(); - -void CtdlInternalTCPtimeout() { +void CtdlInternalTCPtimeout(int signum) { printf("\rConnection timed out.\n"); logoff(3); } -int CtdlInternalTCPConnectSock(host,service,protocol) -char *host; -char *service; -char *protocol; { +int CtdlInternalTCPConnectSock(char *host, char *service, char *protocol) +{ struct hostent *phe; struct servent *pse; struct protoent *ppe; @@ -124,11 +122,8 @@ char *protocol; { * convert service and host entries into a six-byte numeric in the format * expected by a SOCKS v4 server */ -void CtdlInternalTCPnumericize(buf,host,service,protocol) -unsigned char buf[]; -char *host; -char *service; -char *protocol; { +void CtdlInternalTCPnumericize(unsigned char *buf, char *host, char *service, char *protocol) +{ struct hostent *phe; struct servent *pse; struct sockaddr_in sin; @@ -167,9 +162,8 @@ char *protocol; { /* * input binary data from socket */ -void serv_read(buf,bytes) -char buf[]; -int bytes; { +void serv_read(char *buf, int bytes) +{ int len,rlen; len = 0; @@ -188,9 +182,8 @@ int bytes; { /* * send binary to server */ -void serv_write(buf, nbytes) -char buf[]; -int nbytes; { +void serv_write(char *buf, int nbytes) +{ int bytes_written = 0; int retval; while (bytes_written < nbytes) { @@ -210,8 +203,8 @@ int nbytes; { /* * input string from socket - implemented in terms of serv_read() */ -void serv_gets(buf) -char buf[]; { +void serv_gets(char *buf) +{ buf[0] = 0; do { buf[strlen(buf) + 1] = 0; @@ -225,8 +218,8 @@ char buf[]; { /* * send line to server - implemented in terms of serv_write() */ -void serv_puts(buf) -char *buf; { +void serv_puts(char *buf) +{ /* printf("< %s\n", buf); */ serv_write(buf, strlen(buf)); serv_write("\n", 1); @@ -236,9 +229,8 @@ char *buf; { /* * attach to server */ -void attach_to_server(argc,argv) -int argc; -char *argv[]; { +void attach_to_server(int argc, char **argv) +{ int a; char cithost[256]; int host_copied = 0; char citport[256]; int port_copied = 0; @@ -316,7 +308,7 @@ char *argv[]; { /* * return the file descriptor of the server socket so we can select() on it. */ -int getsockfd() { +int getsockfd(void) { return serv_sock; } @@ -324,7 +316,7 @@ int getsockfd() { /* * return one character */ -char serv_getc() { +char serv_getc(void) { char buf[2]; char ch; diff --git a/citadel/ipcdef.h b/citadel/ipcdef.h index 808d2143a..f6365f4fa 100644 --- a/citadel/ipcdef.h +++ b/citadel/ipcdef.h @@ -70,8 +70,8 @@ struct CtdlServInfo { #define US_USER_SET (US_LASTOLD | US_EXPERT | US_UNLISTED | \ US_NOPROMPT | US_DISAPPEAR | US_PAGINATOR | US_FLOORS) -void serv_puts(); -void serv_gets(); +void serv_puts(char *buf); +void serv_gets(char *buf); struct CtdlServerHandle { char ServerAddress[64]; diff --git a/citadel/mailinglist.c b/citadel/mailinglist.c index 24179f5d6..b8e5572d9 100644 --- a/citadel/mailinglist.c +++ b/citadel/mailinglist.c @@ -25,8 +25,8 @@ #include #include "citadel.h" -void LoadInternetConfig(); -void get_config(); +void LoadInternetConfig(void); +void get_config(void); struct config config; char ALIASES[128]; @@ -42,9 +42,9 @@ int RUN_NETPROC = 1; * Consult the mailinglists table to find out where we should send the * mailing list postings to. */ -void xref(room,listaddr) /* xref table */ -char room[]; -char listaddr[]; { +void xref(char *room, char *listaddr) /* xref table */ + + { FILE *fp; int a; char buf[128]; @@ -68,7 +68,7 @@ char listaddr[]; { /* * The main loop. We don't need any command-line parameters to this program. */ -void main() { +void main(void) { char header[3]; char fields[32][1024]; diff --git a/citadel/messages.c b/citadel/messages.c index 22d2c4953..6628409d2 100644 --- a/citadel/messages.c +++ b/citadel/messages.c @@ -16,6 +16,7 @@ #include #include #include "citadel.h" +#include "messages.h" #define MAXWORDBUF 256 #define MAXMSGS 512 @@ -25,20 +26,20 @@ struct cittext { char text[MAXWORDBUF]; }; -long finduser(); -char inkey(); -void sttybbs(); -int struncmp(); -int fmout(); -int haschar(); -int checkpagin(); -void getline(); -void formout(); -int yesno(); -void newprompt(); -int file_checksum(); -void color(); -void do_edit(); +long finduser(int file, char *name); +char inkey(void); +void sttybbs(int cmd); +int struncmp(char *lstr, char *rstr, int len); +int fmout(int width, FILE *fp, char pagin, int height, int starting_lp, char subst); +int haschar(char *st, int ch); +int checkpagin(int lp, int pagin, int height); +void getline(char *string, int lim); +void formout(char *name); +int yesno(void); +void newprompt(char *prompt, char *str, int len); +int file_checksum(char *filename); +void color(int colornum); +void do_edit(char *desc, char *read_cmd, char *check_cmd, char *write_cmd); char reply_to[512]; long msg_arr[MAXMSGS]; diff --git a/citadel/messages.h b/citadel/messages.h new file mode 100644 index 000000000..1b9d2a7ca --- /dev/null +++ b/citadel/messages.h @@ -0,0 +1,4 @@ +int ka_system(char *shc); +int entmsg(int is_reply, int c); +void readmsgs(int c, int rdir, int q); +void edit_system_message(char *which_message); diff --git a/citadel/msgbase.c b/citadel/msgbase.c index 93eab6e98..597f62725 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -12,6 +12,7 @@ #include #include #include "proto.h" +#include "database.h" #define MSGS_ALL 0 #define MSGS_OLD 1 diff --git a/citadel/msgform.c b/citadel/msgform.c index 6b47b83ef..1fbe5d42f 100644 --- a/citadel/msgform.c +++ b/citadel/msgform.c @@ -21,19 +21,19 @@ #include #include -long finduser(); -int fmout(); -int fpgetfield(); int qwk = 0; +int fpgetfield(FILE *fp, char *string); +int fmout(int width, FILE *fp); + #ifdef NO_STRERROR /* * replacement strerror() for systems that don't have it */ -char *strerror(e) -int e; { +char *strerror(int e) +{ static char buf[32]; sprintf(buf,"errno = %d",e); @@ -41,9 +41,8 @@ int e; { } #endif -void main(argc,argv) -int argc; -char *argv[]; { +void main(int argc, char **argv) +{ struct tm *tm; int a,b,e,mtype,aflag; char bbb[1024]; @@ -104,9 +103,9 @@ TOP: do { goto TOP; } -int fpgetfield(fp,string) /* level-2 break out next null-terminated string */ -FILE *fp; -char string[]; +int fpgetfield(FILE *fp, char *string) /* level-2 break out next null-terminated string */ + + { int a,b; strcpy(string,""); @@ -120,10 +119,8 @@ a=0; return(0); } -int fmout(width,fp) -int width; -FILE *fp; - { +int fmout(int width, FILE *fp) +{ int a,b,c; int real = 0; int old = 0; diff --git a/citadel/netmailer.c b/citadel/netmailer.c index 282cce16c..47c4d965b 100644 --- a/citadel/netmailer.c +++ b/citadel/netmailer.c @@ -16,8 +16,8 @@ #include #include "citadel.h" -void LoadInternetConfig(); -void get_config(); +void LoadInternetConfig(void); +void get_config(void); struct config config; char temp[20]; @@ -30,9 +30,8 @@ char GW_DOMAIN[128]; char TABLEFILE[128]; int RUN_NETPROC = 1; -int haschar(st,ch) -char st[]; -int ch; { +int haschar(char *st, int ch) +{ int a,b; b=0; for (a=0; anext) if ( @@ -458,8 +458,8 @@ char *k_person,*k_room,*k_system; { return(0); } -int get_sysinfo_type(name) /* determine routing from sysinfo file */ -char name[]; { +int get_sysinfo_type(char *name) /* determine routing from sysinfo file */ + { struct syslist *stemp; GETSN: for (stemp=slist; stemp!=NULL; stemp=stemp->next) { if (!strcasecmp(stemp->s_name,name)) { @@ -480,9 +480,8 @@ GETSN: for (stemp=slist; stemp!=NULL; stemp=stemp->next) { } -void fpgetfield(fp,string) -FILE *fp; -char string[]; { +void fpgetfield(FILE *fp, char *string) +{ int a,b; strcpy(string,""); @@ -504,9 +503,8 @@ char string[]; { * Load all of the fields of a message, except the actual text, into a * table in memory (so we know how to process the message). */ -void msgfind(msgfile,buffer) -char *msgfile; -struct minfo *buffer; { +void msgfind(char *msgfile, struct minfo *buffer) +{ int b,e,mtype,aflag; char bbb[1024]; char userid[1024]; @@ -574,9 +572,9 @@ END: if (buffer->I==0L) buffer->I=buffer->T; fclose(fp); } -void ship_to(filenm,sysnm) /* send spool file filenm to system sysnm */ -char *filenm; -char *sysnm; { +void ship_to(char *filenm, char *sysnm) /* send spool file filenm to system sysnm */ + + { char sysflnm[100]; char commbuf1[100]; char commbuf2[100]; @@ -598,8 +596,8 @@ char *sysnm; { /* * proc_file_transfer() - handle a simple file transfer packet */ -void proc_file_transfer(tname) -char *tname; { /* name of temp file containing the whole message */ +void proc_file_transfer(char *tname) +{ /* name of temp file containing the whole message */ char buf[128]; char dest_dir[32]; FILE *tfp,*uud; @@ -648,8 +646,8 @@ char *tname; { /* name of temp file containing the whole message */ /* send a bounce message */ -void bounce(bminfo) -struct minfo *bminfo; { +void bounce(struct minfo *bminfo) +{ FILE *bounce; char bfilename[64]; @@ -690,7 +688,7 @@ struct minfo *bminfo; { /* * process incoming files in ./network/spoolin */ -void inprocess() { +void inprocess(void) { FILE *fp,*message,*testfp,*ls; static struct minfo minfo; struct recentmsg recentmsg; @@ -946,9 +944,9 @@ ENDSTR: fclose(fp); } -int checkpath(path,sys) /* Checks to see whether its ok to send */ -char path[]; /* Returns 1 for ok, send message */ -char sys[]; { /* Returns 0 if message already there */ +int checkpath(char *path, char *sys) /* Checks to see whether its ok to send */ + /* Returns 1 for ok, send message */ + { /* Returns 0 if message already there */ int a; char sys2[512]; strcpy(sys2,sys); @@ -966,10 +964,8 @@ char sys[]; { /* Returns 0 if message already there */ /* * implement split horizon algorithm */ -int ismsgok(mpos,mmfp,sysname) -long mpos; -FILE *mmfp; -char *sysname; { +int ismsgok(long int mpos, FILE *mmfp, char *sysname) +{ int a; int ok = 0; /* fail safe - no path, don't send it */ char fbuf[256]; @@ -990,10 +986,10 @@ char *sysname; { return(ok); } -int spool_out(cmlist,destfp,sysname) /* spool list of messages to a file */ -struct msglist *cmlist; /* returns # of msgs spooled */ -FILE *destfp; -char *sysname; +int spool_out(struct msglist *cmlist, FILE *destfp, char *sysname) /* spool list of messages to a file */ + /* returns # of msgs spooled */ + + { struct msglist *cmptr; FILE *mmfp; @@ -1077,8 +1073,8 @@ char *sysname; return(msgs_spooled); } -void outprocess(sysname) /* send new room messages to sysname */ -char *sysname; { +void outprocess(char *sysname) /* send new room messages to sysname */ + { char sysflnm[64]; char srmname[32]; char shiptocmd[128]; @@ -1224,7 +1220,7 @@ char *sysname; { /* * Connect netproc to the Citadel server running on this computer. */ -void np_attach_to_server() { +void np_attach_to_server(void) { char buf[256]; char portname[8]; char *args[] = { "netproc", "localhost", NULL, NULL } ; @@ -1249,9 +1245,7 @@ void np_attach_to_server() { /* * main */ -void main(argc,argv) -int argc; -char *argv[]; +void main(int argc, char **argv) { char allst[32]; FILE *allfp; diff --git a/citadel/netsetup.c b/citadel/netsetup.c index 87bd96579..023576abc 100644 --- a/citadel/netsetup.c +++ b/citadel/netsetup.c @@ -25,12 +25,12 @@ struct netnode { }; -void get_config(); +void get_config(void); struct config config; -struct netnode *load_node(nodename) -char *nodename; { +struct netnode *load_node(char *nodename) +{ FILE *fp; char buf[256]; char filename[256]; @@ -68,8 +68,8 @@ char *nodename; { -void save_node(nnptr) -struct netnode *nnptr; { +void save_node(struct netnode *nnptr) +{ FILE *fp; char filename[256]; @@ -95,7 +95,7 @@ struct netnode *nnptr; { -void display_usage() { +void display_usage(void) { fprintf(stderr, "netsetup for %s\n", CITADEL); fprintf(stderr, "usage: netsetup [arguments]\n\n"); fprintf(stderr, "Commands: \n"); @@ -115,7 +115,7 @@ void display_usage() { * Display all neighboring nodes * (This is inherently nonportable) */ -void display_nodelist() { +void display_nodelist(void) { FILE *ls; char buf[256]; @@ -137,8 +137,8 @@ void display_nodelist() { /* */ -void add_node(NewNodeName) -char *NewNodeName; { +void add_node(char *NewNodeName) +{ FILE *fp; char sysfilename[256]; @@ -165,8 +165,8 @@ char *NewNodeName; { /* */ -void delete_node(NodeName) -char *NodeName; { +void delete_node(char *NodeName) +{ FILE *fp; char sysfilename[256]; char spooloutfilename[256]; @@ -193,8 +193,8 @@ char *NodeName; { /* */ -void do_roomlist(NodeName) -char *NodeName; { +void do_roomlist(char *NodeName) +{ FILE *fp; char sysfilename[256]; char buf[256]; @@ -221,8 +221,8 @@ char *NodeName; { /* */ -void show_spool_cmd(NodeName) -char *NodeName; { +void show_spool_cmd(char *NodeName) +{ FILE *fp; char sysfilename[256]; char buf[256]; @@ -244,9 +244,8 @@ char *NodeName; { /* */ -void set_spool_cmd(nodename, spoolcmd) -char *nodename; -char *spoolcmd; { +void set_spool_cmd(char *nodename, char *spoolcmd) +{ struct netnode *nnptr; nnptr = load_node(nodename); @@ -262,9 +261,8 @@ char *spoolcmd; { /* */ -void add_share(nodename, roomname) -char *nodename; -char *roomname; { +void add_share(char *nodename, char *roomname) +{ struct netnode *nnptr; struct roomshare *rsptr; long highest = 0L; @@ -299,9 +297,8 @@ char *roomname; { /* */ -void remove_share(nodename, roomname) -char *nodename; -char *roomname; { +void remove_share(char *nodename, char *roomname) +{ struct netnode *nnptr; struct roomshare *rsptr, *rshold; int foundit = 0; @@ -341,9 +338,8 @@ char *roomname; { } -int main(argc, argv) -int argc; -char *argv[]; { +int main(int argc, char **argv) +{ if (argc < 2) { display_usage(); diff --git a/citadel/rcit.c b/citadel/rcit.c index 93a91bd91..6ab12e1e3 100644 --- a/citadel/rcit.c +++ b/citadel/rcit.c @@ -33,12 +33,12 @@ #include #include "citadel.h" -void get_config(); +void get_config(void); struct config config; char roomlist[MAXROOMS][20]; -void load_roomlist() { +void load_roomlist(void) { FILE *fp; struct quickroom QRtemp; int a; @@ -56,9 +56,9 @@ void load_roomlist() { -int rnewsxref(room,ngroup) /* xref table */ -char room[]; -char ngroup[]; { +int rnewsxref(char *room, char *ngroup) /* xref table */ + + { FILE *fp; int a,b; char aaa[50],bbb[50]; @@ -87,9 +87,8 @@ GNA: strcpy(aaa,""); strcpy(bbb,""); } -void getroom(room,ngroup) -char room[]; -char ngroup[]; { +void getroom(char *room, char *ngroup) +{ char ngbuf[256]; char tryme[256]; int a,b; @@ -112,9 +111,8 @@ char ngroup[]; { } } -void main(argc,argv) -int argc; -char *argv[]; { +void main(int argc, char **argv) +{ char aaa[128],bbb[128],ccc[128]; char author[128],recipient[128],room[128],node[128],path[512]; char subject[128]; diff --git a/citadel/readlog.c b/citadel/readlog.c index a54a24d71..a518f25c6 100644 --- a/citadel/readlog.c +++ b/citadel/readlog.c @@ -11,13 +11,11 @@ #include #include "citadel.h" -void get_config (); +void get_config (void); struct config config; void -main (argc, argv) - int argc; - char *argv[]; +main (int argc, char **argv) { time_t LogTime; unsigned int LogType; diff --git a/citadel/room_ops.c b/citadel/room_ops.c index 154c7cc94..95c903bdf 100644 --- a/citadel/room_ops.c +++ b/citadel/room_ops.c @@ -7,6 +7,7 @@ #include "citadel.h" #include "server.h" #include "proto.h" +#include "database.h" extern struct config config; diff --git a/citadel/rooms.c b/citadel/rooms.c index 02f8dc4e2..d09c4f638 100644 --- a/citadel/rooms.c +++ b/citadel/rooms.c @@ -12,6 +12,7 @@ #include #include #include "citadel.h" +#include "rooms.h" #define IFEXPERT if (userflags&US_EXPERT) #define IFNEXPERT if ((userflags&US_EXPERT)==0) @@ -19,28 +20,28 @@ #define IFNAIDE if (axlevel<6) -long finduser(); -void sttybbs(); -void extract(); -int extract_int(); -void hit_any_key(); -int yesno(); -int yesno_d(); -void strprompt(); -void newprompt(); -int struncmp(); -void dotgoto(); -long extract_long(); -void serv_read(); -void formout(); -int inkey(); -int fmout(); -void citedit(); -void progress(); -int pattern(); -int file_checksum(); -int nukedir(); -void color(); +long finduser(int file, char *name); +void sttybbs(int cmd); +void extract(char *dest, char *source, int parmnum); +int extract_int(char *source, int parmnum); +void hit_any_key(void); +int yesno(void); +int yesno_d(int d); +void strprompt(char *prompt, char *str, int len); +void newprompt(char *prompt, char *str, int len); +int struncmp(char *lstr, char *rstr, int len); +void dotgoto(char *towhere, int display_name); +long extract_long(char *source, int parmnum); +void serv_read(char *buf, int bytes); +void formout(char *name); +int inkey(void); +int fmout(int width, FILE *fp, char pagin, int height, int starting_lp, char subst); +void citedit(FILE *fp, long int base_pos); +void progress(long int curr, long int cmax); +int pattern(char *search, char *patn); +int file_checksum(char *filename); +int nukedir(char *dirname); +void color(int colornum); extern unsigned room_flags; extern char room_name[]; @@ -64,7 +65,7 @@ extern char ugname[]; extern char floorlist[128][256]; -void load_floorlist() { +void load_floorlist(void) { int a; char buf[256]; @@ -81,8 +82,8 @@ void load_floorlist() { } } -void listrms(variety) -char *variety; { +void listrms(char *variety) +{ char buf[256]; char rmname[32]; int f,c; @@ -118,7 +119,7 @@ char *variety; { } -void list_other_floors() { +void list_other_floors(void) { int a,c; c = 1; @@ -137,8 +138,8 @@ void list_other_floors() { * List known rooms. kn_floor_mode should be set to 0 for a 'flat' listing, * 1 to list rooms on the current floor, or 1 to list rooms on all floors. */ -void knrooms(kn_floor_mode) -int kn_floor_mode; { +void knrooms(int kn_floor_mode) +{ char buf[256]; int a; @@ -186,7 +187,7 @@ int kn_floor_mode; { } -void listzrooms() { /* list public forgotten rooms */ +void listzrooms(void) { /* list public forgotten rooms */ color(3); printf("\n Forgotten public rooms:\n"); listrms("LZRM"); @@ -196,10 +197,8 @@ void listzrooms() { /* list public forgotten rooms */ } -int set_room_attr(ibuf,prompt,sbit) -int ibuf; -char *prompt; -unsigned sbit; { +int set_room_attr(int ibuf, char *prompt, unsigned int sbit) +{ int a; printf("%s [%s]? ",prompt,((ibuf&sbit) ? "Yes":"No")); @@ -216,8 +215,8 @@ unsigned sbit; { * The supplied argument is the 'default' floor number. * This function returns the selected floor number. */ -int select_floor(rfloor) -int rfloor; { +int select_floor(int rfloor) +{ int a, newfloor; char floorstr[256]; @@ -256,7 +255,7 @@ int rfloor; { /* * .ide dit room */ -void editthisroom() { +void editthisroom(void) { char rname[20]; char rpass[10]; char rdir[15]; @@ -370,7 +369,7 @@ void editthisroom() { /* * un-goto the previous room */ -void ungoto() { +void ungoto(void) { char buf[256]; if (!strcmp(ugname,"")) return; @@ -395,8 +394,8 @@ void ungoto() { * download() - download a file or files. The argument passed to this * function determines which protocol to use. */ -void download(proto) -int proto; { +void download(int proto) +{ /* - 0 = paginate, 1 = xmodem, 2 = raw, 3 = ymodem, 4 = zmodem, 5 = save @@ -574,7 +573,7 @@ int proto; { /* * read directory of this room */ -void roomdir() { +void roomdir(void) { char flnm[256]; char flsz[32]; char comment[256]; @@ -606,7 +605,7 @@ void roomdir() { /* * add a user to a private room */ -void invite() { +void invite(void) { char aaa[31],bbb[256]; if ((room_flags & QR_PRIVATE)==0) { @@ -627,7 +626,7 @@ void invite() { /* * kick a user out of a room */ -void kickout() { +void kickout(void) { char aaa[31],bbb[256]; if ((room_flags & QR_PRIVATE)==0) { @@ -649,7 +648,7 @@ void kickout() { /* * aide command: kill the current room */ -void killroom() { +void killroom(void) { char aaa[100]; serv_puts("KILL 0"); @@ -669,7 +668,7 @@ void killroom() { dotgoto("_BASEROOM_",0); } -void forget() { /* forget the current room */ +void forget(void) { /* forget the current room */ char cmd[256]; printf("Are you sure you want to forget this room? "); @@ -690,7 +689,7 @@ void forget() { /* forget the current room */ /* * create a new room */ -void entroom() { +void entroom(void) { char cmd[256]; char new_room_name[20]; int new_room_type; @@ -760,7 +759,7 @@ void entroom() { -void readinfo() { /* read info file for current room */ +void readinfo(void) { /* read info file for current room */ char cmd[256]; sprintf(cmd,"RINF"); @@ -778,7 +777,7 @@ void readinfo() { /* read info file for current room */ /* * ho knows room... */ -void whoknows() { +void whoknows(void) { char buf[256]; serv_puts("WHOK"); serv_gets(buf); @@ -795,12 +794,8 @@ void whoknows() { } -void do_edit(desc,read_cmd,check_cmd,write_cmd) -char *desc; -char *read_cmd; -char *check_cmd; -char *write_cmd; - { +void do_edit(char *desc, char *read_cmd, char *check_cmd, char *write_cmd) +{ FILE *fp; char cmd[256]; int b,cksum,editor_exit; @@ -884,11 +879,11 @@ char *write_cmd; } -void enterinfo() { /* edit info file for current room */ +void enterinfo(void) { /* edit info file for current room */ do_edit("the Info file for this room","RINF","EINF 0","EINF 1"); } -void enter_bio() { +void enter_bio(void) { char cmd[256]; sprintf(cmd,"RBIO %s",fullname); do_edit("your Bio",cmd,"NOOP","EBIO"); @@ -897,7 +892,7 @@ void enter_bio() { /* * create a new floor */ -void create_floor() { +void create_floor(void) { char buf[256]; char newfloorname[256]; @@ -923,7 +918,7 @@ void create_floor() { /* * edit the current floor */ -void edit_floor() { +void edit_floor(void) { char buf[256]; if (floorlist[(int)curr_floor][0]==0) load_floorlist(); @@ -941,7 +936,7 @@ void edit_floor() { /* * kill the current floor */ -void kill_floor() { +void kill_floor(void) { int floornum_to_delete,a; char buf[256]; diff --git a/citadel/rooms.h b/citadel/rooms.h new file mode 100644 index 000000000..b026768b0 --- /dev/null +++ b/citadel/rooms.h @@ -0,0 +1,19 @@ +void listzrooms(void); +void readinfo(void); +void forget(void); +void entroom(void); +void killroom(void); +void invite(void); +void kickout(void); +void editthisroom(void); +void roomdir(void); +void download(int proto); +void ungoto(void); +void whoknows(void); +void enterinfo(void); +void knrooms(int kn_floor_mode); +void load_floorlist(void); +void create_floor(void); +void edit_floor(void); +void kill_floor(void); +void enter_bio(void); diff --git a/citadel/routines.c b/citadel/routines.c index d7a2cf0f2..9390e36bf 100644 --- a/citadel/routines.c +++ b/citadel/routines.c @@ -18,18 +18,19 @@ #define ROUTINES_C #include "citadel.h" - -char inkey(); -void sttybbs(); -void newprompt(); -void val_user(); -int intprompt(); -void formout(); -void logoff(); -void set_keepalives(); -void strprompt(); -void newprompt(); -void color(); +#include "routines.h" + +char inkey(void); +void sttybbs(int cmd); +void newprompt(char *prompt, char *str, int len); +void val_user(char *user); +int intprompt(char *prompt, int ival, int imin, int imax); +void formout(char *name); +void logoff(int code); +void set_keepalives(int s); +void strprompt(char *prompt, char *str, int len); +void newprompt(char *prompt, char *str, int len); +void color(int colornum); #define IFAIDE if(axlevel>=6) #define IFNAIDE if (axlevel<6) @@ -40,9 +41,8 @@ extern char sigcaught; extern struct CtdlServInfo serv_info; extern char rc_floor_mode; -int struncmp(lstr,rstr,len) -char lstr[],rstr[]; -int len; { +int struncmp(char *lstr, char *rstr, int len) +{ int pos = 0; char lc,rc; while (pos=(height-1)) { set_keepalives(KA_NO); @@ -365,8 +356,7 @@ int pagin; { } -void strproc(string) -char string[]; +void strproc(char *string) { int a; @@ -403,8 +393,8 @@ char string[]; } -int hash(str) -char str[]; { +int hash(char *str) +{ int h = 0; int i; @@ -412,9 +402,8 @@ char str[]; { return(h); } -long finduser(file,name) -int file; -char *name; { +long finduser(int file, char *name) +{ FILE *fp; int uh,fh; long pp=0L; @@ -433,8 +422,8 @@ char *name; { } -int alias(name) /* process alias and routing info for mail */ -char name[]; { +int alias(char *name) /* process alias and routing info for mail */ + { FILE *fp; int a,b; char aaa[300],bbb[300]; @@ -519,8 +508,8 @@ GETSN: do { /* * replacement strerror() for systems that don't have it */ -char *strerror(e) -int e; { +char *strerror(int e) +{ static char buf[32]; sprintf(buf,"errno = %d",e); @@ -529,9 +518,8 @@ int e; { #endif -void progress(curr,cmax) -long curr; -long cmax; { +void progress(long int curr, long int cmax) +{ static long dots_printed; long a; @@ -560,8 +548,8 @@ long cmax; { * NOT the same locate_host() in locate_host.c. This one just does a * 'who am i' to try to discover where the user is... */ -void locate_host(hbuf) -char hbuf[]; { +void locate_host(char *hbuf) +{ char buf[256]; FILE *who; int a,b; @@ -624,8 +612,8 @@ void misc_server_cmd(char *cmd) { /* * compute the checksum of a file */ -int file_checksum(filename) -char *filename; { +int file_checksum(char *filename) +{ int cksum = 0; int ch; FILE *fp; @@ -647,8 +635,8 @@ char *filename; { /* * nuke a directory and its contents */ -int nukedir(dirname) -char *dirname; { +int nukedir(char *dirname) +{ DIR *dp; struct dirent *d; char filename[256]; diff --git a/citadel/routines.h b/citadel/routines.h new file mode 100644 index 000000000..98c199488 --- /dev/null +++ b/citadel/routines.h @@ -0,0 +1,15 @@ +void edituser(void); +void extract(char *dest, char *source, int parmnum); +long extract_long(char *source, int parmnum); +int extract_int(char *source, int parmnum); +void interr(int errnum); +int struncmp(char *lstr, char *rstr, int len); +int yesno(void); +int checkpagin(int lp, int pagin, int height); +int pattern(char *search, char *patn); +int num_parms(char *source); +void enter_config(int mode); +void locate_host(char *hbuf); +void misc_server_cmd(char *cmd); +int nukedir(char *dirname); +int num_parms(char *source); diff --git a/citadel/routines2.c b/citadel/routines2.c index 9f7d89200..0ccd54ccd 100644 --- a/citadel/routines2.c +++ b/citadel/routines2.c @@ -16,21 +16,22 @@ #include #include #include "citadel.h" - -void interr(); -void strprompt(); -void newprompt(); -void sttybbs(); -int inkey(); -int ka_wait(); -void serv_write(); -void extract(); -long finduser(); -int haschar(); -void progress(); -void citedit(); -int yesno(); -void nukedir(); +#include "routines2.h" + +void interr(int errnum); +void strprompt(char *prompt, char *str, int len); +void newprompt(char *prompt, char *str, int len); +void sttybbs(int cmd); +int inkey(void); +int ka_wait(pid_t *kstatus); +void serv_write(char *buf, int nbytes); +void extract(char *dest, char *source, int parmnum); +long finduser(int file, char *name); +int haschar(char *st, int ch); +void progress(long int curr, long int cmax); +void citedit(FILE *fp, long int base_pos); +int yesno(void); +void nukedir(char *dirname); extern char temp[]; extern char tempdir[]; @@ -41,9 +42,8 @@ extern unsigned room_flags; extern int screenwidth; -int eopen(name,mode) -char *name; -int mode; { +int eopen(char *name, int mode) +{ int ret; ret = open(name,mode); if (ret<0) { @@ -55,8 +55,8 @@ int mode; { } -int room_prompt(qrflags) /* return proper room prompt character */ -int qrflags; { +int room_prompt(int qrflags) /* return proper room prompt character */ + { int a; a='>'; if (qrflags&QR_DIRECTORY) a=']'; @@ -65,7 +65,7 @@ int qrflags; { return(a); } -void entregis() /* register with name and address */ +void entregis(void) /* register with name and address */ { char buf[256]; @@ -128,14 +128,14 @@ void entregis() /* register with name and address */ printf("\n"); } -void updatels() { /* make all messages old in current room */ +void updatels(void) { /* make all messages old in current room */ char buf[256]; serv_puts("SLRP HIGHEST"); serv_gets(buf); if (buf[0]!='2') printf("%s\n",&buf[4]); } -void updatelsa() { /* only make messages old in this room that have been read */ +void updatelsa(void) { /* only make messages old in this room that have been read */ char buf[256]; sprintf(buf,"SLRP %ld",highest_msg_read); serv_puts(buf); @@ -189,7 +189,7 @@ void do_upload(int fd) { /* * client-based uploads (for users with their own clientware) */ -void cli_upload() { +void cli_upload(void) { char flnm[256]; char desc[151]; char buf[256]; @@ -269,8 +269,8 @@ void cli_image_upload(char *keyname) { /* * protocol-based uploads (Xmodem, Ymodem, Zmodem) */ -void upload(c) /* c = upload mode */ -int c; { +void upload(int c) /* c = upload mode */ + { char flnm[256]; char desc[151]; char buf[256]; @@ -392,8 +392,8 @@ int c; { /* * validate a user */ -void val_user(user) -char *user; { +void val_user(char *user) +{ int a,b; char cmd[256]; char buf[256]; @@ -445,7 +445,7 @@ char *user; { } -void validate() { /* validate new users */ +void validate(void) { /* validate new users */ char cmd[256]; char buf[256]; int finished = 0; @@ -462,7 +462,7 @@ void validate() { /* validate new users */ } while(finished==0); } -void subshell() { +void subshell(void) { int a,b; a=fork(); if (a==0) { @@ -482,7 +482,7 @@ void subshell() { /* * <.A>ide ile elete command */ -void deletefile() { +void deletefile(void) { char filename[32]; char cmd[256]; @@ -497,7 +497,7 @@ void deletefile() { /* * <.A>ide ile end command */ -void netsendfile() { +void netsendfile(void) { char filename[32],destsys[20],cmd[256]; newprompt("Filename: ",filename,31); @@ -513,7 +513,7 @@ void netsendfile() { /* * <.A>ide ile ove command */ -void movefile() { +void movefile(void) { char filename[64]; char newroom[20]; char cmd[256]; @@ -532,7 +532,7 @@ void movefile() { /* * list of users who have filled out a bio */ -void list_bio() { +void list_bio(void) { char buf[256]; int pos = 1; @@ -557,7 +557,7 @@ void list_bio() { /* * read bio */ -void read_bio() { +void read_bio(void) { char who[256]; char buf[256]; diff --git a/citadel/routines2.h b/citadel/routines2.h new file mode 100644 index 000000000..b1db0e7fd --- /dev/null +++ b/citadel/routines2.h @@ -0,0 +1,12 @@ +void updatels(void); +void updatelsa(void); +void movefile(void); +void deletefile(void); +void netsendfile(void); +void entregis(void); +void subshell(void); +void upload(int c); +void cli_upload(void); +void validate(void); +void read_bio(void); +void cli_image_upload(char *keyname); diff --git a/citadel/serv_info.c b/citadel/serv_info.c index 6787964ef..399f5ab6e 100644 --- a/citadel/serv_info.c +++ b/citadel/serv_info.c @@ -12,6 +12,7 @@ #include #include #include "citadel.h" +#include "serv_info.h" void CtdlInternalGetServInfo(struct CtdlServInfo *infobuf) { char buf[256]; diff --git a/citadel/serv_info.h b/citadel/serv_info.h new file mode 100644 index 000000000..f2cb7bf96 --- /dev/null +++ b/citadel/serv_info.h @@ -0,0 +1 @@ +void CtdlInternalGetServInfo(struct CtdlServInfo *infobuf); diff --git a/citadel/setup.c b/citadel/setup.c index 467ba3391..bf05610ea 100644 --- a/citadel/setup.c +++ b/citadel/setup.c @@ -16,10 +16,12 @@ #include #include #include +#include #include "citadel.h" #include "axdefs.h" #include "sysdep.h" +#include "config.h" #ifdef CURSES_INC # ifdef OK @@ -225,9 +227,6 @@ char *setup_text[] = { }; - -long atol(); -void get_config(); struct config config; int direction; @@ -258,10 +257,10 @@ void cleanup(int exitcode) { #ifdef CURSES_INC -void getlin(yp,xp,string,lim) /* Gets a line from the terminal */ -int yp,xp; /* Where on the screen to start */ -char string[]; /* Pointer to string buffer */ -int lim; /* Maximum length - if negative, no-show */ +void getlin(int yp, int xp, char *string, int lim) /* Gets a line from the terminal */ + /* Where on the screen to start */ + /* Pointer to string buffer */ + /* Maximum length - if negative, no-show */ { int a,b; char flag; @@ -308,15 +307,15 @@ GLA: move(yp,xp+strlen(string)); -void title(text) -char *text; { +void title(char *text) +{ if (setup_type == UI_TEXT) { printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<%s>\n",text); } } -void hit_any_key() { +void hit_any_key(void) { char junk[5]; #ifdef CURSES_INC @@ -331,8 +330,8 @@ void hit_any_key() { fgets(junk, 5, stdin); } -int yesno(question) -char *question; { +int yesno(char *question) +{ int answer = 0; char buf[4096]; @@ -377,7 +376,7 @@ char *question; { -void dump_access_levels() { +void dump_access_levels(void) { int a; for (a=0; a<=6; ++a) printf("%d %s\n",a,axdefs[a]); } @@ -396,7 +395,7 @@ void get_setup_msg(char *dispbuf, int msgnum) { } while(atol(setup_text[a])!=(msgnum+1)); } -void print_setup(msgnum) { +void print_setup(int msgnum) { char dispbuf[4096]; get_setup_msg(dispbuf, msgnum); @@ -448,10 +447,8 @@ void display_error(char *error_message) { important_message("Error", error_message); } -void progress(text,curr,cmax) -char *text; -long curr; -long cmax; { +void progress(char *text, long int curr, long int cmax) +{ static long dots_printed; long a; static long prev; @@ -544,7 +541,7 @@ long cmax; { * check_services_entry() -- Make sure "citadel" is in /etc/services * */ -void check_services_entry() { +void check_services_entry(void) { char question[128]; FILE *sfp; @@ -573,7 +570,7 @@ void check_services_entry() { * check_inittab_entry() -- Make sure "citadel" is in /etc/inittab * */ -void check_inittab_entry() { +void check_inittab_entry(void) { FILE *infp; char buf[256]; char looking_for[256]; @@ -702,9 +699,8 @@ void set_str_val(int msgpos, char str[]) { } } -void set_int_val(msgpos, ip) -int msgpos; -int *ip; { +void set_int_val(int msgpos, int *ip) +{ char buf[16]; sprintf(buf,"%d",(int)*ip); set_str_val(msgpos, buf); @@ -712,9 +708,8 @@ int *ip; { } -void set_char_val(msgpos, ip) -int msgpos; -char *ip; { +void set_char_val(int msgpos, char *ip) +{ char buf[16]; sprintf(buf,"%d",(int)*ip); set_str_val(msgpos, buf); @@ -722,9 +717,8 @@ char *ip; { } -void set_long_val(msgpos, ip) -int msgpos; -long *ip; { +void set_long_val(int msgpos, long int *ip) +{ char buf[16]; sprintf(buf,"%ld",*ip); set_str_val(msgpos, buf); @@ -732,7 +726,8 @@ long *ip; { } -int yesno_s(question) { +#if 0 /* FIXME: this isn't used, can we remove it? */ +int yesno_s(char *question) { int a; char buf[4096]; char tempfile[64]; @@ -772,10 +767,11 @@ int yesno_s(question) { return(0); /* just in case */ } +#endif -void edit_value(curr) -int curr; { +void edit_value(int curr) +{ int a; switch(curr) { @@ -868,7 +864,7 @@ case 19: /* * (re-)write the config data to disk */ -void write_config_to_disk() { +void write_config_to_disk(void) { FILE *fp; fp=fopen("citadel.config","wb"); @@ -886,7 +882,7 @@ void write_config_to_disk() { /* * Figure out what type of user interface we're going to use */ -int discover_ui() { +int discover_ui(void) { #ifdef CURSES_INC return UI_CURSES; diff --git a/citadel/stats.c b/citadel/stats.c index b5615154d..0d7f4ce16 100644 --- a/citadel/stats.c +++ b/citadel/stats.c @@ -22,12 +22,12 @@ struct caller int Ctimescalled; }; -void get_config (); +void get_config (void); struct config config; void -prompt () +prompt (void) { char buf[16]; if (batch_mode == 0) @@ -42,8 +42,8 @@ prompt () } int -halfhour (time) /* Returns half-hour time period of time */ - long time; +halfhour (long int time) /* Returns half-hour time period of time */ + { int a; struct tm *tm; @@ -59,9 +59,7 @@ halfhour (time) /* Returns half-hour time period of time */ void -progress (curr, max) - long curr; - long max; +progress (long int curr, long int max) { static int dots; int pos; @@ -95,9 +93,7 @@ progress (curr, max) void -main (argc, argv) - int argc; - char *argv[]; +main (int argc, char **argv) { time_t LogTime; unsigned int LogType; diff --git a/citadel/support.h b/citadel/support.h new file mode 100644 index 000000000..72df18679 --- /dev/null +++ b/citadel/support.h @@ -0,0 +1 @@ +void strproc(char *string); diff --git a/citadel/sysdep.c b/citadel/sysdep.c index 34090f179..c2ebc5f8e 100644 --- a/citadel/sysdep.c +++ b/citadel/sysdep.c @@ -32,6 +32,8 @@ #include "citadel.h" #include "server.h" #include "proto.h" +#include "sysdep_decls.h" +#include "citserver.h" #ifdef NEED_SELECT_H #include @@ -93,10 +95,10 @@ void init_sysdep(void) { * The action for unexpected signals and exceptions should be to * call master_cleanup() to gracefully shut down the server. */ - signal(SIGINT, master_cleanup); - signal(SIGQUIT, master_cleanup); - signal(SIGHUP, master_cleanup); - signal(SIGTERM, master_cleanup); + signal(SIGINT, (void(*)(int))master_cleanup); + signal(SIGQUIT, (void(*)(int))master_cleanup); + signal(SIGHUP, (void(*)(int))master_cleanup); + signal(SIGTERM, (void(*)(int))master_cleanup); } diff --git a/citadel/sysdep_decls.h b/citadel/sysdep_decls.h new file mode 100644 index 000000000..c2ef5b8fa --- /dev/null +++ b/citadel/sysdep_decls.h @@ -0,0 +1 @@ +void sysdep_master_cleanup(void); diff --git a/citadel/user_ops.c b/citadel/user_ops.c index 725d41ab8..d52bad9d3 100644 --- a/citadel/user_ops.c +++ b/citadel/user_ops.c @@ -17,6 +17,7 @@ #include "citadel.h" #include "server.h" #include "proto.h" +#include "database.h" extern struct config config; diff --git a/citadel/userlist.c b/citadel/userlist.c index 77c04ef65..82636a150 100644 --- a/citadel/userlist.c +++ b/citadel/userlist.c @@ -6,13 +6,13 @@ #include "citadel.h" #include -void attach_to_server(); +void attach_to_server(int argc, char **argv); /* * num_parms() - discover number of parameters... */ -int num_parms(source) -char source[]; { +int num_parms(char *source) +{ int a; int count = 1; @@ -25,10 +25,8 @@ char source[]; { /* * extract() - extract a parameter from a series of "|" separated... */ -void extract(dest,source,parmnum) -char dest[]; -char source[]; -int parmnum; { +void extract(char *dest, char *source, int parmnum) +{ char buf[256]; int count = 0; int n; @@ -57,9 +55,8 @@ int parmnum; { /* * extract_int() - extract an int parm w/o supplying a buffer */ -int extract_int(source,parmnum) -char *source; -int parmnum; { +int extract_int(char *source, int parmnum) +{ char buf[256]; extract(buf,source,parmnum); @@ -70,9 +67,8 @@ int parmnum; { /* * extract_long() - extract an long parm w/o supplying a buffer */ -long extract_long(source,parmnum) -char *source; -int parmnum; { +long extract_long(char *source, int parmnum) +{ char buf[256]; extract(buf,source,parmnum); @@ -80,12 +76,12 @@ int parmnum; { } -void logoff(code) -int code; { +void logoff(int code) +{ exit(code); } -void userlist() { +void userlist(void) { char buf[256]; char fl[256]; struct tm *tmbuf; @@ -117,9 +113,8 @@ void userlist() { } -void main(argc,argv) -int argc; -char *argv[]; { +void main(int argc, char **argv) +{ char buf[256]; attach_to_server(argc,argv); @@ -141,8 +136,8 @@ char *argv[]; { /* * replacement strerror() for systems that don't have it */ -char *strerror(e) -int e; { +char *strerror(int e) +{ static char buf[32]; sprintf(buf,"errno = %d",e); diff --git a/citadel/whobbs.c b/citadel/whobbs.c index 29d942fd0..ca19c4e12 100644 --- a/citadel/whobbs.c +++ b/citadel/whobbs.c @@ -4,13 +4,13 @@ #include #include "citadel.h" -void attach_to_server(); +void attach_to_server(int argc, char **argv); /* * num_parms() - discover number of parameters... */ -int num_parms(source) -char source[]; { +int num_parms(char *source) +{ int a; int count = 1; @@ -23,10 +23,8 @@ char source[]; { /* * extract() - extract a parameter from a series of "|" separated... */ -void extract(dest,source,parmnum) -char dest[]; -char source[]; -int parmnum; { +void extract(char *dest, char *source, int parmnum) +{ char buf[256]; int count = 0; int n; @@ -55,9 +53,8 @@ int parmnum; { /* * extract_int() - extract an int parm w/o supplying a buffer */ -int extract_int(source,parmnum) -char *source; -int parmnum; { +int extract_int(char *source, int parmnum) +{ char buf[256]; extract(buf,source,parmnum); @@ -65,14 +62,13 @@ int parmnum; { } -void logoff(code) -int code; { +void logoff(int code) +{ exit(code); } -void main(argc,argv) -int argc; -char *argv[]; { +void main(int argc, char **argv) +{ char buf[256]; char nodetitle[256]; int a; @@ -132,8 +128,8 @@ char *argv[]; { /* * replacement strerror() for systems that don't have it */ -char *strerror(e) -int e; { +char *strerror(int e) +{ static char buf[32]; sprintf(buf,"errno = %d",e); -- 2.30.2