From 00ffb02fc60e629cb0f4c7fad59a5564adb5ffb4 Mon Sep 17 00:00:00 2001 From: Nathan Bryant Date: Mon, 28 Sep 1998 23:57:37 +0000 Subject: [PATCH] * configure.in, acconfig.h: new files; partially functional GNU autoconf configure script. Run autoheader; autoconf; ./configure --prefix=`pwd` to test. * Makefile.tmpl: new file; this is what Makefile.in used to be. Used by Configure. * Makefile.in: modified to work with autoconf-style configure script * Configure: modified to use Makefile.tmpl and generate autoconf-style macros. Removed procfs detection. Pass -O2 to gcc, -O to other compilers. Removed mknod/mkfifo detection; code should use mkfifo(3). * citmail.c, msgform.c, netproc.c, routines.c, support.c, userlist.c, whobbs.c: use HAVE_STRERROR macro rather than NO_STRERROR * commands.c: use HAVE_TERMIOS_H macro rather than POSIX_TERMIO * netproc.c: remove procfs stuff. simply attempt to kill the target process with signal zero instead; this checks whether the process exists. * setup.c, useradmin.c: use HAVE_CURSES_H macro --- citadel/.cvsignore | 5 + citadel/ChangeLog | 18 +++ citadel/Makefile.in | 70 ++++++------ citadel/Makefile.tmpl | 255 ++++++++++++++++++++++++++++++++++++++++++ citadel/acconfig.h | 8 ++ citadel/citmail.c | 2 +- citadel/commands.c | 4 +- citadel/configure.in | 56 ++++++++++ citadel/msgform.c | 2 +- citadel/netproc.c | 25 +---- citadel/routines.c | 2 +- citadel/setup.c | 22 ++-- citadel/support.c | 6 +- citadel/userlist.c | 2 +- citadel/whobbs.c | 2 +- 15 files changed, 406 insertions(+), 73 deletions(-) create mode 100644 citadel/Makefile.tmpl create mode 100644 citadel/acconfig.h create mode 100644 citadel/configure.in diff --git a/citadel/.cvsignore b/citadel/.cvsignore index b2b03b4db..327623c7d 100644 --- a/citadel/.cvsignore +++ b/citadel/.cvsignore @@ -27,3 +27,8 @@ citadel.log data .depend import +config.status +configure +config.log +config.cache +sysdep.h.in diff --git a/citadel/ChangeLog b/citadel/ChangeLog index a301744c2..56efec019 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,3 +1,21 @@ +1998-09-28 Nathan Bryant + * configure.in, acconfig.h: new files; partially functional GNU + autoconf configure script. Run autoheader; autoconf; ./configure + --prefix=`pwd` to test. + * Makefile.tmpl: new file; this is what Makefile.in used to be. Used by + Configure. + * Makefile.in: modified to work with autoconf-style configure script + * Configure: modified to use Makefile.tmpl and generate autoconf-style + macros. Removed procfs detection. Pass -O2 to gcc, -O to other + compilers. Removed mknod/mkfifo detection; code should use mkfifo(3). + * citmail.c, msgform.c, netproc.c, routines.c, support.c, userlist.c, + whobbs.c: use HAVE_STRERROR macro rather than NO_STRERROR + * commands.c: use HAVE_TERMIOS_H macro rather than POSIX_TERMIO + * netproc.c: remove procfs stuff. simply attempt to kill the target + process with signal zero instead; this checks whether the process + exists. + * setup.c, useradmin.c: use HAVE_CURSES_H macro + Sun Sep 27 23:41:29 EDT 1998 Art Cancro * BOTH the old and new generation systems are being written to at this point. Code that reads stuff is still using the old system. diff --git a/citadel/Makefile.in b/citadel/Makefile.in index ee3606973..4290bfa97 100644 --- a/citadel/Makefile.in +++ b/citadel/Makefile.in @@ -10,12 +10,18 @@ # ######################################################################## +all: client server utils serv_modules + CLIENT_TARGETS=citadel whobbs SERVER_TARGETS=citserver setup -SERV_MODULES=$(MODDIR)/serv_chat.so $(MODDIR)/serv_test.so +SERV_MODULES=modules/serv_chat.so modules/serv_test.so UTIL_TARGETS=aidepost netmailer netproc netsetup msgform \ readlog rcit stats citmail netpoll mailinglist userlist PROXY_TARGETS=proxy +CFLAGS=@CFLAGS@ @DEFS@ +CC=@CC@ +SERVER_LFLAGS=@LIBS@ +CURSES=@CURSES@ client: $(CLIENT_TARGETS) @@ -43,28 +49,28 @@ ipc_c_tcp.o: ipc_c_tcp.c $(CC) $(CFLAGS) -c ipc_c_tcp.c citadel.o: citadel.c - $(CC) -O $(CFLAGS) -c citadel.c + $(CC) $(CFLAGS) -c citadel.c rooms.o: rooms.c - $(CC) -O $(CFLAGS) -c rooms.c + $(CC) $(CFLAGS) -c rooms.c messages.o: messages.c - $(CC) -O $(CFLAGS) -c messages.c + $(CC) $(CFLAGS) -c messages.c commands.o: commands.c - $(CC) -O $(CFLAGS) -c commands.c + $(CC) $(CFLAGS) -c commands.c routines.o: routines.c - $(CC) -O $(CFLAGS) -c routines.c + $(CC) $(CFLAGS) -c routines.c routines2.o: routines2.c - $(CC) -O $(CFLAGS) -c routines2.c + $(CC) $(CFLAGS) -c routines2.c client_chat.o: client_chat.c - $(CC) -O $(CFLAGS) -c client_chat.c + $(CC) $(CFLAGS) -c client_chat.c serv_info.o: serv_info.c - $(CC) -O $(CFLAGS) -c serv_info.c + $(CC) $(CFLAGS) -c serv_info.c # @@ -105,14 +111,14 @@ msgbase.o: msgbase.c locate_host.o: locate_host.c $(CC) $(CFLAGS) -D_REENTRANT -c locate_host.c -$(MODDIR)/serv_chat.so: serv_chat.o - $(CC) -shared -o $(MODDIR)/serv_chat.so serv_chat.o +modules/serv_chat.so: serv_chat.o + $(CC) -shared -o modules/serv_chat.so serv_chat.o serv_chat.o: serv_chat.c $(CC) $(CFLAGS) -D_REENTRANT -fPIC -c serv_chat.c -$(MODDIR)/serv_test.so: serv_test.o - $(CC) -shared -o $(MODDIR)/serv_test.so serv_test.o +modules/serv_test.so: serv_test.o + $(CC) -shared -o modules/serv_test.so serv_test.o serv_test.o: serv_test.c $(CC) $(CFLAGS) -D_REENTRANT -fPIC -c serv_test.c @@ -130,16 +136,16 @@ logging.o: logging.c $(CC) $(CFLAGS) -D_REENTRANT -c logging.c config.o: config.c - $(CC) -O $(CFLAGS) -D_REENTRANT -c config.c + $(CC) $(CFLAGS) -D_REENTRANT -c config.c sysdep.o: sysdep.c - $(CC) -O $(CFLAGS) -D_REENTRANT -c sysdep.c + $(CC) $(CFLAGS) -D_REENTRANT -c sysdep.c aidepost: aidepost.o config.o $(CC) $(CFLAGS) aidepost.o config.o $(LFLAGS) -o aidepost aidepost.o: aidepost.c - $(CC) -O $(CFLAGS) -c aidepost.c + $(CC) $(CFLAGS) -c aidepost.c # # 'netmailer' needs to run setuid because it generates headers for Internet @@ -151,17 +157,17 @@ netmailer: netmailer.o internetmail.o config.o chmod 4755 netmailer netmailer.o: netmailer.c - $(CC) -O $(CFLAGS) -c netmailer.c + $(CC) $(CFLAGS) -c netmailer.c internetmail.o: internetmail.c - $(CC) -O $(CFLAGS) -c internetmail.c + $(CC) $(CFLAGS) -c internetmail.c netproc: netproc.o config.o ipc_c_tcp.o - $(CC) -O $(CFLAGS) netproc.o config.o ipc_c_tcp.o \ + $(CC) $(CFLAGS) netproc.o config.o ipc_c_tcp.o \ $(LFLAGS) -o netproc netproc.o: netproc.c - $(CC) -O $(CFLAGS) -c netproc.c + $(CC) $(CFLAGS) -c netproc.c citmail: citmail.o config.o internetmail.o # @@ -173,56 +179,56 @@ citmail: citmail.o config.o internetmail.o chmod 4755 citmail citmail.o: citmail.c - $(CC) -O $(CFLAGS) -c citmail.c + $(CC) $(CFLAGS) -c citmail.c mailinglist: mailinglist.o config.o internetmail.o $(CC) $(CFLAGS) mailinglist.o config.o internetmail.o \ $(LFLAGS) -o mailinglist mailinglist.o: mailinglist.c - $(CC) -O $(CFLAGS) -c mailinglist.c + $(CC) $(CFLAGS) -c mailinglist.c setup: setup.o $(CC) $(CFLAGS) setup.o $(CURSES) $(LFLAGS) -o setup setup.o: setup.c - $(CC) -O $(CFLAGS) -c setup.c + $(CC) $(CFLAGS) -c setup.c netsetup: netsetup.o config.o $(CC) $(CFLAGS) netsetup.o config.o $(LFLAGS) -o netsetup netsetup.o: netsetup.c - $(CC) -O $(CFLAGS) -c netsetup.c + $(CC) $(CFLAGS) -c netsetup.c proxy: proxy.o ipc_c_tcp.o $(CC) $(CFLAGS) proxy.o ipc_c_tcp.o $(LFLAGS) -o proxy proxy.o: proxy.c - $(CC) -O $(CFLAGS) -c proxy.c + $(CC) $(CFLAGS) -c proxy.c whobbs: whobbs.o ipc_c_tcp.o $(CC) $(CFLAGS) whobbs.o ipc_c_tcp.o $(LFLAGS) -o whobbs whobbs.o: whobbs.c - $(CC) -O $(CFLAGS) -c whobbs.c + $(CC) $(CFLAGS) -c whobbs.c userlist: userlist.o ipc_c_tcp.o $(CC) $(CFLAGS) userlist.o ipc_c_tcp.o $(LFLAGS) -o userlist userlist.o: userlist.c - $(CC) -O $(CFLAGS) -c userlist.c + $(CC) $(CFLAGS) -c userlist.c msgform: msgform.o $(CC) $(CFLAGS) msgform.o $(LFLAGS) -o msgform msgform.o: msgform.c - $(CC) -O $(CFLAGS) -c msgform.c + $(CC) $(CFLAGS) -c msgform.c readlog: readlog.o config.o $(CC) $(CFLAGS) readlog.o config.o $(LFLAGS) -o readlog readlog.o: readlog.c - $(CC) -O $(CFLAGS) -c readlog.c + $(CC) $(CFLAGS) -c readlog.c rcit: rcit.o config.o $(CC) $(CFLAGS) rcit.o config.o $(LFLAGS) -o rcit @@ -233,13 +239,13 @@ rcit: rcit.o config.o # rcit.o: rcit.c - $(CC) -O $(CFLAGS) -c rcit.c + $(CC) $(CFLAGS) -c rcit.c stats: stats.o config.o $(CC) $(CFLAGS) stats.o config.o $(LFLAGS) -o stats stats.o: stats.c - $(CC) -O $(CFLAGS) -c stats.c + $(CC) $(CFLAGS) -c stats.c clean: find . -name \*.[o] -print -exec rm -f {} \; @@ -252,4 +258,4 @@ realclean: cleaner rm -f Makefile sysdep.h .depend: $(wildcard *.c) $(wildcard *.h) - gcc -MM *.c > .depend + $(CC) -MM *.c > .depend diff --git a/citadel/Makefile.tmpl b/citadel/Makefile.tmpl new file mode 100644 index 000000000..ac2d00ca1 --- /dev/null +++ b/citadel/Makefile.tmpl @@ -0,0 +1,255 @@ +# Makefile for Citadel/UX +# +# NOTE: normally you should not have to modify the Makefile. All +# system-dependent configuration is in the "Configure" script, which +# uses "Makefile.tmpl" to generate a "Makefile". In the rare instance +# that you have to modify something here, please take note: +# 1. Edit Makefile.tmpl, -not- Makefile. +# 2. Send e-mail to ajc@uncnsrd.mt-kisco.ny.us and let me know what you +# did, so any necessary changes can be put into the next release. +# +######################################################################## + +CLIENT_TARGETS=citadel whobbs +SERVER_TARGETS=citserver setup +SERV_MODULES=$(MODDIR)/serv_chat.so $(MODDIR)/serv_test.so +UTIL_TARGETS=aidepost netmailer netproc netsetup msgform \ + readlog rcit stats citmail netpoll mailinglist userlist +PROXY_TARGETS=proxy + +client: $(CLIENT_TARGETS) + +server: $(SERVER_TARGETS) + +utils: $(UTIL_TARGETS) + +serv_modules: $(SERV_MODULES) + +# +# + +citadel: ipc_c_tcp.o citadel.o rooms.o routines.o routines2.o messages.o \ + commands.o client_chat.o serv_info.o + $(CC) $(CFLAGS) ipc_c_tcp.o citadel.o rooms.o routines.o routines2.o \ + messages.o commands.o client_chat.o serv_info.o $(LFLAGS) -o citadel + +netpoll: netpoll.o config.o ipc_c_tcp.o + $(CC) $(CFLAGS) netpoll.o config.o ipc_c_tcp.o $(LFLAGS) -o netpoll + +netpoll.o: netpoll.c + $(CC) $(CFLAGS) -c netpoll.c + +ipc_c_tcp.o: ipc_c_tcp.c + $(CC) $(CFLAGS) -c ipc_c_tcp.c + +citadel.o: citadel.c + $(CC) $(CFLAGS) -c citadel.c + +rooms.o: rooms.c + $(CC) $(CFLAGS) -c rooms.c + +messages.o: messages.c + $(CC) $(CFLAGS) -c messages.c + +commands.o: commands.c + $(CC) $(CFLAGS) -c commands.c + +routines.o: routines.c + $(CC) $(CFLAGS) -c routines.c + +routines2.o: routines2.c + $(CC) $(CFLAGS) -c routines2.c + +client_chat.o: client_chat.c + $(CC) $(CFLAGS) -c client_chat.c + +serv_info.o: serv_info.c + $(CC) $(CFLAGS) -c serv_info.c + + +# +# + +citserver: citserver.o user_ops.o support.o room_ops.o file_ops.o \ + msgbase.o config.o sysdep.o locate_host.o \ + housekeeping.o database.o control.o logging.o \ + dynloader.o + $(CC) $(CFLAGS) -rdynamic \ + citserver.o user_ops.o room_ops.o file_ops.o support.o \ + msgbase.o config.o sysdep.o locate_host.o \ + housekeeping.o database.o control.o logging.o \ + dynloader.o \ + $(LFLAGS) $(SERVER_LFLAGS) -o citserver + +citserver.o: citserver.c + $(CC) $(CFLAGS) -D_REENTRANT -c citserver.c + +user_ops.o: user_ops.c + $(CC) $(CFLAGS) -D_REENTRANT -c user_ops.c + +room_ops.o: room_ops.c + $(CC) $(CFLAGS) -D_REENTRANT -c room_ops.c + +dynloader.o: dynloader.c + $(CC) $(CFLAGS) -D_REENTRANT -c dynloader.c + +file_ops.o: file_ops.c + $(CC) $(CFLAGS) -D_REENTRANT -c file_ops.c + +support.o: support.c + $(CC) $(CFLAGS) -D_REENTRANT -c support.c + +msgbase.o: msgbase.c + $(CC) $(CFLAGS) -D_REENTRANT -c msgbase.c + +locate_host.o: locate_host.c + $(CC) $(CFLAGS) -D_REENTRANT -c locate_host.c + +$(MODDIR)/serv_chat.so: serv_chat.o + $(CC) -shared -o $(MODDIR)/serv_chat.so serv_chat.o + +serv_chat.o: serv_chat.c + $(CC) $(CFLAGS) -D_REENTRANT -fPIC -c serv_chat.c + +$(MODDIR)/serv_test.so: serv_test.o + $(CC) -shared -o $(MODDIR)/serv_test.so serv_test.o + +serv_test.o: serv_test.c + $(CC) $(CFLAGS) -D_REENTRANT -fPIC -c serv_test.c + +housekeeping.o: housekeeping.c + $(CC) $(CFLAGS) -D_REENTRANT -c housekeeping.c + +database.o: database.c + $(CC) $(CFLAGS) -D_REENTRANT -c database.c + +control.o: control.c + $(CC) $(CFLAGS) -D_REENTRANT -c control.c + +logging.o: logging.c + $(CC) $(CFLAGS) -D_REENTRANT -c logging.c + +config.o: config.c + $(CC) $(CFLAGS) -D_REENTRANT -c config.c + +sysdep.o: sysdep.c + $(CC) $(CFLAGS) -D_REENTRANT -c sysdep.c + +aidepost: aidepost.o config.o + $(CC) $(CFLAGS) aidepost.o config.o $(LFLAGS) -o aidepost + +aidepost.o: aidepost.c + $(CC) $(CFLAGS) -c aidepost.c + +# +# 'netmailer' needs to run setuid because it generates headers for Internet +# mail. If it is not run setuid, all outgoing mail may always show as coming +# from your BBSUID rather than the actual sending user. +# +netmailer: netmailer.o internetmail.o config.o + $(CC) $(CFLAGS) netmailer.o config.o internetmail.o $(LFLAGS) -o netmailer + chmod 4755 netmailer + +netmailer.o: netmailer.c + $(CC) $(CFLAGS) -c netmailer.c + +internetmail.o: internetmail.c + $(CC) $(CFLAGS) -c internetmail.c + +netproc: netproc.o config.o ipc_c_tcp.o + $(CC) $(CFLAGS) netproc.o config.o ipc_c_tcp.o \ + $(LFLAGS) -o netproc + +netproc.o: netproc.c + $(CC) $(CFLAGS) -c netproc.c + +citmail: citmail.o config.o internetmail.o + # + # ###### IMPORTANT ###### + # To allow Citadel users to receive Internet mail, you must + # set this program to be your local mail delivery agent. + # + $(CC) $(CFLAGS) citmail.o config.o internetmail.o $(LFLAGS) -o citmail + chmod 4755 citmail + +citmail.o: citmail.c + $(CC) $(CFLAGS) -c citmail.c + +mailinglist: mailinglist.o config.o internetmail.o + $(CC) $(CFLAGS) mailinglist.o config.o internetmail.o \ + $(LFLAGS) -o mailinglist + +mailinglist.o: mailinglist.c + $(CC) $(CFLAGS) -c mailinglist.c + +setup: setup.o + $(CC) $(CFLAGS) setup.o $(CURSES) $(LFLAGS) -o setup + +setup.o: setup.c + $(CC) $(CFLAGS) $(CURSES_INC) -c setup.c + +netsetup: netsetup.o config.o + $(CC) $(CFLAGS) netsetup.o config.o $(LFLAGS) -o netsetup + +netsetup.o: netsetup.c + $(CC) $(CFLAGS) -c netsetup.c + +proxy: proxy.o ipc_c_tcp.o + $(CC) $(CFLAGS) proxy.o ipc_c_tcp.o $(LFLAGS) -o proxy + +proxy.o: proxy.c + $(CC) $(CFLAGS) -c proxy.c + +whobbs: whobbs.o ipc_c_tcp.o + $(CC) $(CFLAGS) whobbs.o ipc_c_tcp.o $(LFLAGS) -o whobbs + +whobbs.o: whobbs.c + $(CC) $(CFLAGS) -c whobbs.c + +userlist: userlist.o ipc_c_tcp.o + $(CC) $(CFLAGS) userlist.o ipc_c_tcp.o $(LFLAGS) -o userlist + +userlist.o: userlist.c + $(CC) $(CFLAGS) -c userlist.c + +msgform: msgform.o + $(CC) $(CFLAGS) msgform.o $(LFLAGS) -o msgform + +msgform.o: msgform.c + $(CC) $(CFLAGS) -c msgform.c + +readlog: readlog.o config.o + $(CC) $(CFLAGS) readlog.o config.o $(LFLAGS) -o readlog + +readlog.o: readlog.c + $(CC) $(CFLAGS) -c readlog.c + +rcit: rcit.o config.o + $(CC) $(CFLAGS) rcit.o config.o $(LFLAGS) -o rcit + # + # NOTE: TO RECEIVE CITADEL TRAFFIC VIA THE RCIT PROGRAM (ESPECIALLY + # IF YOU ARE GATEWAYING TO USENET) YOU MUST LINK RNEWS TO RCIT: + #ln -s rcit /usr/bin/rnews + # + +rcit.o: rcit.c + $(CC) $(CFLAGS) -c rcit.c + +stats: stats.o config.o + $(CC) $(CFLAGS) stats.o config.o $(LFLAGS) -o stats + +stats.o: stats.c + $(CC) $(CFLAGS) -c stats.c + +clean: + find . -name \*.[o] -print -exec rm -f {} \; + +cleaner: clean + rm -f $(CLIENT_TARGETS) $(SERVER_TARGETS) $(UTIL_TARGETS) \ + $(SERV_MODULES) $(PROXY_TARGETS) + +realclean: cleaner + rm -f Makefile sysdep.h + +.depend: $(wildcard *.c) $(wildcard *.h) + gcc -MM *.c > .depend diff --git a/citadel/acconfig.h b/citadel/acconfig.h new file mode 100644 index 000000000..e96390d31 --- /dev/null +++ b/citadel/acconfig.h @@ -0,0 +1,8 @@ +/* define this to the bbs home directory */ +#undef BBSDIR + +/* define this to enable the autologin feature */ +#undef ENABLE_AUTOLOGIN + +/* define this to enable ANSI color */ +#undef ANSI_COLOR diff --git a/citadel/citmail.c b/citadel/citmail.c index 1dbc5da36..ac2d5c8cc 100644 --- a/citadel/citmail.c +++ b/citadel/citmail.c @@ -123,7 +123,7 @@ long conv_date(char *sdbuf) } -#ifdef NO_STRERROR +#ifndef HAVE_STRERROR /* * replacement strerror() for systems that don't have it */ diff --git a/citadel/commands.c b/citadel/commands.c index 984355c2d..36b63a8f8 100644 --- a/citadel/commands.c +++ b/citadel/commands.c @@ -17,7 +17,7 @@ #include #include -#ifdef POSIX_TERMIO +#ifdef HAVE_TERMIOS_H #include #else #include @@ -600,7 +600,7 @@ int getcmd(char *argbuf) * 2 - save current settings for later restoral * 3 - restore saved settings */ -#ifdef POSIX_TERMIO +#ifdef HAVE_TERMIOS_H void sttybbs(int cmd) /* SysV version of sttybbs() */ { struct termios live; diff --git a/citadel/configure.in b/citadel/configure.in new file mode 100644 index 000000000..c26e42581 --- /dev/null +++ b/citadel/configure.in @@ -0,0 +1,56 @@ +dnl Process this file with autoconf to produce a configure script. +AC_PREREQ(2.12) +AC_INIT(citserver.c) +AC_PREFIX_DEFAULT(/usr/local/citadel) +if test "$prefix" = NONE; then + AC_DEFINE_UNQUOTED(BBSDIR, "$ac_default_prefix") +else + AC_DEFINE_UNQUOTED(BBSDIR, "$prefix") +fi + +AC_ARG_ENABLE(autologin, [ --disable-autologin disable autologin (default is enabled)],[if test "$enableval" = yes; then + AC_DEFINE(ENABLE_AUTOLOGIN) +fi],AC_DEFINE(ENABLE_AUTOLOGIN)) + +AC_ARG_ENABLE(ansi-color, [ --enable-ansi-color enable ANSI color (default is disabled)],[if test "$enableval" = yes; then + AC_DEFINE(ANSI_COLOR) +fi]) + +dnl Checks for programs. +AC_PROG_CC +if test "$GCC" = yes; then + CFLAGS="$CFLAGS -Wall -Wstrict-prototypes" +fi +AC_PROG_RANLIB + +dnl Checks for libraries. +AC_CHECK_LIB(crypt, crypt) +AC_CHECK_LIB(dl, dlopen) +AC_CHECK_LIB(gdbm, gdbm_open) +AC_CHECK_LIB(curses, initscr, CURSES=-lcurses) +AC_CHECK_LIB(pthread, pthread_create) +AC_CHECK_LIB(pthreads, pthread_create) + +dnl Checks for header files. +AC_HEADER_DIRENT +AC_HEADER_STDC +AC_HEADER_SYS_WAIT +AC_CHECK_HEADERS(curses.h fcntl.h limits.h termios.h strings.h sys/ioctl.h sys/select.h sys/time.h syslog.h unistd.h) + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_HEADER_TIME +AC_STRUCT_TM + +dnl Checks for library functions. +AC_FUNC_GETPGRP +AC_PROG_GCC_TRADITIONAL +AC_TYPE_SIGNAL +AC_FUNC_VPRINTF +AC_CHECK_FUNCS(mkdir mktime rmdir select socket strerror) + +AC_SUBST(CURSES) +AC_CONFIG_HEADER(sysdep.h) +AC_OUTPUT(Makefile) diff --git a/citadel/msgform.c b/citadel/msgform.c index 1fbe5d42f..cc3a3b498 100644 --- a/citadel/msgform.c +++ b/citadel/msgform.c @@ -28,7 +28,7 @@ int fpgetfield(FILE *fp, char *string); int fmout(int width, FILE *fp); -#ifdef NO_STRERROR +#ifndef HAVE_STRERROR /* * replacement strerror() for systems that don't have it */ diff --git a/citadel/netproc.c b/citadel/netproc.c index f999e1c95..52dafca1c 100644 --- a/citadel/netproc.c +++ b/citadel/netproc.c @@ -112,7 +112,7 @@ extern char bbs_home_directory[]; extern int home_specified; -#ifdef NO_STRERROR +#ifndef HAVE_STRERROR /* * replacement strerror() for systems that don't have it */ @@ -337,29 +337,14 @@ struct syslist *get_sys_ptr(char *sysname) */ int set_lockfile(void) { FILE *lfp; - int ok = 1; int onppid; - char buf[64]; - if (access(LOCKFILE,0)==0) { - - /* - * if the /proc filesystem is available, we can further check to - * make sure that the process that wrote the lock file is actually - * running, and didn't simply terminate and not clean up after itself - */ -#ifdef HAVE_PROC_FS - lfp = fopen(LOCKFILE,"r"); - fscanf(lfp,"%d",&onppid); - fclose(lfp); - sprintf(buf,"/proc/%d/cmdline",onppid); - if (access(buf,0)==0) ok = 0; -#else - ok = 0; -#endif + if ((lfp = fopen(LOCKFILE,"r")) != NULL) { + fscanf(lfp,"%d",&onppid); + fclose(lfp); + if (!kill(onppid, 0) || errno == EPERM) return 1; } - if (ok == 0) return(1); lfp=fopen(LOCKFILE,"w"); fprintf(lfp,"%d\n",getpid()); fclose(lfp); diff --git a/citadel/routines.c b/citadel/routines.c index e8332de01..8573ff286 100644 --- a/citadel/routines.c +++ b/citadel/routines.c @@ -393,7 +393,7 @@ void strproc(char *string) } -#ifdef NO_STRERROR +#ifndef HAVE_STRERROR /* * replacement strerror() for systems that don't have it */ diff --git a/citadel/setup.c b/citadel/setup.c index 66cb93227..74a9db293 100644 --- a/citadel/setup.c +++ b/citadel/setup.c @@ -21,11 +21,11 @@ #include "sysdep.h" #include "config.h" -#ifdef CURSES_INC +#ifdef HAVE_CURSES_H # ifdef OK # undef OK # endif -#include CURSES_INC +#include #endif #define MAXSETUP 19 @@ -228,7 +228,7 @@ struct config config; int direction; void cleanup(int exitcode) { -#ifdef CURSES_INC +#ifdef HAVE_CURSES_H if (setup_type == UI_CURSES) { clear(); refresh(); @@ -253,7 +253,7 @@ void cleanup(int exitcode) { } -#ifdef CURSES_INC +#ifdef HAVE_CURSES_H 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 */ @@ -315,7 +315,7 @@ void title(char *text) void hit_any_key(void) { char junk[5]; -#ifdef CURSES_INC +#ifdef HAVE_CURSES_H if (setup_type == UI_CURSES) { mvprintw(20, 0, "Press any key to continue... "); refresh(); @@ -348,7 +348,7 @@ int yesno(char *question) sprintf(buf, "dialog --yesno \"%s\" 7 80", question); answer = ( (system(buf)==0) ? 1 : 0); break; -#ifdef CURSES_INC +#ifdef HAVE_CURSES_H case UI_CURSES: do { clear(); @@ -416,7 +416,7 @@ void important_message(char *title, char *msgtext) { title, msgtext); system(buf); break; -#ifdef CURSES_INC +#ifdef HAVE_CURSES_H case UI_CURSES: clear(); move(1, 20); @@ -477,7 +477,7 @@ void progress(char *text, long int curr, long int cmax) } break; -#ifdef CURSES_INC +#ifdef HAVE_CURSES_H case UI_CURSES: if (curr==0) { clear(); @@ -679,7 +679,7 @@ void set_str_val(int msgpos, char str[]) { str[strlen(str)-1]=0; } break; -#ifdef CURSES_INC +#ifdef HAVE_CURSES_H case UI_CURSES: clear(); move(1, ((80-strlen(setup_titles[msgpos]))/2) ); @@ -837,7 +837,7 @@ void write_config_to_disk(void) { */ int discover_ui(void) { -#ifdef CURSES_INC +#ifdef HAVE_CURSES_H return UI_CURSES; #endif @@ -883,7 +883,7 @@ void main(int argc, char *argv[]) { setup_type = discover_ui(); } -#ifdef CURSES_INC +#ifdef HAVE_CURSES_H if (setup_type == UI_CURSES) { initscr(); raw(); diff --git a/citadel/support.c b/citadel/support.c index 62a2f4497..ea4c39edb 100644 --- a/citadel/support.c +++ b/citadel/support.c @@ -192,12 +192,12 @@ void mesg_locate(char *targ, char *searchfor, int numdirs, char **dirs) } -#ifdef NO_STRERROR +#ifndef HAVE_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); diff --git a/citadel/userlist.c b/citadel/userlist.c index d95bc8e63..fd88681bf 100644 --- a/citadel/userlist.c +++ b/citadel/userlist.c @@ -131,7 +131,7 @@ void main(int argc, char **argv) } -#ifdef NO_STRERROR +#ifndef HAVE_STRERROR /* * replacement strerror() for systems that don't have it */ diff --git a/citadel/whobbs.c b/citadel/whobbs.c index 189773f3e..9dfa181a9 100644 --- a/citadel/whobbs.c +++ b/citadel/whobbs.c @@ -123,7 +123,7 @@ void main(int argc, char **argv) } -#ifdef NO_STRERROR +#ifndef HAVE_STRERROR /* * replacement strerror() for systems that don't have it */ -- 2.39.2