[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with ftp from 0.3c to 0.3b



Brian May <bmay@csse.monash.edu.au> writes:
> 1. No newline printed after the prompt.

That's simple enough.  The trivial patch is appended.

> Yes, silly as it might seem,
> there is actually a Debian bug report on this matter - see
> http://bugs.debian.org/64289, as it breaks efs (emacs).
> (also a related? bug report was http://bugs.debian.org/69301).

Sorry for not having looked at the command-line editing stuff 'till
now.  There's a simple patch for adding `-l' appended.  But there
might be more stuff needed to make efs happy?

/assar

rsh: juguete.sics.se: Server not found in Kerberos database
Index: main.c
===================================================================
RCS file: /afs/pdc.kth.se/src/packages/kth-krb/SourceRepository/appl/ftp/ftp/main.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -w -u -w -r1.28 -r1.29
--- main.c	2000/06/21 02:46:10	1.28
+++ main.c	2000/10/04 06:08:54	1.29
@@ -36,7 +36,7 @@
  */
 
 #include "ftp_locl.h"
-RCSID("$Id: main.c,v 1.28 2000/06/21 02:46:10 assar Exp $");
+RCSID("$Id: main.c,v 1.29 2000/10/04 06:08:54 assar Exp $");
 
 int
 main(int argc, char **argv)
@@ -250,8 +250,10 @@
 	if (fromatty) {
 	    char *p;
 	    p = readline("ftp> ");
-	    if(p == NULL)
+	    if(p == NULL) {
+		printf("\n");
 		quit(0, 0);
+	    }
 	    strlcpy(line, p, sizeof(line));
 	    add_history(p);
 	    free(p);

rsh: juguete.sics.se: Server not found in Kerberos database
Index: Makefile.am
===================================================================
RCS file: /afs/pdc.kth.se/src/packages/kth-krb/SourceRepository/appl/ftp/ftp/Makefile.am,v
retrieving revision 1.13
diff -u -w -r1.13 Makefile.am
--- Makefile.am	2000/01/06 15:11:43	1.13
+++ Makefile.am	2000/10/04 06:21:26
@@ -41,6 +41,6 @@
 	$(LIB_gssapi) \
 	$(LIB_krb5) \
 	$(LIB_krb4) \
Index: ftp_var.h
===================================================================
RCS file: /afs/pdc.kth.se/src/packages/kth-krb/SourceRepository/appl/ftp/ftp/ftp_var.h,v
retrieving revision 1.10
diff -u -w -r1.10 ftp_var.h
--- ftp_var.h	2000/06/21 02:46:09	1.10
+++ ftp_var.h	2000/10/04 06:21:26
@@ -52,6 +52,7 @@
 extern int	connected;		/* connected to server */
 extern int	fromatty;		/* input is from a terminal */
 extern int	interactive;		/* interactively prompt on m* cmds */
+extern int	lineedit;		/* use line-editing */
 extern int	debug;			/* debugging level */
 extern int	bell;			/* ring bell on cmd completion */
 extern int	doglob;			/* glob local file names */
Index: globals.c
===================================================================
RCS file: /afs/pdc.kth.se/src/packages/kth-krb/SourceRepository/appl/ftp/ftp/globals.c,v
retrieving revision 1.7
diff -u -w -r1.7 globals.c
--- globals.c	2000/06/21 02:46:09	1.7
+++ globals.c	2000/10/04 06:21:26
@@ -11,6 +11,7 @@
 int	connected;		/* connected to server */
 int	fromatty;		/* input is from a terminal */
 int	interactive;		/* interactively prompt on m* cmds */
+int	lineedit;		/* use line-editing */
 int	debug;			/* debugging level */
 int	bell;			/* ring bell on cmd completion */
 int	doglob;			/* glob local file names */
Index: main.c
===================================================================
RCS file: /afs/pdc.kth.se/src/packages/kth-krb/SourceRepository/appl/ftp/ftp/main.c,v
retrieving revision 1.29
diff -u -w -r1.29 main.c
--- main.c	2000/10/04 06:08:54	1.29
+++ main.c	2000/10/04 06:21:26
@@ -54,10 +54,11 @@
 	doglob = 1;
 	interactive = 1;
 	autologin = 1;
+	lineedit = 1;
 	passivemode = 0; /* passive mode not active */
         use_kerberos = 1;
 
-	while ((ch = getopt(argc, argv, "dginptvK")) != -1) {
+	while ((ch = getopt(argc, argv, "dgilnptvK")) != -1) {
 		switch (ch) {
 		case 'd':
 			options |= SO_DEBUG;
@@ -72,6 +73,9 @@
 			interactive = 0;
 			break;
 
+		case 'l':
+			lineedit = 0;
+			break;
 		case 'n':
 			autologin = 0;
 			break;
@@ -94,7 +98,7 @@
 
 		default:
 		    fprintf(stderr,
-                            "usage: ftp [-dginptvK] [host [port]]\n");
+                            "usage: ftp [-dgilnptvK] [host [port]]\n");
 		    exit(1);
 		}
 	}
@@ -206,10 +210,8 @@
 }
 */
 
-#ifndef HAVE_READLINE
-
 static char *
-readline(char *prompt)
+simple_readline(char *prompt)
 {
     char buf[BUFSIZ];
     printf ("%s", prompt);
@@ -221,6 +223,14 @@
     return strdup(buf);
 }
 
+#ifndef HAVE_READLINE
+
+static char *
+readline(char *prompt)
+{
+    return simple_readline (prompt);
+}
+
 static void
 add_history(char *p)
 {
@@ -249,12 +259,16 @@
     for (;;) {
 	if (fromatty) {
 	    char *p;
+	    if (lineedit)
 	    p = readline("ftp> ");
+	    else
+		p = simple_readline("ftp> ");
 	    if(p == NULL) {
 		printf("\n");
 		quit(0, 0);
 	    }
 	    strlcpy(line, p, sizeof(line));
+	    if (lineedit)
 	    add_history(p);
 	    free(p);
 	} else{