]> code.citadel.org Git - citadel.git/commitdiff
* Removed the 'netsetup' and 'dnetsetup' utilities (obsolete)
authorArt Cancro <ajc@citadel.org>
Tue, 28 May 2002 13:59:02 +0000 (13:59 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 28 May 2002 13:59:02 +0000 (13:59 +0000)
citadel/ChangeLog
citadel/Makefile.in
citadel/citadel.spec
citadel/dnetsetup [deleted file]
citadel/netsetup.c [deleted file]

index c5cd6e0908e8eec490224909bd90255203cd2b99..2d9b8c6705f3da5cb15be6aa1d6ccb0e70192709 100644 (file)
@@ -1,4 +1,7 @@
  $Log$
+ Revision 591.32  2002/05/28 13:59:02  ajc
+ * Removed the 'netsetup' and 'dnetsetup' utilities (obsolete)
+
  Revision 591.31  2002/05/24 19:58:13  ajc
  * Fixed the "idle timeout during paginator prompt" bug by reintroducting the
    concept of a "half keepalive" and sending them during paginator prompts.
@@ -3679,3 +3682,4 @@ 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 9d6654ba491c79057a3a16b6cdcb80ad97122888..9d2682581fcfff0d76e12889bd20c114772901a1 100644 (file)
@@ -39,7 +39,7 @@ SERV_MODULES=modules/libchat.la modules/libvcard.la \
        modules/libexpire.la \
        modules/libvandelay.la \
        modules/libical.la
-UTIL_TARGETS=aidepost netsetup msgform readlog \
+UTIL_TARGETS=aidepost msgform readlog \
        stats citmail userlist sendcommand \
        base64 migratenet$(EXEEXT)
 
@@ -77,7 +77,7 @@ SOURCES=aidepost.c citadel.c citmail.c citserver.c client_chat.c \
        client_crypto.c commands.c config.c control.c $(DATABASE) \
        dynloader.c file_ops.c housekeeping.c ipc_c_tcp.c locate_host.c \
        logging.c messages.c msgbase.c msgform.c \
-       netsetup.c policy.c readlog.c migratenet.c screen.c \
+       policy.c readlog.c migratenet.c screen.c \
        room_ops.c rooms.c routines.c routines2.c serv_chat.c serv_crypto.c \
        serv_info.c serv_test.c setup.c snprintf.c stats.c serv_vcard.c \
        support.c sysdep.c tools.c user_ops.c userlist.c serv_expire.c \
@@ -208,9 +208,6 @@ setup: setup.o tools.o
 chkpwd: chkpwd.o auth.o config.o
        $(CC) chkpwd.o auth.o config.o $(LDFLAGS) -o chkpwd $(chkpwd_LIBS)
 
-netsetup: netsetup.o config.o
-       $(CC) netsetup.o config.o $(LDFLAGS) -o netsetup
-
 whobbs$(EXEEXT): whobbs.o ipc_c_tcp.o tools.o client_crypto.o $(LIBOBJS)
        $(CC) whobbs.o ipc_c_tcp.o tools.o client_crypto.o $(LIBOBJS) $(LDFLAGS) -o whobbs $(LIBS)
 
@@ -278,7 +275,7 @@ install-exec: all weekly
                        (cd modules && ../$(LIBTOOL) --mode=install $(INSTALL) `basename $$i` $(root)$(prefix)/$$i) ; \
                fi \
        done
-       @for i in utilsmenu weekly dnetsetup; do \
+       @for i in utilsmenu weekly do \
                if test -f $(srcdir)/$$i; then \
                        echo $(INSTALL) $(srcdir)/$$i $(root)$(prefix)/$$i; \
                        $(INSTALL) $(srcdir)/$$i $(root)$(prefix)/$$i; \
index 39ae4803a666cac2f92b4f819ae992c5e6436b9a..55dce55d87936351c4078d53f0f0159908553d3a 100644 (file)
@@ -72,12 +72,10 @@ upgrading this package.
 %attr(4755,root,root) /usr/local/citadel/chkpwd
 /usr/local/citadel/citmail
 /usr/local/citadel/citserver
-/usr/local/citadel/dnetsetup
 /usr/local/citadel/libcitserver.so
 /usr/local/citadel/libcitserver.la
 /usr/local/citadel/migratenet
 /usr/local/citadel/msgform
-/usr/local/citadel/netsetup
 /usr/local/citadel/readlog
 /usr/local/citadel/sendcommand
 /usr/local/citadel/setup
diff --git a/citadel/dnetsetup b/citadel/dnetsetup
deleted file mode 100755 (executable)
index 46b2962..0000000
+++ /dev/null
@@ -1,178 +0,0 @@
-#!/bin/sh
-
-# dnetsetup version 1.0
-# Copyright (c)1998 by Art Cancro / All rights reserved.
-# This program is distributed under the terms of the GNU General Public
-# License.  See copyright.txt for more information.
-#
-# dnetsetup requires Savio Lam's "dialog" program to perform its interactive
-# dialogs.  This program is standard on most Linux systems, and should be
-# easy enough to get on other systems.
-
-cleanup() {
-       rm -f $tempfile $tempfile2 $menucmd 2>/dev/null
-       exit
-       }
-
-
-roomlist() {
-       node=$1
-       
-       ./netsetup roomlist $1 >$tempfile 2>&1
-       $DIALOG --textbox $tempfile $menuheight $menuwidth
-       }
-
-
-unshare() {
-       node=$1
-
-       ./netsetup roomlist $node >$tempfile
-       numrooms=`cat $tempfile |wc -l`
-       sed s/\ /\\\\\ /g <$tempfile | sed s/$/\ \"\"/g >$tempfile2
-       echo $DIALOG --menu \"Select the room you wish to stop sharing\" \
-               $menuheight $menuwidth $numrooms \
-               `cat $tempfile2` >$menucmd
-       if sh $menucmd 2>$tempfile; then
-               room_to_delete=`cat $tempfile`
-
-               if $DIALOG --yesno "Are you sure you wish to stop sharing $room_to_delete ?" 5 $menuwidth ; then
-                       if ./netsetup unshare $node "$room_to_delete" 2>$tempfile; then
-                               $DIALOG --msgbox "$room_to_delete has been unshared." 5 $menuwidth
-                       else
-                               $DIALOG --textbox $tempfile $menuheight $menuwidth
-                               fi
-                       fi
-               fi
-
-       }
-
-do_share() {
-       node=$1
-
-       if $DIALOG --inputbox "Enter name of room to share:" \
-               $menuheight $menuwidth 2>$tempfile ; then
-       
-               room_to_share=`cat $tempfile`   
-               if ./netsetup share $node "$room_to_share" 2>$tempfile; then
-                       $DIALOG --msgbox "$room_to_share has been added." 5 $menuwidth
-               else
-                       $DIALOG --textbox $tempfile $menuheight $menuwidth
-                       fi
-
-               fi
-       }
-
-
-edit_this_node() {
-       node=$1
-       choice=nothing_yet
-
-       while [ $choice != EXIT ]
-       do
-               if $DIALOG --menu "Editing $node" $menuheight $menuwidth 4 \
-                       LIST    "List currently shared rooms" \
-                       SHARE   "Add a shared room" \
-                       UNSHARE "Stop sharing a room" \
-                       EXIT    "Return to main menu" 2>$tempfile; then
-                               choice=`cat $tempfile`
-                       else
-                               choice="EXIT"
-                               fi
-
-               [ $choice = "LIST" ] && roomlist $node
-               [ $choice = "SHARE" ] && do_share $node
-               [ $choice = "UNSHARE" ] && unshare $node
-
-               done
-       }
-
-
-edit_a_node() {
-
-       ./netsetup nodelist >$tempfile
-       numnodes=`cat $tempfile |wc -l`
-       sed s/$/\ \"\"/g <$tempfile >$tempfile2
-       echo $DIALOG --menu \"Select the node you wish to edit\" \
-               $menuheight $menuwidth $numnodes \
-               `cat $tempfile2` >$menucmd
-       if sh $menucmd 2>$tempfile; then
-               system_to_edit=`cat $tempfile`
-               edit_this_node $system_to_edit
-       else
-               true
-               fi
-       }
-
-
-
-
-
-
-delete_network_nodes() {
-
-       ./netsetup nodelist >$tempfile
-       numnodes=`cat $tempfile |wc -l`
-       sed s/$/\ \"\"/g <$tempfile >$tempfile2
-       echo $DIALOG --menu \"Select the node you wish to delete\" \
-               $menuheight $menuwidth $numnodes \
-               `cat $tempfile2` >$menucmd
-       if sh $menucmd 2>$tempfile; then
-               system_to_delete=`cat $tempfile`
-
-               if $DIALOG --yesno "Are you sure you wish to delete $system_to_delete ?" 5 $menuwidth ; then
-                       if ./netsetup deletenode $system_to_delete 2>$tempfile; then
-                               $DIALOG --msgbox "$system_to_delete has been deleted." 5 $menuwidth
-                       else
-                               $DIALOG --textbox $tempfile $menuheight $menuwidth
-                               fi
-                       fi
-               fi
-
-       }
-
-
-add_a_node() {
-       node=$1
-
-       if $DIALOG --inputbox "Enter name of new node:" \
-               $menuheight $menuwidth 2>$tempfile ; then
-       
-               new_node=`cat $tempfile`        
-               if ./netsetup addnode $new_node 2>$tempfile; then
-                       $DIALOG --msgbox "$new_node has been created." 5 $menuwidth
-               else
-                       $DIALOG --textbox $tempfile $menuheight $menuwidth
-                       fi
-
-               fi
-       }
-
-
-# Main loop...
-clear
-tempfile=/tmp/dnetsetup.$$.1
-tempfile2=/tmp/dnetsetup.$$.2
-menucmd=/tmp/dnetsetup.$$.3
-menuheight=20
-menuwidth=72
-DIALOG=dialog
-while true
-do
-       if $DIALOG --menu "Citadel/UX Network Setup" $menuheight $menuwidth 4 \
-               EDIT    "View or change a network node" \
-               ADD     "Add a new network node" \
-               DELETE  "Delete a network node" \
-               EXIT    "Exit from Network Setup" \
-               2>$tempfile; then
-                       choice=`cat $tempfile`
-               else
-                       choice=EXIT
-               fi
-       rm -f $tempfile
-
-       [ $choice = "EXIT" ] && cleanup
-       [ $choice = "DELETE" ] && delete_network_nodes
-       [ $choice = "EDIT" ] && edit_a_node
-       [ $choice = "ADD" ] && add_a_node
-
-       done
diff --git a/citadel/netsetup.c b/citadel/netsetup.c
deleted file mode 100644 (file)
index a213ce6..0000000
+++ /dev/null
@@ -1,427 +0,0 @@
-/*
- * $Id$
- *
- * Command-line utility to manipulate network configuration files
- * Copyright (c) 1998  Art Cancro
- *
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include "citadel.h"
-
-struct roomshare {
-       struct roomshare *next;
-       char rs_name[30];
-       long rs_lastsent;
-       };
-
-struct netnode {
-       char nn_nodename[32];
-       char nn_spoolcmd[SIZ];
-       struct roomshare *nn_first;
-       };
-
-
-void get_config(void);
-struct config config;
-
-
-struct netnode *load_node(char *nodename)
-{
-       FILE *fp;
-       char buf[SIZ];
-       char filename[SIZ];
-       struct netnode *newnn;
-       struct roomshare *newrs;
-
-       snprintf(filename, sizeof filename, "./network/systems/%s", nodename);
-       fp = fopen(filename, "r");
-       if (fp == NULL) {
-               return NULL;
-               }
-
-       newnn = (struct netnode *) malloc(sizeof(struct netnode));
-       strcpy(newnn->nn_nodename, nodename);
-       newnn->nn_first = NULL;
-
-       fgets(buf, (SIZ-1), fp);
-       buf[strlen(buf)-1] = 0;
-       strcpy(newnn->nn_spoolcmd, buf);
-
-       while (fgets(buf, (SIZ-1), fp) != NULL) {
-               newrs = (struct roomshare *) malloc(sizeof(struct roomshare));
-               newrs->next = newnn->nn_first;
-               newnn->nn_first = newrs;
-               buf[strlen(buf)-1] = 0;
-               strcpy(newrs->rs_name, buf);
-               fgets(buf, (SIZ-1), fp);
-               buf[strlen(buf)-1] = 0;
-               newrs->rs_lastsent = atol(buf);
-               }
-
-       fclose(fp);
-       return(newnn);
-       }
-
-
-
-void save_node(struct netnode *nnptr)
-{
-
-       FILE *fp;
-       char filename[SIZ];
-       struct roomshare *rsptr = NULL;
-       
-       snprintf(filename, sizeof filename, "./network/systems/%s", nnptr->nn_nodename);
-       fp = fopen(filename, "w");
-       if (fp == NULL) {
-               fprintf(stderr, "%s\n", strerror(errno));
-               return;
-               }
-       fprintf(fp, "%s\n", nnptr->nn_spoolcmd);
-       while (nnptr->nn_first != NULL) {
-               fprintf(fp, "%s\n%ld\n", nnptr->nn_first->rs_name,
-                                       nnptr->nn_first->rs_lastsent);
-               rsptr = nnptr->nn_first->next;
-               free(nnptr->nn_first);
-               nnptr->nn_first = rsptr;
-               }
-       fclose(fp);
-       free(rsptr);
-       }
-
-
-
-void display_usage(void) {
-       fprintf(stderr, "netsetup for %s\n", CITADEL);
-       fprintf(stderr, "usage: netsetup <command> [arguments]\n\n");
-       fprintf(stderr, "Commands: \n");
-       fprintf(stderr, "   nodelist                  (Lists all neighboring nodes\n");
-       fprintf(stderr, "   addnode [name]            (Adds a new node to the list)\n");
-       fprintf(stderr, "   deletenode [name]         (Deletes a node from the list)\n");
-       fprintf(stderr, "   roomlist [node]           (List rooms being shared)\n");
-       fprintf(stderr, "   getcommand [node]         (Show spool command)\n");
-       fprintf(stderr, "   setcommand [node] [cmd]   (Set spool command)\n");
-       fprintf(stderr, "   share [node] [room]       (Add a new shared room)\n");
-       fprintf(stderr, "   unshare [node] [room]     (Stop sharing a room)\n");
-       fprintf(stderr, "   help                      (Display this message)\n");
-       }
-
-
-/*
- * Display all neighboring nodes
- * (This is inherently nonportable)
- */
-void display_nodelist(void) {
-       FILE *ls;
-       char buf[SIZ];
-
-       ls = (FILE *) popen("cd ./network/systems; ls", "r");
-       if (ls == NULL) {
-               fprintf(stderr, "netsetup: Cannot open nodelist: %s\n",
-                       strerror(errno));
-               exit(errno);
-               }
-
-       while (fgets(buf, (SIZ-1), ls) != NULL) {
-               printf("%s", buf);
-               }
-
-       pclose(ls);
-       }
-
-
-
-/*
- */
-void add_node(char *NewNodeName)
-{
-       FILE *fp;
-       char sysfilename[SIZ];
-
-       snprintf(sysfilename, sizeof sysfilename, "./network/systems/%s", NewNodeName);
-
-       fp = fopen(sysfilename, "r");
-       if (fp != NULL) {
-               fclose(fp);
-               fprintf(stderr, "A node named '%s' already exists.\n",
-                       NewNodeName);
-               exit(2);
-               }
-
-       fp = fopen(sysfilename, "w");
-       if (fp == NULL) {
-               fprintf(stderr, "%s\n", strerror(errno));
-               exit(errno);
-               }
-
-       fprintf(fp, "cat %%s >>./network/spoolout/%s\n", NewNodeName);
-       fclose(fp);
-       }
-
-
-/*
- */
-void delete_node(char *NodeName)
-{
-       FILE *fp;
-       char sysfilename[SIZ];
-       char spooloutfilename[SIZ];
-
-       snprintf(sysfilename, sizeof sysfilename, "./network/systems/%s", NodeName);
-       snprintf(spooloutfilename, sizeof spooloutfilename, "./network/spoolout/%s", NodeName);
-
-       fp = fopen(sysfilename, "r");
-       if (fp == NULL) {
-               fprintf(stderr, "'%s' does not exist.\n",
-                       NodeName);
-               exit(3);
-               }
-       fclose(fp);
-
-       unlink(spooloutfilename);
-       if (unlink(sysfilename)==0) {
-               return;
-               }
-       fprintf(stderr, "%s\n", strerror(errno));
-       exit(errno);
-       }
-
-
-/*
- */
-void do_roomlist(char *NodeName)
-{
-       FILE *fp;
-       char sysfilename[SIZ];
-       char buf[SIZ];
-
-       snprintf(sysfilename, sizeof sysfilename, "./network/systems/%s", NodeName);
-
-       fp = fopen(sysfilename, "r");
-       if (fp == NULL) {
-               fprintf(stderr, "'%s' does not exist.\n",
-                       NodeName);
-               exit(3);
-               }
-
-       fgets(buf, (SIZ-1), fp);        /* skip past spool cmd */
-       while (fgets(buf, (SIZ-1), fp) != NULL) {
-               printf("%s", buf);
-               fgets(buf, (SIZ-1), fp); /* skip past last-sent pointer */
-               }
-
-       fclose(fp);
-       }
-
-
-
-/*
- */
-void show_spool_cmd(char *NodeName)
-{
-       FILE *fp;
-       char sysfilename[SIZ];
-       char buf[SIZ];
-
-       snprintf(sysfilename, sizeof sysfilename, "./network/systems/%s", NodeName);
-
-       fp = fopen(sysfilename, "r");
-       if (fp == NULL) {
-               fprintf(stderr, "'%s' does not exist.\n",
-                       NodeName);
-               exit(3);
-               }
-
-       fgets(buf, (SIZ-1), fp);
-       printf("%s", buf);
-       fclose(fp);
-       }
-
-
-/*
- */
-void set_spool_cmd(char *nodename, char *spoolcmd)
-{
-       struct netnode *nnptr;
-
-       nnptr = load_node(nodename);
-       if (nnptr == NULL) {
-               fprintf(stderr, "No such node '%s'.\n", nodename);
-               exit(4);
-               }
-
-       strncpy(nnptr->nn_spoolcmd, spoolcmd, (SIZ-1));
-       save_node(nnptr);
-       }
-
-
-/*
- */
-void add_share(char *nodename, char *roomname)
-{
-       struct netnode *nnptr;
-       struct roomshare *rsptr;
-       long highest = 0L;
-       int foundit = 0;
-
-       nnptr = load_node(nodename);
-       if (nnptr == NULL) {
-               fprintf(stderr, "No such node '%s'.\n", nodename);
-               exit(4);
-               }
-
-       for (rsptr = nnptr->nn_first; rsptr != NULL; rsptr = rsptr->next) {
-               if (!strcasecmp(rsptr->rs_name, roomname)) {
-                       foundit = 1;
-                       }
-               if (rsptr->rs_lastsent > highest) {
-                       highest = rsptr->rs_lastsent;
-                       }
-               }
-
-       if (foundit == 0) {
-               rsptr = (struct roomshare *) malloc(sizeof(struct roomshare));
-               rsptr->next = nnptr->nn_first;
-               strcpy(rsptr->rs_name, roomname);
-               rsptr->rs_lastsent = highest;
-               nnptr->nn_first = rsptr;
-               }
-
-       save_node(nnptr);
-       }
-
-
-/*
- */
-void remove_share(char *nodename, char *roomname)
-{
-       struct netnode *nnptr;
-       struct roomshare *rsptr, *rshold;
-       int foundit = 0;
-
-       nnptr = load_node(nodename);
-       if (nnptr == NULL) {
-               fprintf(stderr, "No such node '%s'.\n", nodename);
-               exit(4);
-               }
-
-       if (nnptr->nn_first != NULL)
-          if (!strcasecmp(nnptr->nn_first->rs_name, roomname)) {
-               rshold = nnptr->nn_first;
-               nnptr->nn_first = nnptr->nn_first->next;
-               free(rshold);
-               foundit = 1;
-               }
-
-       if (nnptr->nn_first != NULL)
-          for (rsptr = nnptr->nn_first; rsptr->next != NULL; rsptr = rsptr->next) {
-               if (!strcasecmp(rsptr->next->rs_name, roomname)) {
-                       rshold = rsptr->next;
-                       rsptr->next = rsptr->next->next;
-                       free(rshold);
-                       foundit = 1;
-                       rsptr = nnptr->nn_first;
-                       }
-               }
-
-       save_node(nnptr);
-
-       if (foundit == 0) {
-               fprintf(stderr, "Not sharing '%s' with %s\n",
-                       roomname, nodename);
-               exit(5);
-               }
-       }
-
-
-int main(int argc, char **argv)
-{
-
-       if (argc < 2) {
-               display_usage();
-               exit(1);
-               }
-
-       get_config();
-
-       if (!strcmp(argv[1], "help")) {
-               display_usage();
-               exit(0);
-               }
-
-       if (!strcmp(argv[1], "nodelist")) {
-               display_nodelist();
-               exit(0);
-               }
-
-       if (!strcmp(argv[1], "addnode")) {
-               if (argc < 3) {
-                       display_usage();
-                       exit(1);
-                       }
-               add_node(argv[2]);
-               exit(0);
-               }
-
-       if (!strcmp(argv[1], "deletenode")) {
-               if (argc < 3) {
-                       display_usage();
-                       exit(1);
-                       }
-               delete_node(argv[2]);
-               exit(0);
-               }
-
-       if (!strcmp(argv[1], "roomlist")) {
-               if (argc < 3) {
-                       display_usage();
-                       exit(1);
-                       }
-               do_roomlist(argv[2]);
-               exit(0);
-               }
-
-       if (!strcmp(argv[1], "getcommand")) {
-               if (argc < 3) {
-                       display_usage();
-                       exit(1);
-                       }
-               show_spool_cmd(argv[2]);
-               exit(0);
-               }
-
-       if (!strcmp(argv[1], "setcommand")) {
-               if (argc < 4) {
-                       display_usage();
-                       exit(1);
-                       }
-               set_spool_cmd(argv[2], argv[3]);
-               exit(0);
-               }
-
-       if (!strcmp(argv[1], "share")) {
-               if (argc < 4) {
-                       display_usage();
-                       exit(1);
-                       }
-               add_share(argv[2], argv[3]);
-               exit(0);
-               }
-
-       if (!strcmp(argv[1], "unshare")) {
-               if (argc < 4) {
-                       display_usage();
-                       exit(1);
-                       }
-               remove_share(argv[2], argv[3]);
-               exit(0);
-               }
-
-       display_usage();
-       exit(1);
-       }