[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-inetutils] ftp open without args
From: |
Debarshi 'Rishi' Ray |
Subject: |
Re: [bug-inetutils] ftp open without args |
Date: |
Thu, 6 Sep 2007 01:52:23 +0530 |
> By the way, we previously discussed making "open" without any args
> attempt to reopen the host from the command line (or previous open). Is
> this still pending? (If it is, that's fine, of course, just didn't want
> it to have been lost.) In inetutils 1.5, I still get the mysterious
> error:
Here (http://rishi.fedorapeople.org/gnu/ftp-open.diff and inline) is
the latest version of the patch to fix this:
diff -urNp inetutils/ftp/cmds.c inetutils-build/ftp/cmds.c
--- inetutils/ftp/cmds.c 2007-09-05 14:49:19.000000000 +0530
+++ inetutils-build/ftp/cmds.c 2007-09-06 07:00:11.000000000 +0530
@@ -189,7 +189,7 @@ setpeer (argc, argv)
int argc;
char *argv[];
{
- char *host;
+ char *host = NULL;
int port;
if (connected && command ("NOOP") != COMPLETE)
@@ -200,16 +200,29 @@ setpeer (argc, argv)
code = -1;
return;
}
+
if (argc < 2)
- another (&argc, &argv, "to");
+ {
+ if (hostname)
+ {
+ host = hostname;
+ argc = 2;
+ }
+ else
+ another (&argc, &argv, "to");
+ }
+
if (argc < 2 || argc > 3)
{
printf ("usage: %s host-name [port]\n", argv[0]);
code = -1;
return;
}
- port = sp->s_port;
- if (argc > 2)
+
+ if (!host)
+ host = argv[1];
+
+ if (argc == 3)
{
port = atoi (argv[2]);
if (port <= 0 || port > 65535)
@@ -221,7 +234,10 @@ setpeer (argc, argv)
}
port = htons (port);
}
- host = hookup (argv[1], port);
+ else
+ port = sp->s_port;
+
+ host = hookup (host, port);
if (host)
{
int overbose;
@@ -237,7 +253,7 @@ setpeer (argc, argv)
strcpy (structname, "file"), stru = STRU_F;
strcpy (bytename, "8"), bytesize = 8;
if (autologin)
- login (argv[1]);
+ login (host);
#if defined(unix) && NBBY == 8
/*
Here (http://rishi.fedorapeople.org/gnu/ChangeLog and inline) is the
ChangeLog entry:
2007-09-06 Debarshi Ray <address@hidden>
* ftp/cmds.c (setpeer): Initialize host to NULL. Use hostname as
host if 'argc < 2'. Use host instead of argv[1].
Comments?
Happy hacking,
Debarshi
--
GPG key ID: 63D4A5A7
Key server: pgp.mit.edu