+1999-01-29 Nathan Bryant <bryant@cs.usm.maine.edu>
+ * 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 <ajc@uncnsrd.mt-kisco.ny.us>
* Fixed bug in save_message() which crashed the server on mail to sysop
* Rewrote pop_march() to be smarter about <G>oto heuristics
$(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 $@!' > $@
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 */
# $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
{
if ((newhostname) && (newhostname[0]))
{
- bzero(CC->fake_hostname, 25);
+ memset(CC->fake_hostname, 0, 25);
strncpy(CC->fake_hostname, newhostname, 24);
}
else
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);
}
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);
}
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);
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
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
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)
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
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);
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);
get_config();
LoadInternetConfig();
- sprintf(tempfile, "/tmp/mlist.%d", getpid() );
+ sprintf(tempfile, "/tmp/mlist.%ld", (long)getpid() );
while(1) {
/*
* 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;
citedit(fp,beg);
fclose(fp);
goto MECR;
- break;
case 1:
fp=fopen(filename,"w");
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 ");
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);
char *ptr;
ptr = start;
- bzero(buf, maxlen);
+ memset(buf, 0, maxlen);
while(1) {
ch = *ptr++;
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, "");
/* 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 &");
}
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;
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");
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);
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 &");
}
}
lfp=fopen(LOCKFILE,"w");
- fprintf(lfp,"%d\n",getpid());
+ fprintf(lfp,"%ld\n",(long)getpid());
fclose(lfp);
return(0);
}
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);
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();
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) {
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;
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; a<argc; ++a) {
if (!strcmp(argv[a],"-c")) binary_input = 1;
#include "routines.h"
#include "commands.h"
#include "tools.h"
+#include "messages.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);
int haschar(char *st, int ch);
int a;
/* Clear out the config buffers */
- bzero(&sc[0][0], sizeof(sc));
+ memset(&sc[0][0], 0, sizeof(sc));
/* Fetch the current config */
serv_puts("CONF get");
}
lfp=fopen(LOCKFILE,"w");
- fprintf(lfp,"%d\n",getpid());
+ fprintf(lfp,"%ld\n",(long)getpid());
fclose(lfp);
return(0);
}
signal(SIGHUP,cleanup);
signal(SIGTERM,cleanup);
- fprintf(stderr, "sendcommand: started. pid=%d\n",getpid());
+ fprintf(stderr, "sendcommand: started. pid=%ld\n",(long)getpid());
fflush(stderr);
np_attach_to_server();
fflush(stderr);
if (ccptr->ExpressMessages == 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);
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);
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) {
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")) {
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 ");
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);
char tempfile[64];
FILE *fp;
- sprintf(tempfile, "/tmp/setup.%d", getpid());
+ sprintf(tempfile, "/tmp/setup.%ld", (long)getpid());
switch (setup_type) {
case UI_TEXT:
/* $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 <stdlib.h>
#include <unistd.h>
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]);
}
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) {
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) );
*/
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) );
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) );