From 0f1554610c1719ad2da1da874714b5327e38e890 Mon Sep 17 00:00:00 2001 From: Michael Hampton Date: Wed, 4 Jun 2003 21:39:28 +0000 Subject: [PATCH] * Numerous fixups needed for Windows port: * cmd_mesg() rewritten to use the stat() syscall to find files * really_do_keepalive() does not try to send if we are not connected * Misc. fixups; added Windows readme file --- citadel/ChangeLog | 7 ++++- citadel/Makefile.in | 21 ++++++------- citadel/citadel.c | 2 ++ citadel/citadel.nsi | 35 +++++++++++++++------- citadel/citadel_ipc.c | 11 +++++++ citadel/commands.c | 6 ++++ citadel/configure.ac | 4 +++ citadel/docs/windows-readme.txt | 52 +++++++++++++++++++++++++++++++++ citadel/screen.c | 2 +- citadel/sendcommand.c | 2 ++ citadel/setup.c | 6 ++++ citadel/support.c | 24 ++++++--------- 12 files changed, 134 insertions(+), 38 deletions(-) create mode 100644 citadel/docs/windows-readme.txt diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 85e096183..690884f78 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,10 @@ $Log$ + Revision 606.9 2003/06/04 21:39:27 error + * Numerous fixups needed for Windows port: + * cmd_mesg() rewritten to use the stat() syscall to find files + * really_do_keepalive() does not try to send if we are not connected + * Misc. fixups; added Windows readme file + Revision 606.8 2003/06/04 21:30:39 error * messages.c: When file attachment has no name, use message subject as name @@ -4748,4 +4754,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import - diff --git a/citadel/Makefile.in b/citadel/Makefile.in index 513a28c25..b04a12cba 100644 --- a/citadel/Makefile.in +++ b/citadel/Makefile.in @@ -51,23 +51,24 @@ UTIL_TARGETS=aidepost msgform \ prefix=@prefix@ srcdir=@srcdir@ +ACLOCAL=@ACLOCAL@ AUTH=@AUTH@ -DEFS=@DEFS@ -CPPFLAGS=@CPPFLAGS@ -I. -CFLAGS=@CFLAGS@ +AUTOCONF=@AUTOCONF@ +chkpwd_LIBS=@chkpwd_LIBS@ CC=@CC@ -RESOLV=@RESOLV@ -LIBS=@LIBS@ +CFLAGS=@CFLAGS@ +CPPFLAGS=@CPPFLAGS@ -I. +DATABASE=@DATABASE@ +DEFS=@DEFS@ LDFLAGS=@LDFLAGS@ -chkpwd_LIBS=@chkpwd_LIBS@ +LIBS=@LIBS@ LIBOBJS=@LIBOBJS@ INSTALL=@INSTALL@ INSTALL_DATA=@INSTALL_DATA@ +RESOLV=@RESOLV@ SHELL=/bin/sh -AUTOCONF=@AUTOCONF@ -ACLOCAL=@ACLOCAL@ +SERVER_LDFLAGS=@SERVER_LDFLAGS@ YACC=@YACC@ -DATABASE=@DATABASE@ # End configuration section @@ -127,7 +128,7 @@ SERV_OBJS = server_main.o \ clientsocket.o $(AUTH) $(SERV_MODULES) citserver: $(SERV_OBJS) - $(CC) $(SERV_OBJS) $(LDFLAGS) $(LIBS) $(RESOLV) -o citserver + $(CC) $(SERV_OBJS) $(LDFLAGS) $(SERVER_LDFLAGS) $(LIBS) $(RESOLV) -o citserver .c.o: $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $< -o $@ diff --git a/citadel/citadel.c b/citadel/citadel.c index 81395624b..e85342058 100644 --- a/citadel/citadel.c +++ b/citadel/citadel.c @@ -1049,6 +1049,8 @@ int main(int argc, char **argv) screen_new(); + newprompt("Connect to (return for local server): ", hostbuf, 64); + sln_printf("Attaching to server... \r"); sln_flush(); ipc = CtdlIPC_new(argc, argv, hostbuf, portbuf); diff --git a/citadel/citadel.nsi b/citadel/citadel.nsi index 83f129246..f1d0eab7b 100644 --- a/citadel/citadel.nsi +++ b/citadel/citadel.nsi @@ -21,9 +21,9 @@ OutFile "citadel-6.06.exe" BGGradient off -LangString $DESC_Citadel ${LANG_ENGLISH} "Citadel/UX client and core libraries (required)" -LangString $DESC_CitadelServer ${LANG_ENGLISH} "Citadel/UX server" -LangString $DESC_CitadelUtils ${LANG_ENGLISH} "Citadel/UX utilities" +LangString DESC_Citadel ${LANG_ENGLISH} "Citadel/UX client and core libraries (required)" +LangString DESC_CitadelServer ${LANG_ENGLISH} "Citadel/UX server" +LangString DESC_CitadelUtils ${LANG_ENGLISH} "Citadel/UX utilities" SetCompress auto SetDatablockOptimize on @@ -40,7 +40,7 @@ InstallDir "$PROGRAMFILES\Citadel" InstallDirRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Citadel\Citadel\CurrentVersion" "InstallDir" DirShow show -Section "Citadel/UX client and core libraries (required)" Citadel ; (default section) +Section "Citadel/UX Client and core libraries (required)" Citadel ; (default section) SetShellVarContext all SetOutPath "$INSTDIR" File C:\cygwin\home\error\cvs\citadel\citadel.exe @@ -68,13 +68,25 @@ SectionEnd ; end of default section Section "Citadel/UX Server" CitadelServer SetOutPath "$INSTDIR" File C:\cygwin\home\error\cvs\citadel\citserver.exe +File C:\cygwin\bin\cygz.dll File C:\cygwin\home\error\cvs\citadel\base64.exe File C:\cygwin\home\error\cvs\citadel\weekly File C:\cygwin\home\error\cvs\citadel\setup.exe -File /r C:\cygwin\home\error\cvs\citadel\bitbucket +File C:\cygwin\home\error\cvs\citadel\sendcommand.exe +File C:\cygwin\home\error\cvs\citadel\docs\citadel.html +File /oname=README.TXT C:\cygwin\home\error\cvs\citadel\docs\windows-readme.txt +SetOverwrite off File /r C:\cygwin\home\error\cvs\citadel\help File /r C:\cygwin\home\error\cvs\citadel\messages -WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\RunServices" "Citadel" '"$INSTDIR\citserver.exe" -x9 -t"$INSTDIR\citadel-debug.txt" -h"$INSTDIR"' +SetOverwrite on +CreateShortcut "$SMPROGRAMS\Citadel\Server Setup Utility.lnk" \ + "$INSTDIR\rxvt.exe" "-fg white -bg black -sl 1000 -sr -fn 8x16 -e ./setup.exe" \ + "shell32.dll" "65" +CreateShortcut "$SMPROGRAMS\Citadel\README.lnk" \ + "$INSTDIR\README.TXT" +CreateShortcut "$SMPROGRAMS\Citadel\Citadel Documentation.lnk" \ + "$INSTDIR\citadel.html" +WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\RunServices" "Citadel" "$INSTDIR\citserver.exe -x9 -tcitadel-debug.txt" SectionEnd Section "Citadel/UX Utilities" CitadelUtils @@ -83,17 +95,15 @@ File C:\cygwin\home\error\cvs\citadel\aidepost.exe File C:\cygwin\home\error\cvs\citadel\citmail.exe File C:\cygwin\home\error\cvs\citadel\migratenet.exe File C:\cygwin\home\error\cvs\citadel\msgform.exe -File C:\cygwin\home\error\cvs\citadel\sendcommand.exe File C:\cygwin\home\error\cvs\citadel\userlist.exe File C:\cygwin\home\error\cvs\citadel\whobbs.exe SectionEnd !insertmacro MUI_SECTIONS_FINISHHEADER !insertmacro MUI_FUNCTIONS_DESCRIPTION_BEGIN - !insertmacro MUI_DESCRIPTION_TEXT ${Citadel} ${DESC_Citadel} - !insertmacro MUI_DESCRIPTION_TEXT ${CitadelServer} ${DESC_CitadelServer} - !insertmacro MUI_DESCRIPTION_TEXT ${CitadelFiles} $(DESC_CitadelFiles} - !insertmacro MUI_DESCRIPTION_TEXT ${CitadelUtils} $(DESC_CitadelUtils} + !insertmacro MUI_DESCRIPTION_TEXT ${Citadel} $(DESC_Citadel) + !insertmacro MUI_DESCRIPTION_TEXT ${CitadelServer} $(DESC_CitadelServer) + !insertmacro MUI_DESCRIPTION_TEXT ${CitadelUtils} $(DESC_CitadelUtils) !insertmacro MUI_FUNCTIONS_DESCRIPTION_END ; begin uninstall settings/section @@ -127,6 +137,9 @@ RMDir /r "$INSTDIR\messages" RMDir /r "$INSTDIR\bitbucket" RMDir "$INSTDIR" +Delete "$SMPROGRAMS\Citadel\README.lnk" +Delete "$SMPROGRAMS\Citadel\Citadel Documentation.lnk" +Delete "$SMPROGRAMS\Citadel\Server Setup Utility.lnk" Delete "$SMPROGRAMS\Citadel\Citadel.lnk" RMDir "$SMPROGRAMS\Citadel" Delete "$DESKTOP\Citadel.lnk" diff --git a/citadel/citadel_ipc.c b/citadel/citadel_ipc.c index 921e7d63b..97cd0ac3d 100644 --- a/citadel/citadel_ipc.c +++ b/citadel/citadel_ipc.c @@ -1,7 +1,11 @@ /* $Id$ */ #define UDS "_UDS_" +#ifdef __CYGWIN__ +#define DEFAULT_HOST "localhost" +#else #define DEFAULT_HOST UDS +#endif #define DEFAULT_PORT "citadel" #include "sysdep.h" @@ -2820,6 +2824,13 @@ CtdlIPC* CtdlIPC_new(int argc, char **argv, char *hostbuf, char *portbuf) strcpy(cithost, DEFAULT_HOST); /* default host */ strcpy(citport, DEFAULT_PORT); /* default port */ + /* Allow caller to supply our values (Windows) */ + if (hostbuf && strlen(hostbuf) > 0) + strcpy(cithost, hostbuf); + if (portbuf && strlen(portbuf) > 0) + strcpy(citport, portbuf); + + /* Read host/port from command line if present */ for (a = 0; a < argc; ++a) { if (a == 0) { /* do nothing */ diff --git a/citadel/commands.c b/citadel/commands.c index f7a9a36b3..a3d471978 100644 --- a/citadel/commands.c +++ b/citadel/commands.c @@ -352,6 +352,12 @@ static void really_do_keepalive(void) { time(&idlet); + /* This may sometimes get called before we are actually connected + * to the server. Don't do anything if we aren't connected. -IO + */ + if (!ipc_for_signal_handlers) + return; + /* If full keepalives are enabled, send a NOOP to the server and * wait for a response. */ diff --git a/citadel/configure.ac b/citadel/configure.ac index 8b9c895ce..d4b29124c 100644 --- a/citadel/configure.ac +++ b/citadel/configure.ac @@ -90,6 +90,9 @@ case "$host" in *-*-solaris*) PTHREAD_DEFS="-D_REENTRANT -D_PTHREADS" ;; + *-*-cygwin*) + SERVER_LDFLAGS="-Wl,-subsystem,windows" + ;; esac DEFS="$DEFS $PTHREAD_DEFS" @@ -537,6 +540,7 @@ AC_SUBST(RESOLV) AC_SUBST(chkpwd_LIBS) AC_SUBST(TARGETS) AC_SUBST(DATABASE) +AC_SUBST(SERVER_LDFLAGS) AC_CONFIG_HEADER(sysdep.h) AC_CONFIG_FILES([Makefile weekly]) AC_OUTPUT diff --git a/citadel/docs/windows-readme.txt b/citadel/docs/windows-readme.txt new file mode 100644 index 000000000..ae70580de --- /dev/null +++ b/citadel/docs/windows-readme.txt @@ -0,0 +1,52 @@ +README for Windows distribution +------------------------------- + +Installation: + + To install Citadel/UX for Windows, run the citadel-X.XX.exe file. It is + recommended that you do not change the installation folder. Unlike the + Unix version, you do NOT need to run Citadel's setup utility before + starting the server. However, the system operator will be set to the + first user who creates an account on the server, so you need to login + immediately. + + Setup will fail if the Citadel server is running when you install/upgrade. + You will need to login to your Citadel server and issue the <.A>ide + erminate ow command to stop the server before upgrading Citadel. + This will be fixed in a future release. + + At the present time you must restart your computer to start the Citadel + server. This will be fixed in a future release. + +Removal: + + To remove Citadel/UX for Windows, go to Start > Control Panel > Add/Remove + Programs, click Citadel, then click Add/Remove (or Change/Remove). Your + server data (users, messages, etc.) will NOT be removed. To remove these + files, delete the C:\Program Files\Citadel\data directory. + +Known Issues in Citadel/UX for Windows: + +* Calendaring support is not included. Status: TO_BE_FIXED + +* Citadel may not run properly if the installation directory is changed from + C:\Program Files\Citadel. It is strongly recommended that you do not + change the installation directory. Status: TO_BE_FIXED + +* The "weekly" maintenance script does not run. Since it is a Unix script, + there is no way to run it in Windows. The main effect you will see is that + no server objects expire. If you wish you can expire them manually. To do + this, enter the following server commands (using the @ key in the text + client or the appropriate advanced command in WebCit): Status: TO_BE_FIXED + + EXPI users + EXPI rooms + EXPI messages + EXPI visits + EXPI usetable + +* Sessions can be disconnected if you read the citadel-debug.txt using a + Cygwin program while the server is running. In addition, the file is + written in Unix text format. To view this file, use a Windows editor + which understands Unix text files, such as WordPad. (Notepad won't work.) + Status: RELNOTE diff --git a/citadel/screen.c b/citadel/screen.c index c25fae949..26f0b6c8f 100644 --- a/citadel/screen.c +++ b/citadel/screen.c @@ -208,7 +208,7 @@ int screen_reset(void) { #if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES) if (myscreen) { - endwin(); + if (!isendwin()) endwin(); return 1; } #endif /* HAVE_CURSES_H */ diff --git a/citadel/sendcommand.c b/citadel/sendcommand.c index 9960af667..599655dd7 100644 --- a/citadel/sendcommand.c +++ b/citadel/sendcommand.c @@ -110,6 +110,8 @@ void np_attach_to_server(void) {"sendcommand", NULL}; int r; + strcpy(hostbuf, "localhost"); + strcpy(portbuf, "citadel"); fprintf(stderr, "Attaching to server...\n"); ipc = CtdlIPC_new(1, args, hostbuf, portbuf); CtdlIPC_getline(ipc, buf); diff --git a/citadel/setup.c b/citadel/setup.c index 068618d69..159a6284e 100644 --- a/citadel/setup.c +++ b/citadel/setup.c @@ -617,6 +617,9 @@ void edit_value(int curr) break; case 2: +#ifdef __CYGWIN__ + config.c_bbsuid = 0; /* XXX Windows hack, prob. insecure */ +#else i = config.c_bbsuid; pw = getpwuid(i); if (pw == NULL) { @@ -634,6 +637,7 @@ void edit_value(int curr) config.c_bbsuid = atoi(bbsuidname); } } +#endif break; case 3: @@ -948,7 +952,9 @@ NEW_INST: unlink("citadel.log"); check_services_entry(); /* Check /etc/services */ +#ifndef __CYGWIN__ check_inittab_entry(); /* Check /etc/inittab */ +#endif if ((pw = getpwuid(config.c_bbsuid)) == NULL) gid = getgid(); diff --git a/citadel/support.c b/citadel/support.c index 1e176ad95..855c9ad4c 100644 --- a/citadel/support.c +++ b/citadel/support.c @@ -11,6 +11,8 @@ #include "sysdep.h" #include +#include +#include #include #include #include @@ -109,26 +111,18 @@ void mesg_locate(char *targ, size_t n, const char *searchfor, { int a; char buf[SIZ]; + struct stat test; FILE *ls; for (a=0; a