From c5dcefbe1b55c201cb1ed948d859c1c1ff6ab51b Mon Sep 17 00:00:00 2001 From: Nathan Bryant Date: Fri, 29 Jan 1999 08:58:46 +0000 Subject: [PATCH] irix fixen --- citadel/ChangeLog | 7 +++++++ citadel/Makefile.in | 2 +- citadel/citadel.c | 2 +- citadel/citadel.spec | 6 +++--- citadel/citserver.c | 6 +++--- citadel/client_chat.c | 2 +- citadel/configure.in | 34 ++++++++++++++++++++++++---------- citadel/ipc_c_tcp.c | 4 ++-- citadel/mailinglist.c | 2 +- citadel/messages.c | 5 ++--- citadel/messages.h | 1 + citadel/mime_parser.c | 8 ++++---- citadel/msgbase.c | 6 +++--- citadel/netmailer.c | 2 +- citadel/netpoll.c | 6 +++--- citadel/netproc.c | 13 +++++++------ citadel/rcit.c | 4 ++-- citadel/routines2.c | 4 ++-- citadel/sendcommand.c | 4 ++-- citadel/serv_chat.c | 4 ++-- citadel/serv_info.c | 2 +- citadel/serv_upgrade.c | 6 +++--- citadel/setup.c | 2 +- citadel/user_ops.c | 12 +++++++----- 24 files changed, 84 insertions(+), 60 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 183d3455b..379328dd4 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,3 +1,10 @@ +1999-01-29 Nathan Bryant + * fixes for IRIX (thanks to wr and family for use of the Indy): + - use memset()/memcpy() instead of bzero()/bcopy() in all cases + - configure updates + - handle `long' pid's + - a few other little bits + Mon Jan 25 21:23:07 EST 1999 Art Cancro * Fixed bug in save_message() which crashed the server on mail to sysop * Rewrote pop_march() to be smarter about oto heuristics diff --git a/citadel/Makefile.in b/citadel/Makefile.in index 69ac0bd37..7bfc5c038 100644 --- a/citadel/Makefile.in +++ b/citadel/Makefile.in @@ -219,7 +219,7 @@ cleaner: clean $(SERV_MODULES) $(PROXY_TARGETS) so_locations distclean: cleaner - rm -f Makefile sysdep.h config.cache config.log config.status *.d + rm -f Makefile sysdep.h config.cache config.log config.status *.d weekly .c.d: $(CC) -M $(CPPFLAGS) $< | sed -e 's!$*.o!$*.o $*.ro $*.mo $@!' > $@ diff --git a/citadel/citadel.c b/citadel/citadel.c index 36a5b172f..6d63f177b 100644 --- a/citadel/citadel.c +++ b/citadel/citadel.c @@ -806,7 +806,7 @@ int main(int argc, char **argv) int a,b,mcmd; char aaa[100],bbb[100],eee[100]; /* general purpose variables */ char argbuf[32]; /* command line buf */ -int termn8 = 0; +volatile int termn8 = 0; sttybbs(SB_SAVE); /* Store the old terminal parameters */ diff --git a/citadel/citadel.spec b/citadel/citadel.spec index f8e627e39..6b89b758d 100644 --- a/citadel/citadel.spec +++ b/citadel/citadel.spec @@ -1,8 +1,8 @@ # $Id$ -Summary: Citadel/UX 5.50 +Summary: Citadel/UX Name: citadel -Version: 5.50 -Release: 0.4 +Version: 5.52 +Release: 1 Copyright: GPL Group: Applications/Communications Source0: citadel.tar.gz diff --git a/citadel/citserver.c b/citadel/citserver.c index c75983916..95a321411 100644 --- a/citadel/citserver.c +++ b/citadel/citserver.c @@ -195,7 +195,7 @@ void cmd_hchg(char *newhostname) { if ((newhostname) && (newhostname[0])) { - bzero(CC->fake_hostname, 25); + memset(CC->fake_hostname, 0, 25); strncpy(CC->fake_hostname, newhostname, 24); } else @@ -214,7 +214,7 @@ void cmd_uchg(char *newusername) if ((newusername) && (newusername[0])) { CC->cs_flags &= ~CS_STEALTH; - bzero(CC->fake_username, 32); + memset(CC->fake_username, 0, 32); if (strncasecmp(newusername, CC->curr_user, strlen(CC->curr_user))) strncpy(CC->fake_username, newusername, 31); } @@ -726,7 +726,7 @@ void *context_loop(struct CitContext *con) do { time(&CC->lastcmd); - bzero(cmdbuf, sizeof cmdbuf); /* Clear it, just in case */ + memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */ if (client_gets(cmdbuf) < 1) cleanup(EXIT_NULL); lprintf(5, "citserver[%3d]: %s\n", CC->cs_pid, cmdbuf); diff --git a/citadel/client_chat.c b/citadel/client_chat.c index 16ec066d0..69996df9c 100644 --- a/citadel/client_chat.c +++ b/citadel/client_chat.c @@ -229,7 +229,7 @@ void page_user() { } printf("Type message to send. Enter a blank line when finished.\n"); - bzero(longmsg, sizeof longmsg); + memset(longmsg, 0, sizeof longmsg); for (i=0; i<5; ++i) { printf("> "); getline(&longmsg[i][0], 77); diff --git a/citadel/configure.in b/citadel/configure.in index d7499d28f..cfec538fe 100644 --- a/citadel/configure.in +++ b/citadel/configure.in @@ -1,5 +1,6 @@ dnl Process this file with autoconf to produce a configure script. -AC_PREREQ(2.12) +dnl $Id$ +AC_PREREQ(2.13) AC_INIT(citserver.c) AC_PREFIX_DEFAULT(/usr/local/citadel) if test "$prefix" = NONE; then @@ -33,7 +34,13 @@ if test "$GCC" = yes; then CFLAGS="$CFLAGS -Wall -Wstrict-prototypes" dnl pass -rdynamic to the linker to enable dlopen() modules to dnl refer to symbols in the main executable (applies to citserver) - SERVER_LDFLAGS=-rdynamic + case "$host" in + mips*-sgi-irix*) + ;; + *) + SERVER_LDFLAGS=-rdynamic + ;; + esac PICFLAGS=-fPIC fi AC_PROG_RANLIB @@ -48,13 +55,26 @@ dnl Makefile only passes $(LIBS) to that target. If other programs start dnl requiring additional libraries, we'll have to use other variables, as is dnl done with curses. +dnl We want to test for crypt() and dlopen() in libc before checking for +dnl -lcrypt and -ldl, because some systems (like Irix) have both. +AC_CHECK_FUNCS(crypt dlopen) + dnl We only need crypt() if we're using autologin. FIXME: implement shadow dnl passwords and/or PAM... -if test "$enable_autologin" != no; then +if test "$enable_autologin" != no -a "$ac_cv_func_crypt" = no; then AC_CHECK_LIB(crypt, crypt) fi -AC_CHECK_LIB(dl, dlopen) +dnl Enable autologin if the feature is requested (which is the default) and +dnl a crypt() functin is available. +if test "$enable_autologin" != no -a \( "$ac_cv_func_crypt" = yes -o "$ac_cv_lib_crypt_crypt" = yes \); then + AC_DEFINE(ENABLE_AUTOLOGIN) +fi + +if test "$ac_cv_func_dlopen" = no; then + AC_CHECK_LIB(dl, dlopen) +fi + AC_CHECK_LIB(gdbm, gdbm_open) AC_CHECK_LIB(curses, initscr, CURSES=-lcurses) @@ -88,12 +108,6 @@ AC_TYPE_SIGNAL AC_FUNC_VPRINTF AC_CHECK_FUNCS(snprintf mkdir mktime rmdir select socket strerror) -dnl Enable autologin if the feature is requested (which is the default) and -dnl a crypt() function is available. -if test "$enable_autologin" != no; then - AC_CHECK_FUNC(crypt, AC_DEFINE(ENABLE_AUTOLOGIN)) -fi - dnl Tell the Makefile whether we need to use our snprintf() replacement. if test "$ac_cv_func_snprintf" = no; then SNPRINTF=snprintf.o diff --git a/citadel/ipc_c_tcp.c b/citadel/ipc_c_tcp.c index 4d2759e4e..7f98a833c 100644 --- a/citadel/ipc_c_tcp.c +++ b/citadel/ipc_c_tcp.c @@ -60,7 +60,7 @@ int connectsock(char *host, char *service, char *protocol) struct sockaddr_in sin; int s,type; - bzero((char *)&sin,sizeof(sin)); + memset(&sin,0,sizeof(sin)); sin.sin_family = AF_INET; pse=getservbyname(service,protocol); @@ -128,7 +128,7 @@ void numericize(char *buf, char *host, char *service, char *protocol) struct servent *pse; struct sockaddr_in sin; - bzero((char *)&sin,sizeof(sin)); + memset(&sin,0,sizeof(sin)); sin.sin_family = AF_INET; pse=getservbyname(service,protocol); diff --git a/citadel/mailinglist.c b/citadel/mailinglist.c index 9c839b771..9bd5e087c 100644 --- a/citadel/mailinglist.c +++ b/citadel/mailinglist.c @@ -83,7 +83,7 @@ int main(void) { get_config(); LoadInternetConfig(); - sprintf(tempfile, "/tmp/mlist.%d", getpid() ); + sprintf(tempfile, "/tmp/mlist.%ld", (long)getpid() ); while(1) { diff --git a/citadel/messages.c b/citadel/messages.c index 4fcde0812..92c5b1eb2 100644 --- a/citadel/messages.c +++ b/citadel/messages.c @@ -82,7 +82,7 @@ void ka_sigcatch(int signum) { /* * server keep-alive version of wait() (needed for external editor) */ -pid_t ka_wait(pid_t *kstatus) +pid_t ka_wait(int *kstatus) { pid_t p; @@ -589,7 +589,6 @@ ME1: switch(mode) { citedit(fp,beg); fclose(fp); goto MECR; - break; case 1: fp=fopen(filename,"w"); @@ -903,7 +902,7 @@ void readmsgs(int c, int rdir, int q) /* read contents of a room */ if (c<0) b=(MAXMSGS-1); else b=0; - sprintf(prtfile,"/tmp/CPrt%d",getpid()); + sprintf(prtfile,"/tmp/CPrt%ld",(long)getpid()); num_msgs = 0; strcpy(cmd,"MSGS "); diff --git a/citadel/messages.h b/citadel/messages.h index 52a75849b..2d3bf21b9 100644 --- a/citadel/messages.h +++ b/citadel/messages.h @@ -4,3 +4,4 @@ int entmsg(int is_reply, int c); void readmsgs(int c, int rdir, int q); void edit_system_message(char *which_message); extern int lines_printed; +pid_t ka_wait(int *kstatus); diff --git a/citadel/mime_parser.c b/citadel/mime_parser.c index 67137d84e..715a4d011 100644 --- a/citadel/mime_parser.c +++ b/citadel/mime_parser.c @@ -55,7 +55,7 @@ char *memreadline(char *start, char *buf, int maxlen) { char *ptr; ptr = start; - bzero(buf, maxlen); + memset(buf, 0, maxlen); while(1) { ch = *ptr++; @@ -126,9 +126,9 @@ void the_mime_parser(char *partnum, char nested_partnum[256]; ptr = content_start; - bzero(boundary, sizeof boundary); - bzero(content_type, sizeof content_type); - bzero(encoding, sizeof encoding); + memset(boundary, 0, sizeof boundary); + memset(content_type, 0, sizeof content_type); + memset(encoding, 0, sizeof encoding); /* Learn interesting things from the headers */ strcpy(header, ""); diff --git a/citadel/msgbase.c b/citadel/msgbase.c index fb6c82c59..b8829378f 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -867,8 +867,8 @@ lprintf(9, "6\n"); /* Network mail - send a copy to the network program. */ if ( (strlen(recipient)>0) && (mailtype != M_LOCAL) ) { - sprintf(aaa,"./network/spoolin/netmail.%04x.%04x.%04x", - getpid(), CC->cs_pid, ++seqnum); + sprintf(aaa,"./network/spoolin/netmail.%04lx.%04x.%04x", + (long)getpid(), CC->cs_pid, ++seqnum); copy_file(mtmp,aaa); system("exec nohup ./netproc -i >/dev/null 2>&1 &"); } @@ -1048,7 +1048,7 @@ void cmd_ent0(char *entargs) return; } extract(newusername,entargs,4); - bzero(CC->fake_postname, 32); + memset(CC->fake_postname, 0, 32); strcpy(CC->fake_postname, newusername); cprintf("%d Ok\n",OK); return; diff --git a/citadel/netmailer.c b/citadel/netmailer.c index fc710020b..2cdde2e89 100644 --- a/citadel/netmailer.c +++ b/citadel/netmailer.c @@ -173,7 +173,7 @@ int main(int argc, char **argv) openlog("netmailer", LOG_PID, LOG_USER); get_config(); LoadInternetConfig(); - sprintf(temp, "/tmp/netmailer.%d", getpid()); /* temp file name */ + sprintf(temp,"/tmp/netmailer.%ld",(long)getpid()); /* temp file name */ if ( (argc < 2) || (argc > 3) ) { fprintf(stderr, "netmailer: usage: netmailer recipient@node.dom [mlist]\n"); diff --git a/citadel/netpoll.c b/citadel/netpoll.c index 1874ecb61..ef7fca1be 100644 --- a/citadel/netpoll.c +++ b/citadel/netpoll.c @@ -43,7 +43,7 @@ void receive_spool(void) { long plen; FILE *fp; - sprintf(tempfilename,"/tmp/netpoll.%d",getpid()); + sprintf(tempfilename,"/tmp/netpoll.%ld",(long)getpid()); serv_puts("NDOP"); serv_gets(buf); printf("%s\n",buf); @@ -76,8 +76,8 @@ void receive_spool(void) { serv_puts("CLOS"); serv_gets(buf); printf("%s\n",buf); - sprintf(buf,"mv %s %s/network/spoolin/netpoll.%d", - tempfilename,BBSDIR,getpid()); + sprintf(buf,"mv %s %s/network/spoolin/netpoll.%ld", + tempfilename,BBSDIR,(long)getpid()); system(buf); system("exec nohup ./netproc >/dev/null 2>&1 &"); } diff --git a/citadel/netproc.c b/citadel/netproc.c index f2f07a58e..5ad33c848 100644 --- a/citadel/netproc.c +++ b/citadel/netproc.c @@ -298,7 +298,7 @@ int set_lockfile(void) { } lfp=fopen(LOCKFILE,"w"); - fprintf(lfp,"%d\n",getpid()); + fprintf(lfp,"%ld\n",(long)getpid()); fclose(lfp); return(0); } @@ -608,7 +608,8 @@ void bounce(struct minfo *bminfo) static int bseq = 1; time_t now; - sprintf(bfilename,"./network/spoolin/bounce.%d.%d",getpid(),bseq++); + sprintf(bfilename,"./network/spoolin/bounce.%ld.%d",(long)getpid(), + bseq++); bounce = fopen(bfilename,"wb"); time(&now); @@ -656,8 +657,8 @@ void inprocess(void) { int bloklen; - sprintf(tname,"/tmp/net.t%d",getpid()); /* temp file name */ - sprintf(iname,"/tmp/net.i%d",getpid()); /* temp file name */ + sprintf(tname,"/tmp/net.t%ld",(long)getpid()); /* temp file name */ + sprintf(iname,"/tmp/net.i%ld",(long)getpid()); /* temp file name */ load_filterlist(); @@ -953,7 +954,7 @@ int spool_out(struct msglist *cmlist, FILE *destfp, char *sysname) /* spool list char curr_rm[256]; strcpy(curr_rm, ""); - sprintf(mmtemp, "/tmp/net.m%d", getpid()); + sprintf(mmtemp, "/tmp/net.m%ld", (long)getpid()); /* for each message in the list... */ for (cmptr=cmlist; cmptr!=NULL; cmptr=cmptr->next) { @@ -1038,7 +1039,7 @@ void outprocess(char *sysname) /* send new room messages to sysname */ int outgoing_msgs; long thismsg; - sprintf(tempflnm,"/tmp/%s.%d",NODENAME,getpid()); + sprintf(tempflnm,"/tmp/%s.%ld",NODENAME,(long)getpid()); tempflfp=fopen(tempflnm,"w"); if (tempflfp==NULL) return; diff --git a/citadel/rcit.c b/citadel/rcit.c index 51917d0a4..34a66ce97 100644 --- a/citadel/rcit.c +++ b/citadel/rcit.c @@ -85,8 +85,8 @@ int main(int argc, char **argv) char spool_only = 0; get_config(); - sprintf(flnm,"./network/spoolin/rnews.%d",getpid()); - sprintf(tname,"/tmp/rnews.%d",getpid()); + sprintf(flnm,"./network/spoolin/rnews.%ld",(long)getpid()); + sprintf(tname,"/tmp/rnews.%ld",(long)getpid()); for (a=1; aExpressMessages == NULL) { newlen = strlen(x_msg) + 80; msgptr = mallok(newlen); - bzero(msgptr, newlen); + memset(msgptr, 0, newlen); } else { newlen = (strlen(ccptr->ExpressMessages) + strlen(x_msg) + 80); @@ -476,7 +476,7 @@ void cmd_sexp(char *argbuf) cprintf("%d Transmit message (will deliver to %d users)\n", SEND_LISTING, message_sent); x_big_msgbuf = mallok(256); - bzero(x_big_msgbuf, 256); + memset(x_big_msgbuf, 0, 256); while (client_gets(x_msg), strcmp(x_msg, "000")) { x_big_msgbuf = reallok(x_big_msgbuf, strlen(x_big_msgbuf) + strlen(x_msg) + 4); diff --git a/citadel/serv_info.c b/citadel/serv_info.c index ee2e97022..e64f27282 100644 --- a/citadel/serv_info.c +++ b/citadel/serv_info.c @@ -23,7 +23,7 @@ void CtdlInternalGetServInfo(struct CtdlServInfo *infobuf) { serv_gets(buf); if (buf[0]!='1') return; - bzero(infobuf, sizeof(struct CtdlServInfo)); + memset(infobuf, 0, sizeof(struct CtdlServInfo)); a = 0; while(serv_gets(buf), strcmp(buf,"000")) { switch(a) { diff --git a/citadel/serv_upgrade.c b/citadel/serv_upgrade.c index 4d5a46b30..3f7f5e957 100644 --- a/citadel/serv_upgrade.c +++ b/citadel/serv_upgrade.c @@ -95,7 +95,7 @@ void imp_floors(void) { while(fpgetfield(imfp, key), strcasecmp(key, "endsection")) { if (!strcasecmp(key, "floor")) { - bzero(&fl, sizeof(struct floor)); + memset(&fl, 0, sizeof(struct floor)); while(fpgetfield(imfp, tag), strcasecmp(tag, "endfloor")) { @@ -139,7 +139,7 @@ void imp_rooms(void) { while(fpgetfield(imfp, key), strcasecmp(key, "endsection")) { if (!strcasecmp(key, "room")) { - bzero(&qr, sizeof(struct quickroom)); + memset(&qr, 0, sizeof(struct quickroom)); msglist = NULL; num_msgs = 0; lprintf(9, "Room "); @@ -225,7 +225,7 @@ void import_a_user(void) { char key[256], value[256]; struct usersupp us; - bzero(&us, sizeof(struct usersupp)); + memset(&us, 0, sizeof(struct usersupp)); while(fpgetfield(imfp, key), strcasecmp(key, "enduser")) { if (strcasecmp(key, "mail")) { fpgetfield(imfp, value); diff --git a/citadel/setup.c b/citadel/setup.c index 3af89468c..38b47bbfe 100644 --- a/citadel/setup.c +++ b/citadel/setup.c @@ -549,7 +549,7 @@ void set_str_val(int msgpos, char str[]) { char tempfile[64]; FILE *fp; - sprintf(tempfile, "/tmp/setup.%d", getpid()); + sprintf(tempfile, "/tmp/setup.%ld", (long)getpid()); switch (setup_type) { case UI_TEXT: diff --git a/citadel/user_ops.c b/citadel/user_ops.c index c5cc377e2..c1b58102d 100644 --- a/citadel/user_ops.c +++ b/citadel/user_ops.c @@ -1,11 +1,13 @@ /* $Id$ */ +#ifndef _SGI_SOURCE /* needed to properly enable crypt() stuff on some systems */ #define _XOPEN_SOURCE /* needed for str[n]casecmp() on some systems if the above is defined */ #define _XOPEN_SOURCE_EXTENDED /* needed to enable threads on some systems if the above are defined */ #define _POSIX_C_SOURCE 199506L +#endif #include #include @@ -46,7 +48,7 @@ int getuser(struct usersupp *usbuf, char name[]) { int a; struct cdbdata *cdbus; - bzero(usbuf, sizeof(struct usersupp)); + memset(usbuf, 0, sizeof(struct usersupp)); for (a=0; a<=strlen(name); ++a) { lowercase_name[a] = tolower(name[a]); } @@ -175,7 +177,7 @@ void CtdlGetRelationship(struct visit *vbuf, rel_user->usernum); /* Clear out the buffer */ - bzero(vbuf, sizeof(struct visit)); + memset(vbuf, 0, sizeof(struct visit)); cdbvisit = cdb_fetch(CDB_VISIT, IndexBuf, IndexLen); if (cdbvisit != NULL) { @@ -226,7 +228,7 @@ int getuserbynumber(struct usersupp *usbuf, long int number) cdb_rewind(CDB_USERSUPP); while(cdbus = cdb_next_item(CDB_USERSUPP), cdbus != NULL) { - bzero(usbuf, sizeof(struct usersupp)); + memset(usbuf, 0, sizeof(struct usersupp)); memcpy(usbuf, cdbus->ptr, ( (cdbus->len > sizeof(struct usersupp)) ? sizeof(struct usersupp) : cdbus->len) ); @@ -812,7 +814,7 @@ void cmd_gnur(void) { */ cdb_rewind(CDB_USERSUPP); while (cdbus = cdb_next_item(CDB_USERSUPP), cdbus != NULL) { - bzero(&usbuf, sizeof(struct usersupp)); + memset(&usbuf, 0, sizeof(struct usersupp)); memcpy(&usbuf, cdbus->ptr, ( (cdbus->len > sizeof(struct usersupp)) ? sizeof(struct usersupp) : cdbus->len) ); @@ -956,7 +958,7 @@ void ForEachUser(void (*CallBack)(struct usersupp *EachUser)) { cdb_rewind(CDB_USERSUPP); while(cdbus = cdb_next_item(CDB_USERSUPP), cdbus != NULL) { - bzero(&usbuf, sizeof(struct usersupp)); + memset(&usbuf, 0, sizeof(struct usersupp)); memcpy(&usbuf, cdbus->ptr, ( (cdbus->len > sizeof(struct usersupp)) ? sizeof(struct usersupp) : cdbus->len) ); -- 2.39.2