* Numerous fixups needed for Windows port:
authorMichael Hampton <io_error@uncensored.citadel.org>
Wed, 4 Jun 2003 21:39:28 +0000 (21:39 +0000)
committerMichael Hampton <io_error@uncensored.citadel.org>
Wed, 4 Jun 2003 21:39:28 +0000 (21:39 +0000)
  * 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

12 files changed:
citadel/ChangeLog
citadel/Makefile.in
citadel/citadel.c
citadel/citadel.nsi
citadel/citadel_ipc.c
citadel/commands.c
citadel/configure.ac
citadel/docs/windows-readme.txt [new file with mode: 0644]
citadel/screen.c
citadel/sendcommand.c
citadel/setup.c
citadel/support.c

index 85e09618308c45ed89c3cabaf35f01e875e7374b..690884f78f61d6f4ec21901891b55f3f5dd7647f 100644 (file)
@@ -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 <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
-
index 513a28c252bbbd9dba51d0cc422031c40d4bed64..b04a12cba57e416f6d8696712117ec6e243f7812 100644 (file)
@@ -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 $@
index 81395624b2bc1bfb05a3c0596ee26ae25fea104e..e853420589f389e28ce20a9eaa0baf42a55c6f4f 100644 (file)
@@ -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);
index 83f1292465e1cceb7d9b8abe89186781df1dc4bc..f1d0eab7bb758d2688b74efcd30ab3cbcffa9727 100644 (file)
@@ -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"
index 921e7d63b47ebbd7597d8694f4afb6ca2e55085e..97cd0ac3d5341159a440e6c938209e18426bcd00 100644 (file)
@@ -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 */
index f7a9a36b32dc7921b01c8d287f51b58a9e985449..a3d471978b2539346c7348e492b564d421090490 100644 (file)
@@ -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.
         */
index 8b9c895ce1226e1959f306213b519b97647e6413..d4b29124cc5695286340c4e39a5a9450a1fc3293 100644 (file)
@@ -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 (file)
index 0000000..ae70580
--- /dev/null
@@ -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
+  <T>erminate <N>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
index c25fae949ad9b4c4abd66d375ada7f77432f8940..26f0b6c8fd3e57b190565386c38a13a665a4136f 100644 (file)
@@ -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 */
index 9960af66737475023a219b11a0095f69dcf2fbad..599655dd7a81c9d9b7585dba9a9cb9c99719be82 100644 (file)
@@ -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);
index 068618d6914f9cc1d6f9ce4a94dd613ae683c91d..159a6284e2dad601c29158d93143aad04583c083 100644 (file)
@@ -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();
index 1e176ad959ce8b0c5904f14c2dedc4d6d2bb94ba..855c9ad4c3712fb596c51bc474592534f98fcbf5 100644 (file)
@@ -11,6 +11,8 @@
 
 #include "sysdep.h"
 #include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
 #include <unistd.h>
 #include <ctype.h>
 #include <stdio.h>
@@ -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<numdirs; ++a) {
-               snprintf(buf, sizeof buf, "cd %s; exec ls",dirs[a]);
-               ls = (FILE *) popen(buf,"r");
-               if (ls != NULL) {
-                       while(fgets(buf,sizeof buf,ls)!=NULL) {
-                               while (isspace(buf[strlen(buf)-1]))
-                                       buf[strlen(buf)-1] = 0;
-                               if (!strcasecmp(buf,searchfor)) {
-                                       pclose(ls);
-                                       snprintf(targ,n,"%s/%s",dirs[a],buf);
-                                       return;
-                                       }
-                               }
-                       pclose(ls);
-                       }
+               snprintf(buf, sizeof buf, "%s/%s", dirs[a], searchfor);
+               if (!stat(buf, &test)) {
+                       snprintf(targ,n,"%s/%s", dirs[a], searchfor);
+                       return;
                }
-       strcpy(targ,"");
        }
+       strcpy(targ,"");
+}
 
 
 #ifndef HAVE_STRERROR