]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
kill para_client's interactive mode
authorAndre <maan@p133.(none)>
Sun, 16 Apr 2006 15:56:44 +0000 (17:56 +0200)
committerAndre <maan@p133.(none)>
Sun, 16 Apr 2006 15:56:44 +0000 (17:56 +0200)
Again, it is not worth the compatibility trouble it causes.  It's much
better to implement such functionality with a bash script or similar.

Also, add Gerd Becker to CREDITS and mention that paraslash compiles
under MacOS.

CREDITS
FEATURES
Makefile.in
NEWS
client.c
configure.ac

diff --git a/CREDITS b/CREDITS
index aeb1d2d89a895f895d1e85e2fc2cbe27518467ff..60a0082614f842b0663c37817974f08c71e7828f 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -9,6 +9,8 @@ These people include:
 
 Karl Bartel <karlb@gmx.net> (SFont)
 
+Gerd Becker <gerd.mac@gmx.net> (MacOs testing)
+
 Lorenzo Bettini <bettini@dsi.unifi.it> (gengetopt)
 
 Ricardo Cerqueira <rmc@rccn.net> (mp3info)
index 27bfccda9bfbc50507d1833a9c9e7bc498b8b6c7..ef0b7018ae29244758d4e0195fb3bbcd59769fb4 100644 (file)
--- a/FEATURES
+++ b/FEATURES
@@ -47,13 +47,11 @@ small memory footprint:
        selector, mp3/ogg support, http/dccp/ortp support) is about 110K
        on i386 under Linux. para_audiod is even smaller.
 
-command line interface, including shell:
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-       para_client without arguments starts interactive (shell)
-       mode. Otherwise, command is sent to para_server directly
-       and output is dumped to stdout. This can be used by any
-       scripting language to produce user interfaces with little
-       programming effort.
+command line interface:
+~~~~~~~~~~~~~~~~~~~~~~~
+       paraslash commands are sent to para_server and the response is
+       dumped to stdout. This can be used by any scripting language
+       to produce user interfaces with little programming effort.
 
 authentication/encryption via openssl:
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
index e01f93639b8725b4cdc3d11a51441292ffb0f5a2..7a7fe2e0e9053bf9668bbc1d114ac82452f53a13 100644 (file)
@@ -173,7 +173,7 @@ para_slider: $(slider_objs)
        $(CC) $(slider_objs) -o $@ @GTK_LIBS@ @GLIB_LIBS@ -lzmw
 
 para_client: $(client_objs)
-       $(CC) -o $@ $(client_objs) $(SSL_LDFLAGS) -lreadline -lncurses $(SSL_LIBS)
+       $(CC) -o $@ $(client_objs) $(SSL_LDFLAGS) $(SSL_LIBS)
 
 para_gui: @gui_objs@
        $(CC) -o $@ @gui_objs@ -lncurses
diff --git a/NEWS b/NEWS
index b1e73d4a8847a266431bf33c870fccbb7bf09359..0a653313de4c00c74e9c86a9f973d01287f3a36d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,11 @@ NEWS
 
        o update to gengetopt-2.17
 
+       o para_client no longer depends on libreadline (as the
+       code for the interactive mode was removed).
+
+       o paraslash compiles under Mac Os (thanks to Gerd Becker)
+
 
 0.2.11 (2006-03-11) "atomic duality"
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
index a800f7d86af32e58a5039d4e2c74068f9f6ba077..9b39acd371e9efb36622c9b5b93a51169038a8be 100644 (file)
--- a/client.c
+++ b/client.c
@@ -20,8 +20,6 @@
 
 #include "para.h"
 #include "config.h"
-#include <readline/readline.h>
-#include <readline/history.h>
 #include "client.cmdline.h"
 #include "crypt.h"
 #include "rc4.h"
@@ -29,9 +27,6 @@
 #include "net.h"
 #include "string.h"
 
