* Made some changes to the hunt for citadel.socket when built in
authorArt Cancro <ajc@citadel.org>
Fri, 29 Jul 2005 19:00:15 +0000 (19:00 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 29 Jul 2005 19:00:15 +0000 (19:00 +0000)
  legacy mode

citadel/citadel_ipc.c
citadel/sendcommand.c

index e519e870798ad77911d4efa9daf2394f0eda8944..eec241329a866869fb4a1c6d19014d5cd98a65e2 100644 (file)
@@ -2940,23 +2940,14 @@ CtdlIPC* CtdlIPC_new(int argc, char **argv, char *hostbuf, char *portbuf)
        /* If we're using a unix domain socket we can do a bunch of stuff */
        if (!strcmp(cithost, UDS)) {
                if (!strcasecmp(citport, DEFAULT_PORT)) {
-                       snprintf(sockpath, sizeof sockpath, "%s%s",
-#ifndef HAVE_RUN_DIR
-                                        CTDLDIR
+#ifdef HAVE_RUN_DIR
+                       snprintf(sockpath, sizeof sockpath, RUNDIR "/citadel.socket");
 #else
-                                        RUN_DIR
+                       snprintf(sockpath, sizeof sockpath, CTDLDIR "/citadel.socket");
 #endif
-                                        , "/citadel.socket");
                }
                else {
-                       snprintf(sockpath, sizeof sockpath, "%s%s",
-                               citport, 
-#ifndef HAVE_RUN_DIR
-                                        CTDLDIR
-#else
-                                        RUN_DIR
-#endif
-                                        "/citadel.socket");
+                       snprintf(sockpath, sizeof sockpath, "%s/%s", citport, "citadel.socket");
                }
                ipc->sock = uds_connectsock(&(ipc->isLocal), sockpath);
                if (ipc->sock == -1) {
index e5cab9aa8d54b02ebcead9c4768c3a6d57ea58a5..fdbc88d68e46cb9659bb0dbc2769894c1161a7a1 100644 (file)
@@ -102,23 +102,17 @@ void logoff(int e)
 /*
  * Connect sendcommand to the Citadel server running on this computer.
  */
-void np_attach_to_server(void)
+void np_attach_to_server(char *host, char *port)
 {
-       char hostbuf[SIZ], portbuf[SIZ];
        char buf[SIZ];
+       char hostbuf[256], portbuf[256];
        char *args[] =
        {"sendcommand", NULL};
        int r;
 
-       strcpy(hostbuf, UDS);   /* Only run on a unix domain socket */
-       strcpy(portbuf, 
-#ifndef HAVE_RUN_DIR
-                  "."  /* IPGM will refuse to run on the network */
-#else
-                  ""
-#endif
-                  );
        fprintf(stderr, "Attaching to server...\n");
+       strcpy(hostbuf, host);
+       strcpy(portbuf, port);
        ipc = CtdlIPC_new(1, args, hostbuf, portbuf);
        if (!ipc) {
                fprintf(stderr, "Can't connect: %s\n", strerror(errno));
@@ -149,7 +143,7 @@ int main(int argc, char **argv)
        char cmd[SIZ];
        char buf[SIZ];
 
-       strcpy(ctdl_home_directory, CTDLDIR);
+       strcpy(ctdl_home_directory, DEFAULT_PORT);
 
        strcpy(cmd, "");
        /*
@@ -179,7 +173,7 @@ int main(int argc, char **argv)
                        (int) getpid(),
                        ctdl_home_directory);
        fflush(stderr);
-       np_attach_to_server();
+       np_attach_to_server(UDS, ctdl_home_directory);
        fflush(stderr);
        setIPCDeathHook(sendcommand_die);