commit-inetutils
[Top][All Lists]
Advanced

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

[SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-49-g69a862


From: Mats Erik Andersson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-49-g69a8622
Date: Fri, 02 Mar 2012 20:30:48 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  69a8622c614be88cbbb8552fd6a2a92384e8fc22 (commit)
      from  590fde5934de486865b0eee54e4f1a93de2a549b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=69a8622c614be88cbbb8552fd6a2a92384e8fc22


commit 69a8622c614be88cbbb8552fd6a2a92384e8fc22
Author: Mats Erik Andersson <address@hidden>
Date:   Fri Mar 2 21:23:12 2012 +0100

    ftp: Relax need for service lookup.

diff --git a/ChangeLog b/ChangeLog
index 207eb84..55949bc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2012-03-02  Mats Erik Andersson <address@hidden>
+
+       Make service lookup optional in FTP client.
+       * ftp/cmds.h [!DEFPORT] (DEFPORT): New macro.  Define as IPPORT_FTP
+       if available, otherwise as 21.
+       (another): Condition call to add_history() on FROMATTY.
+       (setpeer): Call getservbyname() for `ftp/tcp'.  Set port if successful;
+       use DEFPORT otherwise.
+       * ftp/ftp_var.h (sp): Remove external variable.
+       * ftp/main.c (main): Remove call to getservbyname() and the use of SP.
+       (cmdscanner): Condition call to add_history() on FROMATTY.
+
 2012-03-01  Mats Erik Andersson <address@hidden>
 
        Subtests for SIGHUP reaction of `inetd' and `syslogd'.
diff --git a/ftp/cmds.c b/ftp/cmds.c
index 5f9fa7b..07a8252 100644
--- a/ftp/cmds.c
+++ b/ftp/cmds.c
@@ -83,6 +83,14 @@
 #include "ftp_var.h"
 #include "unused-parameter.h"
 
+#ifndef DEFPORT
+# ifdef IPPORT_FTP
+#  define DEFPORT IPPORT_FTP
+# else /* !IPPORT_FTP */
+#  define DEFPORT 21
+# endif
+#endif /* !DEFPORT */
+
 /* Returns true if STR is entirely lower case.  */
 static int
 all_lower (char *str)
@@ -143,7 +151,7 @@ another (int *pargc, char ***pargv, const char *prompt)
   arg = readline (buffer);
   free (buffer);
 
-  if (arg && *arg)
+  if (fromatty && arg && *arg)
     add_history (arg);
 
   if (!arg)
@@ -224,7 +232,12 @@ setpeer (int argc, char **argv)
        }
     }
   else
-    port = ntohs (sp->s_port);
+    {
+      struct servent *sp;
+
+      sp = getservbyname ("ftp", "tcp");
+      port = (sp) ? ntohs (sp->s_port) : DEFPORT;
+    }
 
   host = hookup (host, port);
   if (host)
diff --git a/ftp/ftp_var.h b/ftp/ftp_var.h
index 5b95048..6afa945 100644
--- a/ftp/ftp_var.h
+++ b/ftp/ftp_var.h
@@ -110,8 +110,6 @@ FTP_EXTERN char *hostname;  /* name of host connected to */
 FTP_EXTERN int unix_server;    /* server is unix, can use binary for ascii */
 FTP_EXTERN int unix_proxy;     /* proxy is unix, can use binary for ascii */
 
-FTP_EXTERN struct servent *sp; /* service spec for tcp/ftp */
-
 FTP_EXTERN jmp_buf toplevel;   /* non-local goto stuff for cmd scanner */
 
 FTP_EXTERN char *line;
diff --git a/ftp/main.c b/ftp/main.c
index 9ef9f79..2b6e92a 100644
--- a/ftp/main.c
+++ b/ftp/main.c
@@ -195,10 +195,6 @@ main (int argc, char *argv[])
   argc -= index;
   argv += index;
 
-  sp = getservbyname ("ftp", "tcp");
-  if (sp == 0)
-    error (EXIT_FAILURE, 0, "ftp/tcp: unknown service");
-
   fromatty = isatty (fileno (stdin));
   if (fromatty)
     {
@@ -343,7 +339,7 @@ cmdscanner (int top)
          break;
        }
 
-      if (line && *line)
+      if (fromatty && line && *line)
        add_history (line);
 
       if (l == 0)

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog     |   12 ++++++++++++
 ftp/cmds.c    |   17 +++++++++++++++--
 ftp/ftp_var.h |    2 --
 ftp/main.c    |    6 +-----
 4 files changed, 28 insertions(+), 9 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]