Converted two more utilities: ctdlmigrate and sendcommand
authorArt Cancro <ajc@citadel.org>
Sun, 5 Jun 2022 17:02:46 +0000 (13:02 -0400)
committerArt Cancro <ajc@citadel.org>
Sun, 5 Jun 2022 17:02:46 +0000 (13:02 -0400)
citadel/COPYING
citadel/Makefile
citadel/packageversion
citadel/utils/ctdlmigrate.c
citadel/utils/sendcommand.c

index 97eb78723d68d03ad63a8f158cf5bdb9e6c2e1e9..91923405c7c69ff7cf759ea10ca15f476ec8b1a8 100644 (file)
@@ -1,7 +1,7 @@
 
 Copyright: (C) 1987-2022 Citadel development team; GPL V3
 
 
 Copyright: (C) 1987-2022 Citadel development team; GPL V3
 
-* In addition, as a special exception, we hereby declare that our
+* As a special exception, it is officialy resolved that our
   favorite type of software is called "open source" -- NOT "free
   software" -- and that our favorite operating system is called
   "Linux" -- NOT "GNU/Linux".
   favorite type of software is called "open source" -- NOT "free
   software" -- and that our favorite operating system is called
   "Linux" -- NOT "GNU/Linux".
@@ -14,7 +14,6 @@ Copyright: (C) 1987-2022 Citadel development team; GPL V3
   libraries, including OpenSSL, in the sole case that such linking
   is done to build the Citadel system itself.
 
   libraries, including OpenSSL, in the sole case that such linking
   is done to build the Citadel system itself.
 
-
                        GENERAL PUBLIC LICENSE
                        Version 3, 29 June 2007
 
                        GENERAL PUBLIC LICENSE
                        Version 3, 29 June 2007
 
index bf4b39b6e03491d3d358bbf475c5be805bbafb67..fa46fa7eaef99102921d6ceb347ffe4f6205d8b2 100644 (file)
@@ -17,7 +17,7 @@
 # config.mk is generated by ./configure
 include config.mk
 
 # config.mk is generated by ./configure
 include config.mk
 
