+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.
#
########################################################################
-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)
#
#
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
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
clean:
find . -name \*.[o] -print -exec rm -f {} \;
- rm -f sysdep.h
+
+realclean: clean
+ rm -f sysdep.h $(CLIENT_TARGETS) $(SERVER_TARGETS) $(UTIL_TARGETS)
#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;
fclose(fp);
}
-void main(argc,argv)
-int argc;
-char *argv[];
+void main(int argc, char **argv)
{
char tempbase[32];
char temptmp[64];
#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;
#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 */
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);
}
* 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;
/*
* signal catching function for hangups...
*/
-void dropcarr() {
+void dropcarr(int signum) {
logoff(SIGHUP);
}
/* 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);
}
-void userlist() {
+void userlist(void) {
char buf[256];
char fl[256];
struct tm *tmbuf;
/*
* 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);
* '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;
/*
* 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;
/*
* 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;
* 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];
/*
* 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;
/*
* 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;
/*
* 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];
/*
* 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");
/*
* 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 */
/*
* 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! */
/*
* Set or change the user's password
*/
-int set_password() {
+int set_password(void) {
char pass1[20];
char pass2[20];
char buf[256];
/*
* get info about the server we've connected to
*/
-void get_serv_info() {
+void get_serv_info(void) {
char buf[256];
CtdlInternalGetServInfo(&serv_info);
/*
* 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 */
#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 */
--- /dev/null
+extern char fullname[32];
#include <string.h>
#include <errno.h>
#include "citadel.h"
+#include "serv_info.h"
+#include "ipc.h"
+#include "citadelapi.h"
struct CtdlInternalList {
struct CtdlServInfo CtdlAppServInfo;
int CtdlErrno = 0;
-void CtdlMain();
-
-void logoff(exitcode) {
+void logoff(int exitcode) {
exit(exitcode);
}
*
*/
-main(argc, argv)
-int argc;
-char *argv[]; {
+int
+main(int argc, char *argv[])
+{
int a;
char buf[256];
/* Set up the server environment to our liking */
- CtdlInternalGetServInfo(&CtdlAppServInfo, 0);
+ CtdlInternalGetServInfo(&CtdlAppServInfo);
sprintf(buf, "IDEN 0|5|006|CitadelAPI Client");
serv_puts(buf);
}
-int CtdlGetLastError() {
+int CtdlGetLastError(void) {
return CtdlErrno;
}
--- /dev/null
+void CtdlMain(void);
#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];
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;
/*
* 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);
}
#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;
}
/*
* 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> */
}
-void do_uudecode(target)
-char *target; {
+void do_uudecode(char *target)
+{
static char buf[1024];
FILE *fp;
}
-int alias(name)
-char *name; {
+int alias(char *name)
+{
FILE *fp;
int a;
char abuf[256];
-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;
#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();
/*
* 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");
* 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;
cprintf("%d\n",OK);
}
-void cmd_time()
+void cmd_time(void)
{
time_t tv;
}
else if (!strncasecmp(cmdbuf, "TIME", 4)) {
- cmd_time(&cmdbuf[5]);
+ cmd_time();
}
else if (!strncasecmp(cmdbuf, "HCHG", 4)) {
--- /dev/null
+void master_cleanup(void);
+void cleanup_stuff(void *);
#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];
--- /dev/null
+void chatmode(void);
#include <signal.h>
#include <errno.h>
#include "citadel.h"
+#include "commands.h"
struct citcmd {
struct citcmd *next;
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 */
/*
* print_express() - print express messages if there are any
*/
-void print_express() {
+void print_express(void) {
char buf[256];
FILE *outpipe;
}
-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;
}
-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;
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;
* 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);
* 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;
* 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);
}
-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);
/*
* parse the citadel.rc file
*/
-void load_command_set() {
+void load_command_set(void) {
FILE *ccfile;
char buf[256];
struct citcmd *cptr;
/*
* 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)
* 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];
* 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;
/*
* 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];
* 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;
* 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;
}
}
#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;
/*
* display_help() - help file viewer
*/
-void display_help(name)
-char name[]; {
+void display_help(char *name)
+{
formout(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);
/*
* support ANSI color if defined
*/
-void color(colornum)
-int colornum; {
+void color(int colornum)
+{
#ifdef ANSI_COLOR
if (enable_color) {
#endif
}
-void cls() {
+void cls(void) {
#ifdef ANSI_COLOR
fflush(stdout);
printf("%c[2J%c[H", 27, 27);
/*
* 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);
#endif
}
-void look_for_ansi() {
+void look_for_ansi(void) {
#ifdef ANSI_COLOR
fd_set rfds;
struct timeval tv;
--- /dev/null
+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);
#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];
--- /dev/null
+void get_config(void);
+extern struct config config;
+extern char bbs_home_directory[PATH_MAX];
+extern int home_specified;
+++ /dev/null
-void get_config();
-extern struct config config;
-extern char bbs_home_directory[PATH_MAX];
-extern int home_specified;
/*
* 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,
/*
* put_control - write the control record to disk.
*/
-void put_control() {
+void put_control(void) {
FILE *fp;
fp = fopen("citadel.control", "wb");
/*
* 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;
/*
* 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;
#include "citadel.h"
#include "server.h"
#include "proto.h"
+#include "database.h"
/*
* 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);
* 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,
* 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();
* 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;
/*
* 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;
* 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;
--- /dev/null
+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);
* 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);
#include "citadel.h"
#include "server.h"
#include "proto.h"
+#include "citserver.h"
/*
* Terminate idle sessions. This function pounds through the session table
/*
* Main housekeeping function. This gets run whenever a session terminates.
*/
-void do_housekeeping() {
+void do_housekeeping(void) {
begin_critical_section(S_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;
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;
--- /dev/null
+void LoadInternetConfig(void);
+int IsHostLocal(char *WhichHost);
--- /dev/null
+void attach_to_server(int argc, char **argv);
+extern char server_is_local;
+int getsockfd(void);
+char serv_getc(void);
#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
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;
* 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;
/*
* 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;
/*
* 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) {
/*
* 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;
/*
* 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);
/*
* 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;
/*
* return the file descriptor of the server socket so we can select() on it.
*/
-int getsockfd() {
+int getsockfd(void) {
return serv_sock;
}
/*
* return one character
*/
-char serv_getc() {
+char serv_getc(void) {
char buf[2];
char ch;
#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];
#include <string.h>
#include "citadel.h"
-void LoadInternetConfig();
-void get_config();
+void LoadInternetConfig(void);
+void get_config(void);
struct config config;
char ALIASES[128];
* 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];
/*
* 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];
#include <sys/wait.h>
#include <sys/stat.h>
#include "citadel.h"
+#include "messages.h"
#define MAXWORDBUF 256
#define MAXMSGS 512
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];
--- /dev/null
+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);
#include <errno.h>
#include <sys/stat.h>
#include "proto.h"
+#include "database.h"
#define MSGS_ALL 0
#define MSGS_OLD 1
#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);
}
#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];
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,"");
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;
#include <syslog.h>
#include "citadel.h"
-void LoadInternetConfig();
-void get_config();
+void LoadInternetConfig(void);
+void get_config(void);
struct config config;
char temp[20];
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;
-void fpgetfield(fp,string)
-FILE *fp;
-char string[];
+void fpgetfield(FILE *fp, char *string)
{
int a,b;
strcpy(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;
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];
*/
#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;
/*
* 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;
/*
* 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);
/*
* 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);
}
-void logoff(code)
-int code; {
+void logoff(int code)
+{
exit(code);
}
/*
* receive network spool from the remote system
*/
-void receive_spool() {
+void receive_spool(void) {
long download_len;
long bytes_received;
char buf[256];
/*
* 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;
-void main(argc,argv)
-int argc;
-char *argv[]; {
+void main(int argc, char **argv)
+{
char buf[256];
char remote_nodename[32];
int a;
};
-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];
/*
* 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);
#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;
}
* 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;
* 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;
/* 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;
/*
* 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;
/* 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;
/*
* 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;
return(0);
}
-void remove_lockfile() {
+void remove_lockfile(void) {
unlink(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);
* 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];
}
/* 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 (
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)) {
}
-void fpgetfield(fp,string)
-FILE *fp;
-char string[]; {
+void fpgetfield(FILE *fp, char *string)
+{
int a,b;
strcpy(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];
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];
/*
* 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;
/* send a bounce message */
-void bounce(bminfo)
-struct minfo *bminfo; {
+void bounce(struct minfo *bminfo)
+{
FILE *bounce;
char bfilename[64];
/*
* process incoming files in ./network/spoolin
*/
-void inprocess() {
+void inprocess(void) {
FILE *fp,*message,*testfp,*ls;
static struct minfo minfo;
struct recentmsg recentmsg;
}
-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);
/*
* 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];
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;
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];
/*
* 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 } ;
/*
* main
*/
-void main(argc,argv)
-int argc;
-char *argv[];
+void main(int argc, char **argv)
{
char allst[32];
FILE *allfp;
};
-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];
-void save_node(nnptr)
-struct netnode *nnptr; {
+void save_node(struct netnode *nnptr)
+{
FILE *fp;
char filename[256];
-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");
* Display all neighboring nodes
* (This is inherently nonportable)
*/
-void display_nodelist() {
+void display_nodelist(void) {
FILE *ls;
char buf[256];
/*
*/
-void add_node(NewNodeName)
-char *NewNodeName; {
+void add_node(char *NewNodeName)
+{
FILE *fp;
char sysfilename[256];
/*
*/
-void delete_node(NodeName)
-char *NodeName; {
+void delete_node(char *NodeName)
+{
FILE *fp;
char sysfilename[256];
char spooloutfilename[256];
/*
*/
-void do_roomlist(NodeName)
-char *NodeName; {
+void do_roomlist(char *NodeName)
+{
FILE *fp;
char sysfilename[256];
char buf[256];
/*
*/
-void show_spool_cmd(NodeName)
-char *NodeName; {
+void show_spool_cmd(char *NodeName)
+{
FILE *fp;
char sysfilename[256];
char buf[256];
/*
*/
-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);
/*
*/
-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;
/*
*/
-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;
}
-int main(argc, argv)
-int argc;
-char *argv[]; {
+int main(int argc, char **argv)
+{
if (argc < 2) {
display_usage();
#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;
-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];
}
-void getroom(room,ngroup)
-char room[];
-char ngroup[]; {
+void getroom(char *room, char *ngroup)
+{
char ngbuf[256];
char tryme[256];
int a,b;
}
}
-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];
#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;
#include "citadel.h"
#include "server.h"
#include "proto.h"
+#include "database.h"
extern struct config config;
#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[];
extern char floorlist[128][256];
-void load_floorlist() {
+void load_floorlist(void) {
int a;
char buf[256];
}
}
-void listrms(variety)
-char *variety; {
+void listrms(char *variety)
+{
char buf[256];
char rmname[32];
int f,c;
}
-void list_other_floors() {
+void list_other_floors(void) {
int a,c;
c = 1;
* 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;
}
-void listzrooms() { /* list public forgotten rooms */
+void listzrooms(void) { /* list public forgotten rooms */
color(3);
printf("\n Forgotten public rooms:\n");
listrms("LZRM");
}
-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"));
* 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];
/*
* .<A>ide <E>dit room
*/
-void editthisroom() {
+void editthisroom(void) {
char rname[20];
char rpass[10];
char rdir[15];
/*
* un-goto the previous room
*/
-void ungoto() {
+void ungoto(void) {
char buf[256];
if (!strcmp(ugname,"")) return;
* 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
/*
* read directory of this room
*/
-void roomdir() {
+void roomdir(void) {
char flnm[256];
char flsz[32];
char comment[256];
/*
* add a user to a private room
*/
-void invite() {
+void invite(void) {
char aaa[31],bbb[256];
if ((room_flags & QR_PRIVATE)==0) {
/*
* kick a user out of a room
*/
-void kickout() {
+void kickout(void) {
char aaa[31],bbb[256];
if ((room_flags & QR_PRIVATE)==0) {
/*
* aide command: kill the current room
*/
-void killroom() {
+void killroom(void) {
char aaa[100];
serv_puts("KILL 0");
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? ");
/*
* create a new room
*/
-void entroom() {
+void entroom(void) {
char cmd[256];
char new_room_name[20];
int new_room_type;
-void readinfo() { /* read info file for current room */
+void readinfo(void) { /* read info file for current room */
char cmd[256];
sprintf(cmd,"RINF");
/*
* <W>ho knows room...
*/
-void whoknows() {
+void whoknows(void) {
char buf[256];
serv_puts("WHOK");
serv_gets(buf);
}
-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;
}
-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");
/*
* create a new floor
*/
-void create_floor() {
+void create_floor(void) {
char buf[256];
char newfloorname[256];
/*
* edit the current floor
*/
-void edit_floor() {
+void edit_floor(void) {
char buf[256];
if (floorlist[(int)curr_floor][0]==0) load_floorlist();
/*
* kill the current floor
*/
-void kill_floor() {
+void kill_floor(void) {
int floornum_to_delete,a;
char buf[256];
--- /dev/null
+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);
#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)
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) {
/*
* 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;
/*
* num_parms() - discover number of parameters...
*/
-int num_parms(source)
-char source[]; {
+int num_parms(char *source)
+{
int a;
int count = 1;
/*
* 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;
/*
* 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);
/*
* 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);
}
}
-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);
}
-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);
/*
* change a user's access level
*/
-void edituser(userbuf)
-struct usersupp *userbuf; {
+void edituser(void)
+{
char who[256];
char buf[256];
}
-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;
* 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];
* 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,"");
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)
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();
* 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);
}
-void strproc(string)
-char string[];
+void strproc(char *string)
{
int a;
}
-int hash(str)
-char str[]; {
+int hash(char *str)
+{
int h = 0;
int i;
return(h);
}
-long finduser(file,name)
-int file;
-char *name; {
+long finduser(int file, char *name)
+{
FILE *fp;
int uh,fh;
long pp=0L;
}
-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];
/*
* 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);
#endif
-void progress(curr,cmax)
-long curr;
-long cmax; {
+void progress(long int curr, long int cmax)
+{
static long dots_printed;
long a;
* 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;
/*
* compute the checksum of a file
*/
-int file_checksum(filename)
-char *filename; {
+int file_checksum(char *filename)
+{
int cksum = 0;
int ch;
FILE *fp;
/*
* nuke a directory and its contents
*/
-int nukedir(dirname)
-char *dirname; {
+int nukedir(char *dirname)
+{
DIR *dp;
struct dirent *d;
char filename[256];
--- /dev/null
+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);
#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[];
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) {
}
-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=']';
return(a);
}
-void entregis() /* register with name and address */
+void entregis(void) /* register with name and address */
{
char buf[256];
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);
/*
* 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];
/*
* 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];
/*
* validate a user
*/
-void val_user(user)
-char *user; {
+void val_user(char *user)
+{
int a,b;
char cmd[256];
char buf[256];
}
-void validate() { /* validate new users */
+void validate(void) { /* validate new users */
char cmd[256];
char buf[256];
int finished = 0;
} while(finished==0);
}
-void subshell() {
+void subshell(void) {
int a,b;
a=fork();
if (a==0) {
/*
* <.A>ide <F>ile <D>elete command
*/
-void deletefile() {
+void deletefile(void) {
char filename[32];
char cmd[256];
/*
* <.A>ide <F>ile <S>end command
*/
-void netsendfile() {
+void netsendfile(void) {
char filename[32],destsys[20],cmd[256];
newprompt("Filename: ",filename,31);
/*
* <.A>ide <F>ile <M>ove command
*/
-void movefile() {
+void movefile(void) {
char filename[64];
char newroom[20];
char cmd[256];
/*
* list of users who have filled out a bio
*/
-void list_bio() {
+void list_bio(void) {
char buf[256];
int pos = 1;
/*
* read bio
*/
-void read_bio() {
+void read_bio(void) {
char who[256];
char buf[256];
--- /dev/null
+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);
#include <string.h>
#include <errno.h>
#include "citadel.h"
+#include "serv_info.h"
void CtdlInternalGetServInfo(struct CtdlServInfo *infobuf) {
char buf[256];
--- /dev/null
+void CtdlInternalGetServInfo(struct CtdlServInfo *infobuf);
#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
};
-
-long atol();
-void get_config();
struct config config;
int direction;
#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;
-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
fgets(junk, 5, stdin);
}
-int yesno(question)
-char *question; {
+int yesno(char *question)
+{
int answer = 0;
char buf[4096];
-void dump_access_levels() {
+void dump_access_levels(void) {
int a;
for (a=0; a<=6; ++a) printf("%d %s\n",a,axdefs[a]);
}
} while(atol(setup_text[a])!=(msgnum+1));
}
-void print_setup(msgnum) {
+void print_setup(int msgnum) {
char dispbuf[4096];
get_setup_msg(dispbuf, msgnum);
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;
* check_services_entry() -- Make sure "citadel" is in /etc/services
*
*/
-void check_services_entry() {
+void check_services_entry(void) {
char question[128];
FILE *sfp;
* 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];
}
}
-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);
}
-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);
}
-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);
}
-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];
return(0); /* just in case */
}
+#endif
-void edit_value(curr)
-int curr; {
+void edit_value(int curr)
+{
int a;
switch(curr) {
/*
* (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");
/*
* 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;
int Ctimescalled;
};
-void get_config ();
+void get_config (void);
struct config config;
void
-prompt ()
+prompt (void)
{
char buf[16];
if (batch_mode == 0)
}
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;
void
-progress (curr, max)
- long curr;
- long max;
+progress (long int curr, long int max)
{
static int dots;
int pos;
void
-main (argc, argv)
- int argc;
- char *argv[];
+main (int argc, char **argv)
{
time_t LogTime;
unsigned int LogType;
--- /dev/null
+void strproc(char *string);
#include "citadel.h"
#include "server.h"
#include "proto.h"
+#include "sysdep_decls.h"
+#include "citserver.h"
#ifdef NEED_SELECT_H
#include <sys/select.h>
* 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);
}
--- /dev/null
+void sysdep_master_cleanup(void);
#include "citadel.h"
#include "server.h"
#include "proto.h"
+#include "database.h"
extern struct config config;
#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;
/*
* 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;
/*
* 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);
/*
* 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);
}
-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;
}
-void main(argc,argv)
-int argc;
-char *argv[]; {
+void main(int argc, char **argv)
+{
char buf[256];
attach_to_server(argc,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);
#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;
/*
* 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;
/*
* 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);
}
-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;
/*
* 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);