-/* A static variable for holding the line. */
-static char *line_read;
-
 struct gengetopt_args_info args_info;
 
 /*
@@ -54,29 +49,6 @@ void para_log(int ll, const char* fmt,...)
        va_end(argp);
 }
 
-/*
- * Read a string, and return a pointer to it. Returns NULL on EOF.
- */
-static char *rl_gets(void)
-{
-       free(line_read);
-       /* Get a line from the user. */
-       line_read = readline("para_client> ");
-       /* If the line has any text in it, save it on the history. */
-       if (line_read && *line_read)
-               add_history(line_read);
-       return line_read;
-}
-
-/*
- * do several cleanups on sigint
- */
-static void sigint_handler(__a_unused int i)
-{
-       rl_cleanup_after_signal();
-       rl_reset_after_signal();
-}
-
 void get_options(int argc, char *argv[],
        char **config_file, char **key_file)
 {
@@ -152,7 +124,7 @@ static void append_str(char **data, const char* append)
 int main(int argc, char *argv[])
 {
 
-       int sockfd, numbytes, i, interactive, received, ret;
+       int sockfd, numbytes, i, received, ret;
        struct hostent *he;
        struct sockaddr_in their_addr;
        char *command = NULL;
@@ -160,7 +132,6 @@ int main(int argc, char *argv[])
        char *auth_str;
        char *key_file, *config_file;
        long unsigned challenge_nr;
-       char *line;
 
        get_options(argc, argv, &config_file, &key_file);
        if (args_info.loglevel_arg <= NOTICE)
@@ -176,38 +147,16 @@ int main(int argc, char *argv[])
                args_info.hostname_arg,
                args_info.server_port_arg
        );
-       interactive = args_info.inputs_num == 0? 1 : 0;
-       if (interactive) {
-               PARA_NOTICE_LOG("%s", "no command, entering interactive mode\n");
-               signal(SIGINT, sigint_handler);
-       } else {
-               /* not interactive, concat args */
-               for (i = 0; i < args_info.inputs_num; i++)
-                       append_str(&command, args_info.inputs[i]);
+       if (!args_info.inputs_num) {
+               PARA_ERROR_LOG("%s", "syntax error\n");
+               exit(EXIT_FAILURE);
        }
-interactive_loop:
+       /* concat args */
+       for (i = 0; i < args_info.inputs_num; i++)
+               append_str(&command, args_info.inputs[i]);
+
        crypt_function_recv = NULL;
        crypt_function_send = NULL;
-       if (interactive) {
-               int i = 0;
-               char *p;
-
-               rl_save_prompt();
-               rl_message("\n");
-               rl_kill_full_line(0, 0);
-               rl_free_line_state();
-               /* read a line via readline */
-               line = rl_gets();
-               if (!line)
-                       return 0;
-               if (!line[0])
-                       goto interactive_loop;
-               p = line;
-               while (sscanf(p, "%200s%n", buf, &i) == 1) {
-                       append_str(&command, buf);
-                       p += i;
-               }
-       }
        /* get the host info */
        PARA_NOTICE_LOG("getting host info of %s\n",
                args_info.hostname_arg);
@@ -310,7 +259,5 @@ interactive_loop:
        if (!numbytes)
                PARA_NOTICE_LOG("%s", "connection closed by peer\n");
        close(sockfd);
-       if (interactive)
-               goto interactive_loop;
        return ret >= 0? 0: 1;
 }
index 0c40b4d76bd3cfbf0697a0dbf1c41a2756a4de09..ec30d88b8c4eab9ff28df73c70bcd470fa09406d 100644 (file)
@@ -51,8 +51,6 @@ AC_CHECK_FUNCS([atexit dup2 gethostbyname inet_ntoa memchr memmove memset \
 AC_CHECK_LIB([ncurses], [initscr], [], 
        [AC_MSG_ERROR([libncurses not found])])
 
-AC_CHECK_LIB([readline], [readline], [], 
-       [AC_MSG_ERROR([libreadline not found])])
 AC_CHECK_LIB([menu], [new_menu], [extras="$extras para_dbadm"],
        [AC_MSG_WARN([libmenu not found,  cannot build para_dbadm])])