-all: citserver setup
+all: citserver setup ctdlmigrate sendcommand
 
 citserver: server/*.c server/modules/*/*.c config.mk server/*.h
        cc ${CFLAGS} \
 
 citserver: server/*.c server/modules/*/*.c config.mk server/*.h
        cc ${CFLAGS} \
@@ -28,6 +28,12 @@ citserver: server/*.c server/modules/*/*.c config.mk server/*.h
 setup: utils/setup.c server/citadel_dirs.c utils/*.h server/*.h
        cc ${CFLAGS} utils/setup.c -lcitadel -o setup
 
 setup: utils/setup.c server/citadel_dirs.c utils/*.h server/*.h
        cc ${CFLAGS} utils/setup.c -lcitadel -o setup
 
+ctdlmigrate: utils/ctdlmigrate.c server/citadel_dirs.c utils/*.h server/*.h
+       cc ${CFLAGS} utils/ctdlmigrate.c -lcitadel -lreadline -o ctdlmigrate
+
+sendcommand: utils/sendcommand.c server/citadel_dirs.c utils/*.h server/*.h
+       cc ${CFLAGS} utils/sendcommand.c -lcitadel -o sendcommand
+
 config.mk: configure
        ./configure
 
 config.mk: configure
        ./configure
 
index d00491fd7e5bb6fa28c517a0bb32b8b506539d4d..b8626c4cff2849624fb67f87cd0ad72b163671ad 100644 (file)
@@ -1 +1 @@
-1
+4
index 5d86011797e8dbdee25896c0b68be0126642e72f..8c1f18a5383b01ebadedde4727947bdb77683f54 100644 (file)
@@ -1,6 +1,6 @@
 // Across-the-wire migration utility for Citadel
 //
 // Across-the-wire migration utility for Citadel
 //
-// Copyright (c) 2009-2021 citadel.org
+// Copyright (c) 2009-2022 citadel.org
 //
 // This program is open source software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License version 3.
 //
 // This program is open source software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License version 3.
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <libcitadel.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <libcitadel.h>
-#include "citadel.h"
+#include "../server/citadel.h"
 #include "axdefs.h"
 #include "axdefs.h"
-#include "sysdep.h"
-#include "config.h"
-#include "citadel_dirs.h"
+#include "../server/sysdep.h"
+#include "../server/config.h"
+#include "../server/citadel_dirs.h"
 
 
 // support for getz() -- (globals would not be appropriate in a multithreaded program)
 
 
 // support for getz() -- (globals would not be appropriate in a multithreaded program)
index bd87ff3b48cf3be2f5c251cfb3afd5ddb0a17e3e..6971d60a4d25b4d33a0f9adacb3dec54052eb205 100644 (file)
@@ -1,16 +1,14 @@
-/*
- * Command-line utility to transmit a server command.
- *
- * Copyright (c) 1987-2021 by the citadel.org team
- *
- * This program is open source software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
+// Command-line utility to transmit a server command.
+//
+// Copyright (c) 1987-2022 by the citadel.org team
+//
+// This program is open source software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 3.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
 
 #include <stdio.h>
 #include <stdlib.h>
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -26,8 +24,8 @@
 #include <limits.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <limits.h>
 #include <sys/socket.h>
 #include <sys/un.h>
-#include "citadel.h"
-#include "citadel_dirs.h"
+#include "../server/citadel.h"
+#include "../server/citadel_dirs.h"
 #include <libcitadel.h>
 
 int serv_sock = (-1);
 #include <libcitadel.h>
 
 int serv_sock = (-1);
@@ -56,9 +54,7 @@ int uds_connectsock(char *sockpath) {
 }
 
 
 }
 
 
-/*
- * input binary data from socket
- */
+// input binary data from socket
 void serv_read(char *buf, int bytes) {
        int len, rlen;
 
 void serv_read(char *buf, int bytes) {
        int len, rlen;
 
@@ -73,9 +69,7 @@ void serv_read(char *buf, int bytes) {
 }
 
 
 }
 
 
-/*
- * send binary to server
- */
+// send binary to server
 void serv_write(char *buf, int nbytes) {
        int bytes_written = 0;
        int retval;
 void serv_write(char *buf, int nbytes) {
        int bytes_written = 0;
        int retval;
@@ -89,46 +83,37 @@ void serv_write(char *buf, int nbytes) {
 }
 
 
 }
 
 
-/*
- * input string from socket - implemented in terms of serv_read()
- */
+// input string from socket - implemented in terms of serv_read()
 void serv_gets(char *buf) {
        int i;
 
 void serv_gets(char *buf) {
        int i;
 
-       /* Read one character at a time.
-        */
+       // Read one character at a time.
        for (i = 0;; i++) {
                serv_read(&buf[i], 1);
                if (buf[i] == '\n' || i == (SIZ-1))
                        break;
        }
 
        for (i = 0;; i++) {
                serv_read(&buf[i], 1);
                if (buf[i] == '\n' || i == (SIZ-1))
                        break;
        }
 
-       /* If we got a long line, discard characters until the newline.
-        */
+       // If we got a long line, discard characters until the newline.
        if (i == (SIZ-1)) {
                while (buf[i] != '\n') {
                        serv_read(&buf[i], 1);
                }
        }
 
        if (i == (SIZ-1)) {
                while (buf[i] != '\n') {
                        serv_read(&buf[i], 1);
                }
        }
 
-       /* Strip all trailing nonprintables (crlf)
-        */
+       // Strip all trailing nonprintables (crlf)
        buf[i] = 0;
 }
 
 
        buf[i] = 0;
 }
 
 
-/*
- * send line to server - implemented in terms of serv_write()
- */
+// send line to server - implemented in terms of serv_write()
 void serv_puts(char *buf) {
        serv_write(buf, strlen(buf));
        serv_write("\n", 1);
 }
 
 
 void serv_puts(char *buf) {
        serv_write(buf, strlen(buf));
        serv_write("\n", 1);
 }
 
 
-/*
- * Main loop.  Do things and have fun.
- */
+// Main loop.  Do things and have fun.
 int main(int argc, char **argv) {
        int a;
        int watchdog = 60;
 int main(int argc, char **argv) {
        int a;
        int watchdog = 60;
@@ -136,7 +121,7 @@ int main(int argc, char **argv) {
        int xfermode = 0;
        char ctdldir[PATH_MAX]=CTDLDIR;
 
        int xfermode = 0;
        char ctdldir[PATH_MAX]=CTDLDIR;
 
-       /* Parse command line */
+       // Parse command line
        while ((a = getopt(argc, argv, "h:w:")) != EOF) {
                switch (a) {
                case 'h':
        while ((a = getopt(argc, argv, "h:w:")) != EOF) {
                switch (a) {
                case 'h':
@@ -182,7 +167,7 @@ int main(int argc, char **argv) {
 
        xfermode = buf[0];
 
 
        xfermode = buf[0];
 
-       if ((xfermode == '4') || (xfermode == '8')) {           /* send text */
+       if ((xfermode == '4') || (xfermode == '8')) {           // send text
                while (fgets(buf, sizeof buf, stdin) > 0) {
                        if (buf[strlen(buf)-1] == '\n') {
                                buf[strlen(buf)-1] = 0;
                while (fgets(buf, sizeof buf, stdin) > 0) {
                        if (buf[strlen(buf)-1] == '\n') {
                                buf[strlen(buf)-1] = 0;
@@ -192,13 +177,13 @@ int main(int argc, char **argv) {
                serv_puts("000");
        }
 
                serv_puts("000");
        }
 
-       if ((xfermode == '1') || (xfermode == '8')) {           /* receive text */
+       if ((xfermode == '1') || (xfermode == '8')) {           // receive text
                while(serv_gets(buf), strcmp(buf, "000")) {
                        printf("%s\n", buf);
                }
        }
        
                while(serv_gets(buf), strcmp(buf, "000")) {
                        printf("%s\n", buf);
                }
        }
        
-       if (xfermode == '6') {                                  /* receive binary */
+       if (xfermode == '6') {                                  // receive binary
                size_t len = atoi(&buf[4]);
                size_t bytes_remaining = len;
 
                size_t len = atoi(&buf[4]);
                size_t bytes_remaining = len;
 
@@ -212,7 +197,7 @@ int main(int argc, char **argv) {
        }
 
        close(serv_sock);
        }
 
        close(serv_sock);
-       alarm(0);                                               /* cancel the watchdog timer */
+       alarm(0);                                               // cancel the watchdog timer
 
        fprintf(stderr, "sendcommand: processing ended.\n");
        if (xfermode == '5') {
 
        fprintf(stderr, "sendcommand: processing ended.\n");
        if (xfermode == '5') {