Tue Aug 18 00:42:33 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
authorNathan Bryant <loanshark@uncensored.citadel.org>
Tue, 18 Aug 1998 04:50:10 +0000 (04:50 +0000)
committerNathan Bryant <loanshark@uncensored.citadel.org>
Tue, 18 Aug 1998 04:50:10 +0000 (04:50 +0000)
        * 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.

56 files changed:
citadel/ChangeLog
citadel/Makefile.in
citadel/aidepost.c
citadel/citadel.c
citadel/citadel.h
citadel/citadel_decls.h [new file with mode: 0644]
citadel/citadelapi.c
citadel/citadelapi.h [new file with mode: 0644]
citadel/citmail.c
citadel/citserver.c
citadel/citserver.h [new file with mode: 0644]
citadel/client_chat.c
citadel/client_chat.h [new file with mode: 0644]
citadel/commands.c
citadel/commands.h [new file with mode: 0644]
citadel/config.c
citadel/config.h [new file with mode: 0644]
citadel/config_decls.h [deleted file]
citadel/control.c
citadel/database.c
citadel/database.h [new file with mode: 0644]
citadel/file_ops.c
citadel/housekeeping.c
citadel/internetmail.c
citadel/internetmail.h [new file with mode: 0644]
citadel/ipc.h [new file with mode: 0644]
citadel/ipc_c_tcp.c
citadel/ipcdef.h
citadel/mailinglist.c
citadel/messages.c
citadel/messages.h [new file with mode: 0644]
citadel/msgbase.c
citadel/msgform.c
citadel/netmailer.c
citadel/netpoll.c
citadel/netproc.c
citadel/netsetup.c
citadel/rcit.c
citadel/readlog.c
citadel/room_ops.c
citadel/rooms.c
citadel/rooms.h [new file with mode: 0644]
citadel/routines.c
citadel/routines.h [new file with mode: 0644]
citadel/routines2.c
citadel/routines2.h [new file with mode: 0644]
citadel/serv_info.c
citadel/serv_info.h [new file with mode: 0644]
citadel/setup.c
citadel/stats.c
citadel/support.h [new file with mode: 0644]
citadel/sysdep.c
citadel/sysdep_decls.h [new file with mode: 0644]
citadel/user_ops.c
citadel/userlist.c
citadel/whobbs.c

index e1de90c51efcdacb39b2aa156283462267a6236d..2f48cb84e16abd9adc97bfd9846e0c9fe16cfcb8 100644 (file)
@@ -1,3 +1,12 @@
+Tue Aug 18 00:42:33 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
+       * 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 <ajc@uncnsrd.mt-kisco.ny.us>
        * Implemented a bunch of user account related functions in the
          CitadelAPI library.
index d58f8e2b554f126d7c821da7fa74768c885c49a1..3649423bc3987716001d98e9998584d540a9fb56 100644 (file)
 #
 ########################################################################
 
-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)
index 7a9f96bbd7e866c03207e9fa1c91496067a7ca76..f71a0af8ce49105d3ec79da37561cb34ef64770e 100644 (file)
@@ -7,13 +7,12 @@
 #include <unistd.h>
 #include <stdio.h>
 #include <time.h>
+#include <limits.h>
 #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];
index 80a63c09e27d6084fab5a4ed28eaa82484fbca86..39ab5a7daf21c072d016db4940f2dad39e9dd46e 100644 (file)
 
 #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 */
index 1ac342999929bdc12050aa871bda2d28d6bec406..2cf6bef745e1cce56cef664d0c47146458d172b7 100644 (file)
@@ -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 (file)
index 0000000..d858f0b
--- /dev/null
@@ -0,0 +1 @@
+extern char fullname[32];
index 4ada1e108dde2f1099aa8d51b189639614e2b6a4..199ea68c17aee35839e17a0ae8945e326cfa72f3 100644 (file)
@@ -6,6 +6,9 @@
 #include <string.h>
 #include <errno.h>
 #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 (file)
