From 3524c469a659a79b07a4be6ea358288b74242652 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Fri, 20 Jan 2012 13:20:34 -0500 Subject: [PATCH] sendcommand: locate admin socket using calc_dirs_n_files --- citadel/Makefile.in | 4 ++-- citadel/utils/sendcommand.c | 17 +++++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/citadel/Makefile.in b/citadel/Makefile.in index a1abae852..6cfec7327 100644 --- a/citadel/Makefile.in +++ b/citadel/Makefile.in @@ -204,8 +204,8 @@ stress$(EXEEXT): utils/stress.o utillib/ipc_c_tcp.o utillib/citadel_ipc.o \ utillib/citadel_dirs.o $(LIBOBJS) \ $(LDFLAGS) -o stress$(EXEEXT) $(LIBS) -sendcommand$(EXEEXT): utils/sendcommand.o $(LIBOBJS) - $(CC) utils/sendcommand.o \ +sendcommand$(EXEEXT): utils/sendcommand.o utillib/citadel_dirs.o $(LIBOBJS) + $(CC) utils/sendcommand.o utillib/citadel_dirs.o \ $(LIBOBJS) $(LDFLAGS) -o sendcommand$(EXEEXT) $(LIBS) base64$(EXEEXT): utils/base64.o diff --git a/citadel/utils/sendcommand.c b/citadel/utils/sendcommand.c index e9e5fbcd6..fde3d5c3c 100644 --- a/citadel/utils/sendcommand.c +++ b/citadel/utils/sendcommand.c @@ -26,6 +26,7 @@ #include #include #include "citadel.h" +#include "include/citadel_dirs.h" @@ -141,15 +142,18 @@ int main(int argc, char **argv) { int a; int watchdog = 60; - char *ctdl_home_directory = CTDLDIR; char buf[SIZ]; int xfermode = 0; + int relh=0; + int home=0; + char relhome[PATH_MAX]=""; + char ctdldir[PATH_MAX]=CTDLDIR; /* Parse command line */ while ((a = getopt(argc, argv, "h:w:")) != EOF) { switch (a) { case 'h': - ctdl_home_directory = strdup(optarg); + strcpy(relhome, optarg); break; case 'w': watchdog = atoi(optarg); @@ -159,15 +163,16 @@ int main(int argc, char **argv) } } - fprintf(stderr, "sendcommand: started (pid=%d) connecting to Citadel server in %s\n", + calc_dirs_n_files(relh, home, relhome, ctdldir, 0); + + fprintf(stderr, "sendcommand: started (pid=%d) connecting to Citadel server at %s\n", (int) getpid(), - ctdl_home_directory + file_citadel_admin_socket ); fflush(stderr); alarm(watchdog); - snprintf(buf, sizeof buf, "%s/citadel-admin.socket", ctdl_home_directory); - serv_sock = uds_connectsock(buf); + serv_sock = uds_connectsock(file_citadel_admin_socket); serv_gets(buf); fprintf(stderr, "%s\n", buf); -- 2.30.2