From: Nathan Bryant Date: Tue, 25 Aug 1998 00:34:03 +0000 (+0000) Subject: Mon Aug 24 20:04:04 EDT 1998 Nathan Bryant X-Git-Tag: v7.86~8383 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=c9b74bf4f13068eec3918a78e2267568230f0361 Mon Aug 24 20:04:04 EDT 1998 Nathan Bryant * Makefile.in: new target `cleaner' does the same as `realclean' without removing sysdep.h * proto.h: is bad. eliminate. I've moved the prototypes into several header files, one per .c file --- diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 34ad3a0a2..9b4243fd9 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,3 +1,9 @@ +Mon Aug 24 20:04:04 EDT 1998 Nathan Bryant + * Makefile.in: new target `cleaner' does the same as `realclean' + without removing sysdep.h + * proto.h: is bad. eliminate. I've moved the prototypes into several + header files, one per .c file + Mon Aug 24 00:45:55 EDT 1998 Art Cancro * Added a CtdlGotoRoom() function to the CitadelAPI. diff --git a/citadel/Makefile.in b/citadel/Makefile.in index 84a476ea6..a2a3246cf 100644 --- a/citadel/Makefile.in +++ b/citadel/Makefile.in @@ -193,5 +193,8 @@ citadel.h: sysdep.h sysconfig.h ipcdef.h server.h clean: find . -name \*.[o] -print -exec rm -f {} \; -realclean: clean - rm -f sysdep.h $(CLIENT_TARGETS) $(SERVER_TARGETS) $(UTIL_TARGETS) +cleaner: clean + rm -f $(CLIENT_TARGETS) $(SERVER_TARGETS) $(UTIL_TARGETS) + +realclean: cleaner + rm -f sysdep.h diff --git a/citadel/citadel.c b/citadel/citadel.c index 39ab5a7da..22428b4de 100644 --- a/citadel/citadel.c +++ b/citadel/citadel.c @@ -29,7 +29,6 @@ #include "commands.h" #include "rooms.h" #include "messages.h" -#include "support.h" #include "ipc.h" #include "client_chat.h" #include "citadel_decls.h" diff --git a/citadel/citadelapi.c b/citadel/citadelapi.c index 5f01e34f9..9e68e8733 100644 --- a/citadel/citadelapi.c +++ b/citadel/citadelapi.c @@ -9,6 +9,7 @@ #include "serv_info.h" #include "ipc.h" #include "citadelapi.h" +#include "support.h" struct CtdlInternalList { @@ -414,5 +415,6 @@ int CtdlGotoRoom(char *RoomName) { CtdlErrno = atoi(buf); return(CtdlErrno); } - extract(&CtdlCurrentRoom.RoomName, &buf[4], 0); + extract(CtdlCurrentRoom.RoomName, &buf[4], 0); + return 0; } diff --git a/citadel/citadelapi.h b/citadel/citadelapi.h index 3da2adb8a..b70fe003d 100644 --- a/citadel/citadelapi.h +++ b/citadel/citadelapi.h @@ -1 +1,2 @@ void CtdlMain(void); +int CtdlGotoRoom(char *RoomName); diff --git a/citadel/citserver.c b/citadel/citserver.c index 94ed1d3cd..7bb788c17 100644 --- a/citadel/citserver.c +++ b/citadel/citserver.c @@ -11,10 +11,20 @@ #include #include "citadel.h" #include "server.h" -#include "proto.h" #include "sysdep_decls.h" #include "citserver.h" #include "config.h" +#include "database.h" +#include "housekeeping.h" +#include "hooks.h" +#include "user_ops.h" +#include "logging.h" +#include "support.h" +#include "msgbase.h" +#include "locate_host.h" +#include "serv_chat.h" +#include "room_ops.h" +#include "file_ops.h" struct CitContext *ContextList = NULL; int ScheduledShutdown = 0; diff --git a/citadel/citserver.h b/citadel/citserver.h index 0b70e0b68..7e51353c2 100644 --- a/citadel/citserver.h +++ b/citadel/citserver.h @@ -1,2 +1,23 @@ -void master_cleanup(void); -void cleanup_stuff(void *); +void master_startup (void); +void master_cleanup (void); +void cleanup_stuff (void *arg); +void set_wtmpsupp (char *newtext); +void cmd_info (void); +void cmd_rchg (char *newroomname); +void cmd_hchg (char *newhostname); +void cmd_uchg (char *newusername); +void cmd_time (void); +int is_public_client (char *where); +void cmd_iden (char *argbuf); +void cmd_stel (char *cmdbuf); +void cmd_mesg (char *mname); +void cmd_emsg (char *mname); +void cmd_rwho (void); +void cmd_term (char *cmdbuf); +void cmd_more (void); +void cmd_echo (char *etext); +void cmd_ipgm (char *argbuf); +void cmd_down (void); +void cmd_scdn (char *argbuf); +void cmd_extn (char *argbuf); +void *context_loop (struct CitContext *con); diff --git a/citadel/control.c b/citadel/control.c index 4aa5baf77..6d63d214a 100644 --- a/citadel/control.c +++ b/citadel/control.c @@ -18,7 +18,8 @@ #include #include "citadel.h" #include "server.h" -#include "proto.h" +#include "control.h" +#include "sysdep_decls.h" struct CitControl CitControl; diff --git a/citadel/control.h b/citadel/control.h new file mode 100644 index 000000000..56be87f34 --- /dev/null +++ b/citadel/control.h @@ -0,0 +1,4 @@ +void get_control (void); +void put_control (void); +long int get_new_message_number (void); +long int get_new_user_number (void); diff --git a/citadel/database.c b/citadel/database.c index 3f47453bd..949a3726b 100644 --- a/citadel/database.c +++ b/citadel/database.c @@ -15,8 +15,8 @@ #include #include "citadel.h" #include "server.h" -#include "proto.h" #include "database.h" +#include "sysdep_decls.h" /* diff --git a/citadel/database.h b/citadel/database.h index 52d00de40..53160696a 100644 --- a/citadel/database.h +++ b/citadel/database.h @@ -1,3 +1,9 @@ -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); +void defrag_databases (void); +void open_databases (void); +void close_databases (void); +int cdb_store (int cdb, void *key, int keylen, void *data, int datalen); +int cdb_delete (int cdb, void *key, int keylen); +struct cdbdata *cdb_fetch (int cdb, void *key, int keylen); +void cdb_free (struct cdbdata *cdb); +void cdb_rewind (int cdb); +struct cdbdata *cdb_next_item (int cdb); diff --git a/citadel/file_ops.c b/citadel/file_ops.c index b0ae01a67..436ff717e 100644 --- a/citadel/file_ops.c +++ b/citadel/file_ops.c @@ -10,7 +10,13 @@ #include #include "citadel.h" #include "server.h" -#include "proto.h" +#include "config.h" +#include "file_ops.h" +#include "sysdep_decls.h" +#include "user_ops.h" +#include "support.h" +#include "room_ops.h" +#include "msgbase.h" void cmd_delf(char *filename) { diff --git a/citadel/file_ops.h b/citadel/file_ops.h new file mode 100644 index 000000000..ce4f46a1b --- /dev/null +++ b/citadel/file_ops.h @@ -0,0 +1,16 @@ +void cmd_delf (char *filename); +void cmd_movf (char *cmdbuf); +void cmd_netf (char *cmdbuf); +void OpenCmdResult (void); +void cmd_open (char *cmdbuf); +void cmd_oimg (char *cmdbuf); +void cmd_uopn (char *cmdbuf); +void cmd_uimg (char *cmdbuf); +void cmd_clos (void); +void abort_upl (struct CitContext *who); +void cmd_ucls (char *cmd); +void cmd_read (char *cmdbuf); +void cmd_writ (char *cmdbuf); +void cmd_netp (char *cmdbuf); +void cmd_ndop (char *cmdbuf); +void cmd_nuop (char *cmdbuf); diff --git a/citadel/hooks.h b/citadel/hooks.h new file mode 100644 index 000000000..70572cf84 --- /dev/null +++ b/citadel/hooks.h @@ -0,0 +1,10 @@ +void hook_init (void); +void hook_start_session (int session_num); +void hook_end_session (int session_num); +void hook_command_received (int session_num, char *cmdbuf); +void hook_crit_get (int session_num, int which_one); +void hook_crit_got (int session_num, int which_one); +void hook_crit_end (int session_num, int which_one); +void hook_user_login (int session_num, char *user_name); +void hook_room_name (int session_num, char *room_name); +void hook_cleanup (void); diff --git a/citadel/housekeeping.c b/citadel/housekeeping.c index b4d76e970..bff891087 100644 --- a/citadel/housekeeping.c +++ b/citadel/housekeeping.c @@ -14,8 +14,11 @@ #include #include "citadel.h" #include "server.h" -#include "proto.h" #include "citserver.h" +#include "config.h" +#include "housekeeping.h" +#include "sysdep_decls.h" +#include "room_ops.h" /* * Terminate idle sessions. This function pounds through the session table diff --git a/citadel/housekeeping.h b/citadel/housekeeping.h new file mode 100644 index 000000000..9ec3e62b8 --- /dev/null +++ b/citadel/housekeeping.h @@ -0,0 +1,3 @@ +void terminate_idle_sessions (void); +void do_housekeeping (void); +void check_ref_counts (void); diff --git a/citadel/import.c b/citadel/import.c index 9dcfd1988..da9b111df 100644 --- a/citadel/import.c +++ b/citadel/import.c @@ -11,7 +11,6 @@ #include #include "citadel.h" #include "server.h" -#include "proto.h" int ssv_maxrooms = 0; int ssv_maxfloors = 0; diff --git a/citadel/locate_host.c b/citadel/locate_host.c index d3c194adc..c45c86430 100644 --- a/citadel/locate_host.c +++ b/citadel/locate_host.c @@ -15,8 +15,8 @@ #include "sysdep.h" #include "citadel.h" #include "server.h" - -struct config config; +#include "locate_host.h" +#include "config.h" void locate_host(char *tbuf) { diff --git a/citadel/locate_host.h b/citadel/locate_host.h new file mode 100644 index 000000000..584ca2952 --- /dev/null +++ b/citadel/locate_host.h @@ -0,0 +1 @@ +void locate_host(char *tbuf); diff --git a/citadel/logging.c b/citadel/logging.c index 9de7305c1..e76827036 100644 --- a/citadel/logging.c +++ b/citadel/logging.c @@ -15,7 +15,7 @@ #include #include "citadel.h" #include "server.h" -#include "proto.h" +#include "logging.h" void rec_log(unsigned int lrtype, char *name) { diff --git a/citadel/logging.h b/citadel/logging.h new file mode 100644 index 000000000..5d3ab64ed --- /dev/null +++ b/citadel/logging.h @@ -0,0 +1 @@ +void rec_log (unsigned int lrtype, char *name); diff --git a/citadel/msgbase.c b/citadel/msgbase.c index 597f62725..0df73f539 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -11,8 +11,13 @@ #include "server.h" #include #include -#include "proto.h" #include "database.h" +#include "msgbase.h" +#include "support.h" +#include "sysdep_decls.h" +#include "room_ops.h" +#include "user_ops.h" +#include "control.h" #define MSGS_ALL 0 #define MSGS_OLD 1 diff --git a/citadel/msgbase.h b/citadel/msgbase.h new file mode 100644 index 000000000..c08446d5e --- /dev/null +++ b/citadel/msgbase.h @@ -0,0 +1,24 @@ +int alias (char *name); +void get_mm (void); +void cmd_msgs (char *cmdbuf); +void help_subst (char *strbuf, char *source, char *dest); +void do_help_subst (char *buffer); +void memfmout (int width, char *mptr, char subst); +void output_message (char *msgid, int mode, int headers_only); +void cmd_msg0 (char *cmdbuf); +void cmd_msg2 (char *cmdbuf); +void cmd_msg3 (char *cmdbuf); +long int send_message (char *message_in_memory, size_t message_length, + int generate_id); +void loadtroom (void); +void copy_file (char *from, char *to); +void save_message (char *mtmp, char *rec, char mtsflag, int mailtype, + int generate_id); +void aide_message (char *text); +void make_message (char *filename, struct usersupp *author, char *recipient, + char *room, int type, int net_type, int format_type, + char *fake_name); +void cmd_ent0 (char *entargs); +void cmd_ent3 (char *entargs); +void cmd_dele (char *delstr); +void cmd_move (char *args); diff --git a/citadel/room_ops.c b/citadel/room_ops.c index 95c903bdf..8af8feac5 100644 --- a/citadel/room_ops.c +++ b/citadel/room_ops.c @@ -6,12 +6,15 @@ #include #include "citadel.h" #include "server.h" -#include "proto.h" #include "database.h" - -extern struct config config; - -FILE *popen(const char *, const char *); +#include "config.h" +#include "room_ops.h" +#include "sysdep_decls.h" +#include "support.h" +#include "user_ops.h" +#include "msgbase.h" +#include "serv_chat.h" +#include "citserver.h" /* * is_known() - returns nonzero if room is in user's known room list diff --git a/citadel/room_ops.h b/citadel/room_ops.h new file mode 100644 index 000000000..2bcaa6ef5 --- /dev/null +++ b/citadel/room_ops.h @@ -0,0 +1,44 @@ +int is_known (struct quickroom *roombuf, int roomnum, + struct usersupp *userbuf); +int has_newmsgs (struct quickroom *roombuf, int roomnum, + struct usersupp *userbuf); +int is_zapped (struct quickroom *roombuf, int roomnum, + struct usersupp *userbuf); +void getroom (struct quickroom *qrbuf, int room_num); +void lgetroom (struct quickroom *qrbuf, int room_num); +void putroom (struct quickroom *qrbuf, int room_num); +void lputroom (struct quickroom *qrbuf, int room_num); +void getfloor (struct floor *flbuf, int floor_num); +void lgetfloor (struct floor *flbuf, int floor_num); +void putfloor (struct floor *flbuf, int floor_num); +void lputfloor (struct floor *flbuf, int floor_num); +void get_msglist (int room_num); +void put_msglist (int room_num); +long int MessageFromList (int whichpos); +void SetMessageInList (int whichpos, long int newmsgnum); +int sort_msglist (long int *listptrs, int oldcount); +void cmd_lrms (char *argbuf); +void cmd_lkra (char *argbuf); +void cmd_lkrn (char *argbuf); +void cmd_lkro (char *argbuf); +void cmd_lzrm (char *argbuf); +void usergoto (int where, int display_result); +void cmd_goto (char *gargs); +void cmd_whok (void); +void cmd_rdir (void); +void cmd_getr (void); +void cmd_setr (char *args); +void cmd_geta (void); +void cmd_seta (char *new_ra); +void cmd_rinf (void); +void cmd_kill (char *argbuf); +int get_free_room_slot (int search_dir); +unsigned int create_room (int free_slot, char *new_room_name, + int new_room_type, char *new_room_pass, + int new_room_floor); +void cmd_cre8 (char *args); +void cmd_einf (char *ok); +void cmd_lflr (void); +void cmd_cflr (char *argbuf); +void cmd_kflr (char *argbuf); +void cmd_eflr (char *argbuf); diff --git a/citadel/routines.h b/citadel/routines.h index 98c199488..50deeb8c7 100644 --- a/citadel/routines.h +++ b/citadel/routines.h @@ -13,3 +13,4 @@ void locate_host(char *hbuf); void misc_server_cmd(char *cmd); int nukedir(char *dirname); int num_parms(char *source); +void strproc(char *string); diff --git a/citadel/serv_chat.c b/citadel/serv_chat.c index d9f1c2fd0..ea34b2206 100644 --- a/citadel/serv_chat.c +++ b/citadel/serv_chat.c @@ -16,12 +16,12 @@ #ifdef NEED_SELECT_H #include #endif -#include "proto.h" +#include "serv_chat.h" +#include "sysdep_decls.h" +#include "citserver.h" +#include "support.h" extern struct config config; - -typedef struct CitContext t_context; - extern struct CitContext *ContextList; struct ChatLine *ChatQueue = NULL; diff --git a/citadel/serv_chat.h b/citadel/serv_chat.h new file mode 100644 index 000000000..124232c11 --- /dev/null +++ b/citadel/serv_chat.h @@ -0,0 +1,7 @@ +void allwrite (char *cmdbuf, int flag, char *roomname, char *username); +t_context *find_context (char **unstr); +void do_chat_listing (int allflag); +void cmd_chat (char *argbuf); +void cmd_pexp (void); +char check_express (void); +void cmd_sexp (char *argbuf); diff --git a/citadel/server.h b/citadel/server.h index 60becc03e..32a2e98f2 100644 --- a/citadel/server.h +++ b/citadel/server.h @@ -72,6 +72,8 @@ struct CitContext { int CtdlErrno; /* Error return for CitadelAPI calls */ }; +typedef struct CitContext t_context; + #define CS_STEALTH 1 /* stealth mode */ #define CS_CHAT 2 /* chat mode */ #define CS_POSTING 4 /* Posting */ diff --git a/citadel/support.c b/citadel/support.c index 455a99d9b..62a2f4497 100644 --- a/citadel/support.c +++ b/citadel/support.c @@ -6,7 +6,7 @@ #include #include "citadel.h" #include "server.h" -#include "proto.h" +#include "support.h" /* diff --git a/citadel/support.h b/citadel/support.h index 72df18679..1eed11470 100644 --- a/citadel/support.h +++ b/citadel/support.h @@ -1 +1,8 @@ -void strproc(char *string); +void strproc (char *string); +int num_parms (char *source); +void extract (char *dest, char *source, int parmnum); +int extract_int (char *source, int parmnum); +long int extract_long (char *source, long int parmnum); +int getstring (FILE *fp, char *string); +int pattern2 (char *search, char *patn); +void mesg_locate (char *targ, char *searchfor, int numdirs, char **dirs); diff --git a/citadel/sysdep.c b/citadel/sysdep.c index c2ebc5f8e..01a54cf59 100644 --- a/citadel/sysdep.c +++ b/citadel/sysdep.c @@ -31,9 +31,13 @@ #include #include "citadel.h" #include "server.h" -#include "proto.h" #include "sysdep_decls.h" #include "citserver.h" +#include "hooks.h" +#include "support.h" +#include "config.h" +#include "database.h" +#include "housekeeping.h" #ifdef NEED_SELECT_H #include diff --git a/citadel/sysdep_decls.h b/citadel/sysdep_decls.h index c2ef5b8fa..92eba8d6b 100644 --- a/citadel/sysdep_decls.h +++ b/citadel/sysdep_decls.h @@ -1 +1,22 @@ -void sysdep_master_cleanup(void); +void lprintf (int loglevel, const char *format, ...); +void init_sysdep (void); +void begin_critical_section (int which_one); +void end_critical_section (int which_one); +int ig_tcp_server (int port_number, int queue_len); +struct CitContext *MyContext (void); +struct CitContext *CreateNewContext (void); +void InitMyContext (struct CitContext *con); +void RemoveContext (struct CitContext *con); +int session_count (void); +void client_write (char *buf, int nbytes); +void cprintf (const char *format, ...); +int client_read_to (char *buf, int bytes, int timeout); +int client_read (char *buf, int bytes); +int client_gets (char *buf); +void sysdep_master_cleanup (void); +void cleanup (int exit_code); +void kill_session (int session_to_kill); +void sd_context_loop (struct CitContext *con); +void start_daemon (int do_close_stdio); +void cmd_nset (char *cmdbuf); +int convert_login (char *NameToConvert); diff --git a/citadel/user_ops.c b/citadel/user_ops.c index ffe51f9dd..1e1e84499 100644 --- a/citadel/user_ops.c +++ b/citadel/user_ops.c @@ -16,8 +16,16 @@ #include #include "citadel.h" #include "server.h" -#include "proto.h" #include "database.h" +#include "user_ops.h" +#include "sysdep_decls.h" +#include "support.h" +#include "hooks.h" +#include "room_ops.h" +#include "logging.h" +#include "file_ops.h" +#include "control.h" +#include "msgbase.h" extern struct config config; diff --git a/citadel/user_ops.h b/citadel/user_ops.h new file mode 100644 index 000000000..a90e7bba7 --- /dev/null +++ b/citadel/user_ops.h @@ -0,0 +1,33 @@ +int hash (char *str); +int getuser (struct usersupp *usbuf, char *name); +int lgetuser (struct usersupp *usbuf, char *name); +void putuser (struct usersupp *usbuf, char *name); +void lputuser (struct usersupp *usbuf, char *name); +int is_aide (void); +int is_room_aide (void); +int getuserbynumber (struct usersupp *usbuf, long int number); +void cmd_user (char *cmdbuf); +void session_startup (void); +void logout (struct CitContext *who); +void cmd_pass (char *buf); +int purge_user (char *pname); +int create_user (char *newusername); +void cmd_newu (char *cmdbuf); +void cmd_setp (char *new_pw); +void cmd_getu (void); +void cmd_setu (char *new_parms); +void cmd_slrp (char *new_ptr); +void cmd_invt_kick (char *iuser, int op); +void cmd_forg (void); +void cmd_gnur (void); +void cmd_greg (char *who); +void cmd_vali (char *v_args); +void cmd_list (void); +void cmd_regi (void); +void cmd_chek (void); +void cmd_qusr (char *who); +void cmd_ebio (void); +void cmd_rbio (char *cmdbuf); +void cmd_lbio (void); +void cmd_agup (char *cmdbuf); +void cmd_asup (char *cmdbuf);