index 0000000..3da2adb
--- /dev/null
@@ -0,0 +1 @@
+void CtdlMain(void);
index f2c367fccbe689f2da6b592e2108057471a2bc3b..1dbc5da36235431df38eea288ac62e347bfb0df5 100644 (file)
 #include <pwd.h>
 #include <errno.h>
 #include <syslog.h>
+#include <limits.h>
 #include "citadel.h"
+#include "config.h"
+#include "internetmail.h"
 
 #define LOCAL 0
 #define REMOTE 1
 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; a<strlen(st); ++a) if (st[a]==ch) ++b;
        return(b);
        }
 
-void strip_trailing_whitespace(buf)
-char buf[]; {
+void strip_trailing_whitespace(char *buf)
+{
        while(isspace(buf[strlen(buf)-1]))
                buf[strlen(buf)-1]=0;
        }
 
 /* strip leading and trailing spaces */
-void striplt(buf)
-char buf[]; {
+void striplt(char *buf)
+{
        while ( (strlen(buf)>0) && (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 <userid> */
@@ -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;
index 3c6d61dfde7dac925ea47956b7b29f4003feaede..94ed1d3cd889c36f742df670d10a9fc9fdd76003 100644 (file)
 #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 (file)
index 0000000..0b70e0b
--- /dev/null
@@ -0,0 +1,2 @@
+void master_cleanup(void);
+void cleanup_stuff(void *);
index 6316a138e90c5857df29608b7932daf68cf9ed88..a57d09f82f1d31d7aafef2d86b18cc9653275108 100644 (file)
 #include <sys/select.h>
 #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 (file)
index 0000000..4243c50
--- /dev/null
@@ -0,0 +1 @@
+void chatmode(void);
index 55a90dcfd52403c743b079676956f97975924fbd..a0b35bb67c41f15ce5199e5fc706d50c1a3d3c5f 100644 (file)
@@ -31,6 +31,7 @@
 #include <signal.h>
 #include <errno.h>
 #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; a<strlen(cmdstr); ++a)
@@ -435,9 +429,8 @@ char cmdstr[]; {
  * Output the string from a key command without the ampersand
  * "mode" should be set to 0 for normal or 1 for <C>ommand 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 (file)
index 0000000..c2e01bb
--- /dev/null
@@ -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);
index 68fa84b40eea3a17d3129786aec9c56cde30a7ba..d41c0f0b1101c61e3d80f4f56933d968d4c9f284 100644 (file)
@@ -11,7 +11,7 @@
 #include <string.h>
 #include <limits.h>
 #include "citadel.h"
-#include "config_decls.h"
+#include "config.h"
 
 struct config config;
 char bbs_home_directory[PATH_MAX];
diff --git a/citadel/config.h b/citadel/config.h
new file mode 100644 (file)
index 0000000..87bd2ea
--- /dev/null
@@ -0,0 +1,4 @@
+void get_config(void);
+extern struct config config;
+extern char bbs_home_directory[PATH_MAX];
+extern int home_specified;
diff --git a/citadel/config_decls.h b/citadel/config_decls.h
deleted file mode 100644 (file)
index d680844..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-void get_config();
-extern struct config config;
-extern char bbs_home_directory[PATH_MAX];
-extern int home_specified;
index b0cc45f23b849fb7604f831e610c5800e5fdf8a7..4aa5baf7736155fe646635421dd5e203c6bfa1f9 100644 (file)
@@ -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;
index ea390bf016f73856d38cdb790bc5b691f0902a06..3f47453bd651056a1a3e09bb66e05af403f6c189 100644 (file)
@@ -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 (file)
index 0000000..52d00de
--- /dev/null
@@ -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);
index 340915874e9944f4cf63691b9b99be9064d0e8ac..b0ae01a67384bf26ae0bc9b5ac555ab0c59b7015 100644 (file)
@@ -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);
index e1c15e4924106d231ab1813bc6cc49747dc4d81f..b4d76e970cd7e3cac98ad37566e9e8aa4a27b19b 100644 (file)
@@ -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;
index d0471d664eca9b32019adefd22ec25b75e64ba4b..17b18fca2d2f185e6c4719a3562e821da37982a7 100644 (file)
@@ -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 (file)
index 0000000..00c5652
--- /dev/null
@@ -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 (file)
index 0000000..9305506
--- /dev/null
@@ -0,0 +1,4 @@
+void attach_to_server(int argc, char **argv);
+extern char server_is_local;
+int getsockfd(void);
+char serv_getc(void);
index df0844455e3f9e14363ae6c33f2d99b3846eb038..744feb6d904a62e71736f4415f4f421de1e66308 100644 (file)
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
+#include <arpa/inet.h>
 #include <netdb.h>
 #include <string.h>
 #include <pwd.h>
 #include <errno.h>
+#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;
 
index 808d2143a6c5e12e88c3d7ea68d62477684e9c05..f6365f4fa1baeecaa8d2f69923eb20c26b958669 100644 (file)
@@ -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];
index 24179f5d68c8c9c3a44789156c4885c5a02da990..b8e5572d95f8157201a9519bdfbe2b137a1e86be 100644 (file)
@@ -25,8 +25,8 @@
 #include <string.h>
 #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];
index 22d2c49530eec481a104af9b3e5003433f6f32f6..6628409d2226ff1c1398b46f97bc435fd89e0c6f 100644 (file)
@@ -16,6 +16,7 @@
 #include <sys/wait.h>
 #include <sys/stat.h>
 #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 (file)
index 0000000..1b9d2a7
--- /dev/null
@@ -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);
index 93eab6e989c0f7f859fc44c660eaf211d381790d..597f62725f020694c570f7e1f08d9e68e9c25508 100644 (file)
@@ -12,6 +12,7 @@
 #include <errno.h>
 #include <sys/stat.h>
 #include "proto.h"
+#include "database.h"
 
 #define MSGS_ALL       0
 #define MSGS_OLD       1
index 6b47b83ef99e53b0aaf75d9903135060de2c544f..1fbe5d42ffc42b68295f05176649e16c596a1d58 100644 (file)
 #include <time.h>
 #include <errno.h>
 
-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;
index 282cce16c1dcb3149ec79af7498f3838066ed3eb..47c4d965b49bd081b0529bd9ff000e19b0fef08b 100644 (file)
@@ -16,8 +16,8 @@
 #include <syslog.h>
 #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; a<strlen(st); ++a) if (st[a]==ch) ++b;
@@ -41,9 +40,7 @@ int ch; {
 
 
 
-void fpgetfield(fp,string)
-FILE *fp;
-char string[];
+void fpgetfield(FILE *fp, char *string)
 {
        int a,b;
        strcpy(string,"");
@@ -64,16 +61,16 @@ 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(msgfile,mfout,sbuf,rbuf,nbuf,pbuf,mid_buf,rmname,subj)
-char *msgfile;
-FILE *mfout;
-char *sbuf;            /* sender */
-char *rbuf;            /* recipient (in this case, an Internet address) */
-char *nbuf;            /* source node */
-char *pbuf;            /* path */
-long *mid_buf;         /* message ID */
-char *rmname;          /* room name */
-char *subj;            /* subject */
+void msgform(char *msgfile, FILE *mfout, char *sbuf, char *rbuf, char *nbuf, char *pbuf, long int *mid_buf, char *rmname, char *subj)
+              
+            
+                       /* sender */
+                       /* recipient (in this case, an Internet address) */
+                       /* source node */
+                       /* path */
+                       /* message ID */
+                       /* room name */
+                       /* subject */
        {
        int a,b,c,e,old,mtype,aflag;
        int real = 0;
@@ -161,9 +158,8 @@ BONFGM:     b=getc(fp); if (b<0) goto END;
        goto BONFGM;
        }
 
-void main(argc,argv)
-int argc;
-char *argv[]; {
+void main(int argc, char **argv)
+{
        int a;
        FILE *fp,*rmail;
        char sbuf[200],rbuf[200],cstr[100],fstr[128];
index 3e9b96c095b23f780633f1228a9c648c4275d6fa..1bd3b72c2df34b1ed051ae764a40e096ebbc5669 100644 (file)
  */
 #define IGNET_PACKET_SIZE 64
 
-long atol();
+long atol(const char *);
 
-void attach_to_server();
-void serv_read();
-void serv_write();
-void get_config();
+void attach_to_server(int argc, char **argv);
+void serv_read(char *buf, int bytes);
+void serv_write(char *buf, int nbytes);
+void get_config(void);
 struct config config;
 
 
 /*
  * num_parms()  -  discover number of parameters...
  */
-int num_parms(source)
-char source[]; {
+int num_parms(char *source)
+{
        int a;
        int count = 1;
 
@@ -40,10 +40,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;
@@ -72,9 +70,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);
@@ -84,9 +81,8 @@ int parmnum; {
 /*
  * extract_long()  -  extract a 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);
@@ -94,8 +90,8 @@ int parmnum; {
        }
 
 
-void logoff(code)
-int code; {
+void logoff(int code)
+{
        exit(code);
        }
 
@@ -103,7 +99,7 @@ int code; {
 /*
  * receive network spool from the remote system
  */
-void receive_spool() {
+void receive_spool(void) {
        long download_len;
        long bytes_received;
        char buf[256];
@@ -154,8 +150,8 @@ void receive_spool() {
 /*
  * transmit network spool to the remote system
  */
-void transmit_spool(remote_nodename)
-char *remote_nodename; {
+void transmit_spool(char *remote_nodename)
+{
        char buf[256];
        char pbuf[4096];
        long plen;
@@ -208,9 +204,8 @@ ABORTUPL:
 
 
 
-void main(argc,argv)
-int argc;
-char *argv[]; {
+void main(int argc, char **argv)
+{
        char buf[256];
        char remote_nodename[32];
        int a;
index d06376b48af4e7dddf85dcd32fdb329594a5d048..f999e1c958f63320ee0727ab9ad066e48444b3de 100644 (file)
@@ -97,10 +97,10 @@ struct minfo {
        };
 
 
-void attach_to_server();
-void serv_read();
-void serv_write();
-void get_config();
+void attach_to_server(int argc, char **argv);
+void serv_read(char *buf, int bytes);
+void serv_write(char *buf, int nbytes);
+void get_config(void);
 
 struct filterlist *filter = NULL;
 char roomnames[MAXROOMS][20];
@@ -116,8 +116,8 @@ extern int home_specified;
 /*
  * 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);
@@ -126,8 +126,8 @@ int e; {
 #endif
 
 
-void strip_trailing_whitespace(buf)
-char buf[]; {
+void strip_trailing_whitespace(char *buf)
+{
        while(isspace(buf[strlen(buf)-1]))
                buf[strlen(buf)-1]=0;
        }
@@ -137,7 +137,7 @@ char buf[]; {
  * for performance optimization, netproc loads the list of room names (and
  * their corresponding directory names, if applicable) into a table in memory.
  */
-int load_roomnames() {
+int load_roomnames(void) {
        FILE *fp;
        struct quickroom qbuf;
        int i;
@@ -162,7 +162,7 @@ int load_roomnames() {
  * as we learn more about the network from incoming messages, and write
  * the table back to disk when we're done.
  */
-int load_syslist() {
+int load_syslist(void) {
        FILE *fp;
        struct syslist *stemp;
        char insys = 0;
@@ -225,7 +225,7 @@ int load_syslist() {
 /* now we have to set up two "special" nodes on the list: one
  * for the local node, and one for an Internet gateway
  */
-void setup_special_nodes() {
+void setup_special_nodes(void) {
        struct syslist *stemp,*slocal;
 
        slocal = NULL;
@@ -266,7 +266,7 @@ void setup_special_nodes() {
 /*
  * here's the routine to write the table back to disk.
  */
-void rewrite_syslist() {
+void rewrite_syslist(void) {
        struct syslist *stemp;
        FILE *newfp;
        long now;
@@ -311,8 +311,8 @@ void rewrite_syslist() {
 /* call this function with the node name of a system and it returns a pointer
  * to its syslist structure.
  */
-struct syslist *get_sys_ptr(sysname)
-char *sysname; {
+struct syslist *get_sys_ptr(char *sysname)
+{
        static char sysnambuf[16];
        static struct syslist *sysptrbuf = NULL;
        struct syslist *stemp;
@@ -335,7 +335,7 @@ char *sysname; {
 /*
  * make sure only one copy of netproc runs at a time, using lock files
  */
-int set_lockfile() {
+int set_lockfile(void) {
        FILE *lfp;
        int ok = 1;
        int onppid;
@@ -366,7 +366,7 @@ int set_lockfile() {
        return(0);
        }
 
-void remove_lockfile() {
+void remove_lockfile(void) {
        unlink(LOCKFILE);
        }
 
@@ -377,14 +377,14 @@ void remove_lockfile() {
  * The cleanup() routine makes a check to ensure it's not reentering, in
  * case the ipc module looped it somehow.
  */
-void nq_cleanup(e)
-int e; {
+void nq_cleanup(int e)
+{
        remove_lockfile();
        exit(e);
        }
 
-void cleanup(e)
-int e; {
+void cleanup(int e)
+{
        static int nested = 0;
 
        alarm(30);
@@ -398,15 +398,15 @@ int e; {
  * client-side IPC modules expect logoff() to be defined.  They call logoff()
  * when a problem connecting or staying connected to the server occurs.
  */
-void logoff(e)
-int e; {
+void logoff(int e)
+{
        cleanup(e);
        }
 
 /*
  * If there is a kill file in place, this function will process it.
  */
-void load_filterlist() {
+void load_filterlist(void) {
        FILE *fp;
        struct filterlist *fbuf;
        char sbuf[256];
@@ -443,8 +443,8 @@ void load_filterlist() {
        }
 
 /* returns 1 if user/message/room combination is in the kill file */
-int is_banned(k_person,k_room,k_system)
-char *k_person,*k_room,*k_system; {
+int is_banned(char *k_person, char *k_room, char *k_system)
+{
        struct filterlist *fptr;
 
        for (fptr=filter; fptr!=NULL; fptr=fptr->next) 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;
index 87bd96579d0db991088a69e1b6bc37a5f3438b4b..023576abc19b01da1c81bf28506e51712bbb51db 100644 (file)
@@ -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 <command> [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();
index 93a91bd917212608537edf442c1176280ff4035f..6ab12e1e32fb9514fb9ec0c452d6b052b7c23ede 100644 (file)
 #include <time.h>
 #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];
index a54a24d7150043923d3847dec30181e455959e61..a518f25c6a8da39a063b59557ce070641043e047 100644 (file)
 #include <errno.h>
 #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;
index 154c7cc9486c27c3b7c509eb902698d926a3a298..95c903bdfc454d6207941b82814a48b7c866c2b6 100644 (file)
@@ -7,6 +7,7 @@
 #include "citadel.h"
 #include "server.h"
 #include "proto.h"
+#include "database.h"
 
 extern struct config config;
 
index 02f8dc4e2d11e5fc72b7cda64caf51be83b30a3e..d09c4f6381efaf574460b8fbe7b0e8a0f753b152 100644 (file)
@@ -12,6 +12,7 @@
 #include <sys/wait.h>
 #include <errno.h>
 #include "citadel.h"
+#include "rooms.h"
 
 #define IFEXPERT if (userflags&US_EXPERT)
 #define IFNEXPERT if ((userflags&US_EXPERT)==0)
 #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; {
 /*
  * .<A>ide <E>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 */
 /*
  * <W>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 (file)
index 0000000..b026768
--- /dev/null
@@ -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);
index d7a2cf0f234af54b39682d8de835011adc8fa6c8..9390e36bf6043a1d2887d4e0182b33dafc93f80b 100644 (file)
 #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<len) {
@@ -60,9 +60,8 @@ int len; {
 /* 
  * check for the presence of a character within a string (returns count)
  */
-int haschar(st,ch)
-char st[];
-int ch; {
+int haschar(char *st, int ch)
+{
        int a,b;
        b=0;
        for (a=0; a<strlen(st); ++a) if (st[a]==ch) ++b;
@@ -73,8 +72,8 @@ int ch; {
 /*
  * num_parms()  -  discover number of parameters...
  */
-int num_parms(source)
-char source[]; {
+int num_parms(char *source)
+{
        int a;
        int count = 1;
 
@@ -86,10 +85,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;
@@ -118,9 +115,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);
@@ -130,24 +126,23 @@ int parmnum; {
 /*
  * extract_long()  -  extract a 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);
        return(atol(buf));
        }
 
-void back(spaces) /* Destructive backspace */
-int spaces; {
+void back(int spaces) /* Destructive backspace */
+            {
 int a;
        for (a=1; a<=spaces; ++a) {
                putc(8,stdout); putc(32,stdout); putc(8,stdout);
                }
        }
 
-int yesno() { /* Returns 1 for yes, 0 for no */
+int yesno(void) { /* Returns 1 for yes, 0 for no */
 int a;
        while (1) {
                a=inkey(); a=tolower(a);
@@ -156,8 +151,8 @@ int a;
                }
        }
 
-int yesno_d(d) /* Returns 1 for yes, 0 for no, arg is default value */
-int d; {
+int yesno_d(int d) /* Returns 1 for yes, 0 for no, arg is default value */
+       {
 int a;
        while (1) {
                a=inkey(); a=tolower(a);
@@ -168,7 +163,7 @@ int a;
        }
 
 
-void hit_any_key() {           /* hit any key to continue */
+void hit_any_key(void) {               /* hit any key to continue */
        int a,b;
 
        printf("%s\r",serv_info.serv_moreprompt);
@@ -185,8 +180,8 @@ void hit_any_key() {                /* hit any key to continue */
 /*
  * change a user's access level
  */
-void edituser(userbuf)
-struct usersupp *userbuf; {
+void edituser(void)
+{
        char who[256];
        char buf[256];
 
@@ -203,10 +198,8 @@ struct usersupp *userbuf; {
        }
 
 
-int set_attr(sval,prompt,sbit)
-int sval;
-char *prompt;
-unsigned sbit; {
+int set_attr(int sval, char *prompt, unsigned int sbit)
+{
        int a;
        int temp;
 
@@ -229,8 +222,8 @@ unsigned sbit; {
  * modes are:  0 - .EC command, 1 - .EC for new user,
  *             2 - toggle Xpert mode  3 - toggle floor mode
  */
-void enter_config(mode)
-int mode; {
+void enter_config(int mode)
+{
        int width,height,flags;
        char buf[128];
 
@@ -303,9 +296,8 @@ int mode; {
  * getstring()  -  get a line of text from a file
  *                ignores lines beginning with "#"
  */
-int getstring(fp,string)
-FILE *fp;              
-char string[]; {
+int getstring(FILE *fp, char *string)
+{
        int a,c;
        do {
                strcpy(string,"");
@@ -323,9 +315,9 @@ char string[]; {
        return(strlen(string));
        }
 
-int pattern(search,patn)       /* Searches for patn in search string */
-char search[];
-char patn[];
+int pattern(char *search, char *patn)  /* Searches for patn in search string */
+              
+            
 {
        int a,b;
        for (a=0; a<strlen(search); ++a)
@@ -335,8 +327,8 @@ char patn[];
        return(-1);
 }
 
-void interr(errnum)    /* display internal error as defined in errmsgs */
-int errnum; {
+void interr(int errnum)        /* display internal error as defined in errmsgs */
+            {
        printf("*** INTERNAL ERROR %d\n",errnum);
        printf("(Press any key to continue)\n");
        inkey();
@@ -351,9 +343,8 @@ int errnum; {
  * we are probably in the middle of a server operation and the NOOP command
  * would confuse everything.
  */
-int checkpagin(lp,pagin,height)
-int lp;
-int pagin; {
+int checkpagin(int lp, int pagin, int height)
+{
        if (pagin!=1) return(0);
        if (lp>=(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 (file)
index 0000000..98c1994
--- /dev/null
@@ -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);
index 9f7d89200e6c88df9234facd9cdcb228d6124b05..0ccd54ccd22104c18b1eade62b6a7dd3c83c4c03 100644 (file)
 #include <setjmp.h>
 #include <errno.h>
 #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 <F>ile <D>elete command
  */
-void deletefile() {
+void deletefile(void) {
        char filename[32];
        char cmd[256];
 
@@ -497,7 +497,7 @@ void deletefile() {
 /*
  * <.A>ide <F>ile <S>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 <F>ile <M>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 (file)
index 0000000..b1db0e7
--- /dev/null
@@ -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);
index 6787964efce1b95612e254c3404a8da533ca7608..399f5ab6efd31844ac0c3749facaa61ecd35c1cf 100644 (file)
@@ -12,6 +12,7 @@
 #include <string.h>
 #include <errno.h>
 #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 (file)
index 0000000..f2cb7bf
--- /dev/null
@@ -0,0 +1 @@
+void CtdlInternalGetServInfo(struct CtdlServInfo *infobuf);
index 467ba3391bc0a8093887b2ddbde2489ee05f9fc9..bf05610ea9551c2f385cab9618a5f9283233471c 100644 (file)
 #include <sys/stat.h>
 #include <netdb.h>
 #include <errno.h>
+#include <limits.h>
 
 #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;
index b5615154d2509710a7d010f1f220a9134bcdbd3b..0d7f4ce169353f5492dc32d291eaa9ebc4a10093 100644 (file)
@@ -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 (file)
index 0000000..72df186
--- /dev/null
@@ -0,0 +1 @@
+void strproc(char *string);
index 34090f179b136a8e093f54510d353e746bb27dae..c2ebc5f8eaad89e97005cccfb54bb391d10dd719 100644 (file)
@@ -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 <sys/select.h>
@@ -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 (file)
index 0000000..c2ef5b8
--- /dev/null
@@ -0,0 +1 @@
+void sysdep_master_cleanup(void);
index 725d41ab8c10b0bc92b190603be2a69f6546bd47..d52bad9d319ace1a872f4a5693595f7a222a9eed 100644 (file)
@@ -17,6 +17,7 @@
 #include "citadel.h"
 #include "server.h"
 #include "proto.h"
+#include "database.h"
 
 extern struct config config;
 
index 77c04ef659ce2771a40803dea0103a39f6e51f70..82636a1506d4fcb7d6f6580143348cfb607ea21a 100644 (file)
@@ -6,13 +6,13 @@
 #include "citadel.h"
 #include <unistd.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;
 
@@ -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);
index 29d942fd0c3b33c4c7f1dc6f4f68aca5d51045bc..ca19c4e12fda1752934f47899facf048dbf570f8 100644 (file)
@@ -4,13 +4,13 @@
 #include <string.h>
 #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);