From MAILER-DAEMON Thu Dec 06 16:26:24 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Tgixc-0004Zi-9R
	for mharc-commit-inetutils@gnu.org; Thu, 06 Dec 2012 16:26:24 -0500
Received: from eggs.gnu.org ([208.118.235.92]:50348)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TgixW-0004YO-3c
	for commit-inetutils@gnu.org; Thu, 06 Dec 2012 16:26:22 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TgixQ-0008Ei-UO
	for commit-inetutils@gnu.org; Thu, 06 Dec 2012 16:26:18 -0500
Received: from vcs.savannah.gnu.org ([140.186.70.72]:44031)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TgixQ-0008Eb-Pr
	for commit-inetutils@gnu.org; Thu, 06 Dec 2012 16:26:12 -0500
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1TgixP-0005BR-NL
	for commit-inetutils@gnu.org; Thu, 06 Dec 2012 21:26:12 +0000
Date: Thu, 06 Dec 2012 21:26:11 +0000
Message-Id: <E1TgixP-0005BR-NL@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1-221-g188433b
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 150fca45402469de012f4bd9f64bd8ca5b2e89f2
X-Git-Newrev: 188433bc0760e8ea8f2947831d1a53b78bc523e5
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 06 Dec 2012 21:26:22 -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  188433bc0760e8ea8f2947831d1a53b78bc523e5 (commit)
       via  72e61402af942ed672b3dd6e937aa4854db330ae (commit)
       via  0d19e38f4f71e2137d88b4aafa917f519fc70e9d (commit)
       via  065f43884cfbc7ba1dc7639d4bd87a650fa05b33 (commit)
      from  150fca45402469de012f4bd9f64bd8ca5b2e89f2 (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=188433bc0760e8ea8f2947831d1a53b78bc523e5


commit 188433bc0760e8ea8f2947831d1a53b78bc523e5
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Thu Dec 6 14:32:41 2012 +0100

    ifconfig: Protect interface flag operations.
    
    Cover many compiler warnings in ifconfig.

diff --git a/ChangeLog b/ChangeLog
index 8665f35..483ecc6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,69 @@
+2012-12-06  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	ifconfig: Allow `--up', `--down' to be used before
+	interface selection.  Applies to all flags.
+
+	* ifconfig/options.c (pending_setflags, pending_clrflags):
+	New variables.
+	(parse_opt_set_flag): Use parameters to manipulate only
+	pending_setflags and pending_clrflags, not `ifp->*flags',
+	since the latter need not be allocated.
+	(parse_opt_finalize): Assign values to `ifp->setflags'
+	and `ifp->clrflags' using `pending_*flags'.
+	* ifconfig/options.h (pending_setflags, pending_clrflags):
+	New external declarations.
+
+	Detect member `struct ifreq.ifr_mtu'.
+
+	* configure.ac (HAVE_STRUCT_IFREQ_IFR_MTU): Check for
+	member ifr_mtu in `struct ifreq'.
+	* ifconfig/system/solaris.h (ifr_mtu)
+	[!HAVE_STRUCT_IFREQ_IFR_MTU]: Protect macro definition.
+
+	ifconfig: Attend to many compiler warnings.
+
+	* ifconfig/flags.c (if_flags): Set member `rev' to 0,
+	whenever it was missing.  Remove duplicate elements
+	"OACTIVE" and "D2".  End array with full element.
+	(flag_char_tab): End array with full stop element.
+	* ifconfig/options.c: Include <unused-parameter.h>.
+	(ifconfig_initializer): Initialize all members.
+	(formats): End array with full stop element.
+	(argp_options): New local macro GRP.  Add GRP to every
+	element.  Add description to `peer' and `brdaddr'.
+	End array with full stop element.
+	(parse_opt_set_flag): Mark ifp as unused.
+	(default_help_filter): Mark input as unused.
+	(argp): Add NULL as missing, last element.
+	* ifconfig/printif.c: Include <unused-parameter.h>.
+	(put_char, put_int, put_ulong): Mark form as unused.
+	(put_flags_short): Mark argc and argv as unused.
+	(fh_nothing): Mark all parameters as unused.
+	(fh_newline, fh_tabulator, fh_progname, fh_name)
+	(fh_index): Mark argc and argv as unused.
+	(fh_exit): Mark form as unused.
+
+	* ifconfig/system/bsd.c: Include <unused-parameter.h>.
+	(system_parse_opt, system_configure): Mark all parameters
+	as unused.
+	(system_fh_hwaddr, system_fh_hwtype): Mark argc and argv
+	as unused.
+
+	* ifconfig/system/linux.c: Include <unused-parameter.h>.
+	(print_hwaddr_ether, print_hwaddr_arcnet, print_hwaddr_dlci)
+	(print_hwaddr_irda, print_hwaddr_rose): Mark form as unused.
+	Set had_output.
+	(print_hwaddr_ax25): Set had_output.
+	(system_fh_hwaddr, system_hw_type): Mark argc and argv as unused.
+	(linux_argp_options): Add group member to element "txqlen".
+	End array with full stop element.
+	(linux_argp): Fill missing members with NULL.
+
+	* ifconfig/system/solaris.c: Include <unused-parameter.h>.
+	(system_parse_opt): Mark all parameters as unused.
+	(system_configure) [!IF_VALID_TXQLEN]: Trivially use
+	paramaters sfd, ifr, and ifs.
+
 2012-12-04  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	* ifconfig/system/bsd.c (system_help): Update.
diff --git a/configure.ac b/configure.ac
index 9ecc492..c94e996 100644
--- a/configure.ac
+++ b/configure.ac
@@ -694,12 +694,13 @@ if test "$ac_cv_header_utmpx_h" = yes; then
 fi
 
 IU_CHECK_MEMBERS([struct ifreq.ifr_index,
-                  struct ifreq.ifr_netmask,
-                  struct ifreq.ifr_broadaddr,
+		  struct ifreq.ifr_netmask,
+		  struct ifreq.ifr_broadaddr,
+		  struct ifreq.ifr_mtu,
 		  struct ifreq.ifr_map], , ,
-                 [#include <sys/types.h>
-                  #include <sys/socket.h>
-                  #include <net/if.h>])
+		 [#include <sys/types.h>
+		  #include <sys/socket.h>
+		  #include <net/if.h>])
 
 IU_CHECK_MEMBERS([struct sockaddr.sa_len], , ,
                  [#include <sys/types.h>
diff --git a/ifconfig/flags.c b/ifconfig/flags.c
index 6dcd3cc..6d5a573 100644
--- a/ifconfig/flags.c
+++ b/ifconfig/flags.c
@@ -46,179 +46,173 @@ struct if_flag
        10.20 and OSF 4.0g.  */
 
 #ifdef IFF_UP			/* Interface is up.  */
-    {"UP", IFF_UP},
+    {"UP", IFF_UP, 0},
 #endif
 #ifdef IFF_BROADCAST		/* Broadcast address is valid.  */
-    {"BROADCAST", IFF_BROADCAST},
+    {"BROADCAST", IFF_BROADCAST, 0},
 #endif
 #ifdef IFF_DEBUG		/* Debugging is turned on.  */
-    {"DEBUG", IFF_DEBUG},
+    {"DEBUG", IFF_DEBUG, 0},
 #endif
 #ifdef IFF_LOOPBACK		/* Is a loopback net.  */
-    {"LOOPBACK", IFF_LOOPBACK},
+    {"LOOPBACK", IFF_LOOPBACK, 0},
 #endif
 #ifdef IFF_POINTOPOINT		/* Interface is a point-to-point link.  */
-    {"POINTOPOINT", IFF_POINTOPOINT},
+    {"POINTOPOINT", IFF_POINTOPOINT, 0},
 #endif
 #ifdef IFF_RUNNING		/* Resources allocated.  */
-    {"RUNNING", IFF_RUNNING},
+    {"RUNNING", IFF_RUNNING, 0},
 #endif
 #ifdef IFF_NOARP		/* No address resolution protocol.  */
-    {"NOARP", IFF_NOARP},
+    {"NOARP", IFF_NOARP, 0},
     {"ARP", IFF_NOARP, 1},
 #endif
 #ifdef IFF_PROMISC		/* Receive all packets.  */
-    {"PROMISC", IFF_PROMISC},
+    {"PROMISC", IFF_PROMISC, 0},
 #endif
 #ifdef IFF_ALLMULTI		/* Receive all multicast packets.  */
-    {"ALLMULTI", IFF_ALLMULTI},
+    {"ALLMULTI", IFF_ALLMULTI, 0},
 #endif
 #ifdef IFF_MULTICAST		/* Supports multicast.  */
-    {"MULTICAST", IFF_MULTICAST},
+    {"MULTICAST", IFF_MULTICAST, 0},
 #endif
     /* Usually available on all systems which derive the network
        interface from BSD (see above), but with exceptions noted.  */
 #ifdef IFF_NOTRAILERS		/* Avoid use of trailers.  */
     /* Obsoleted on FreeBSD systems.  */
-    {"NOTRAILERS", IFF_NOTRAILERS},
+    {"NOTRAILERS", IFF_NOTRAILERS, 0},
     {"TRAILERS", IFF_NOTRAILERS, 1},
 #endif
     /* Available on GNU and Linux systems.  */
 #ifdef IFF_MASTER		/* Master of a load balancer.  */
-    {"MASTER", IFF_MASTER},
+    {"MASTER", IFF_MASTER, 0},
 #endif
 #ifdef IFF_SLAVE		/* Slave of a load balancer.  */
-    {"SLAVE", IFF_SLAVE},
+    {"SLAVE", IFF_SLAVE, 0},
 #endif
 #ifdef IFF_PORTSEL		/* Can set media type.  */
-    {"PORTSEL", IFF_PORTSEL},
+    {"PORTSEL", IFF_PORTSEL, 0},
 #endif
 #ifdef IFF_AUTOMEDIA		/* Auto media select is active.  */
-    {"AUTOMEDIA", IFF_AUTOMEDIA},
+    {"AUTOMEDIA", IFF_AUTOMEDIA, 0},
 #endif
     /* Available on Linux 2.4 systems (not glibc <= 2.2.1).  */
 #ifdef IFF_DYNAMIC		/* Dialup service with hanging addresses.  */
-    {"DYNAMIC", IFF_DYNAMIC},
+    {"DYNAMIC", IFF_DYNAMIC, 0},
 #endif
     /* Available on FreeBSD and OSF 4.0g systems.  */
 #ifdef IFF_OACTIVE		/* Transmission is in progress.  */
-    {"OACTIVE", IFF_OACTIVE},
+    {"OACTIVE", IFF_OACTIVE, 0},
 #endif
 #ifdef IFF_SIMPLEX		/* Can't hear own transmissions.  */
-    {"SIMPLEX", IFF_SIMPLEX},
+    {"SIMPLEX", IFF_SIMPLEX, 0},
 #endif
     /* Available on FreeBSD systems.  */
 #ifdef IFF_LINK0		/* Per link layer defined bit.  */
-    {"LINK0", IFF_LINK0},
+    {"LINK0", IFF_LINK0, 0},
 #endif
 #ifdef IFF_LINK1		/* Per link layer defined bit.  */
-    {"LINK1", IFF_LINK1},
+    {"LINK1", IFF_LINK1, 0},
 #endif
 #if defined IFF_LINK2 && defined IFF_ALTPHYS
 # if IFF_LINK2 == IFF_ALTPHYS
     /* IFF_ALTPHYS == IFF_LINK2 on FreeBSD.  This entry is used as a
        fallback for if_flagtoname conversion, if no relevant EXPECT_
        macro is specified to figure out which one is meant.  */
-    {"LINK2/ALTPHYS", IFF_LINK2},
+    {"LINK2/ALTPHYS", IFF_LINK2, 0},
 # endif
 #endif
 #ifdef IFF_LINK2		/* Per link layer defined bit.  */
-    {"LINK2", IFF_LINK2},
+    {"LINK2", IFF_LINK2, 0},
 #endif
 #ifdef IFF_ALTPHYS		/* Use alternate physical connection.  */
-    {"ALTPHYS", IFF_ALTPHYS},
+    {"ALTPHYS", IFF_ALTPHYS, 0},
 #endif
     /* Available on Solaris 2.7 systems.  */
 #ifdef IFF_INTELLIGENT		/* Protocol code on board.  */
-    {"INTELLIGENT", IFF_INTELLIGENT},
+    {"INTELLIGENT", IFF_INTELLIGENT, 0},
 #endif
 #ifdef IFF_MULTI_BCAST		/* Multicast using broadcast address.  */
-    {"MULTI_BCAST", IFF_MULTI_BCAST},
+    {"MULTI_BCAST", IFF_MULTI_BCAST, 0},
 #endif
 #ifdef IFF_UNNUMBERED		/* Address is not unique.  */
-    {"UNNUMBERED", IFF_UNNUMBERED},
+    {"UNNUMBERED", IFF_UNNUMBERED, 0},
 #endif
 #ifdef IFF_DHCPRUNNING		/* Interface is under control of DHCP.  */
-    {"DHCPRUNNING", IFF_DHCPRUNNING},
+    {"DHCPRUNNING", IFF_DHCPRUNNING, 0},
 #endif
 #ifdef IFF_PRIVATE		/* Do not advertise.  */
-    {"PRIVATE", IFF_PRIVATE},
+    {"PRIVATE", IFF_PRIVATE, 0},
 #endif
     /* Available on HP-UX 10.20 systems.  */
 #ifdef IFF_NOTRAILERS		/* Avoid use of trailers.  */
-    {"NOTRAILERS", IFF_NOTRAILERS},
+    {"NOTRAILERS", IFF_NOTRAILERS, 0},
     {"TRAILERS", IFF_NOTRAILERS, 1},
 #endif
 #ifdef IFF_LOCALSUBNETS		/* Subnets of this net are local.  */
-    {"LOCALSUBNETS", IFF_LOCALSUBNETS},
+    {"LOCALSUBNETS", IFF_LOCALSUBNETS, 0},
 #endif
 #ifdef IFF_CKO			/* Interface supports header checksum.  */
-    {"CKO", IFF_CKO},
+    {"CKO", IFF_CKO, 0},
 #endif
 #ifdef IFF_NOACC		/* No data access on outbound.  */
-    {"NOACC", IFF_NOACC},
+    {"NOACC", IFF_NOACC, 0},
     {"ACC", IFF_NOACC, 1},
 #endif
-#ifdef IFF_OACTIVE		/* Transmission in progress.  */
-    {"OACTIVE", IFF_OACTIVE},
-#endif
 #ifdef IFF_NOSR8025		/* No source route 802.5.  */
-    {"NOSR8025", IFF_NOSR8025},
+    {"NOSR8025", IFF_NOSR8025, 0},
     {"SR8025", IFF_NOSR8025, 1},
 #endif
 #ifdef IFF_CKO_ETC		/* Interface supports trailer checksum.  */
-    {"CKO_ETC", IFF_CKO_ETC},
+    {"CKO_ETC", IFF_CKO_ETC, 0},
 #endif
 #ifdef IFF_AR_SR8025		/* All routes broadcast for ARP 8025.  */
-    {"AR_SR8025", IFF_AR_SR8025},
+    {"AR_SR8025", IFF_AR_SR8025, 0},
 #endif
 #ifdef IFF_ALT_SR8025		/* Alternating no rif, rif for ARP on.  */
-    {"ALT_SR8025", IFF_ALT_SR8025},
+    {"ALT_SR8025", IFF_ALT_SR8025, 0},
 #endif
     /* Defined on OSF 4.0g systems.  */
 #ifdef IFF_PFCOPYALL		/* PFILT gets packets to this host.  */
-    {"PFCOPYALL", IFF_PFCOPYALL},
+    {"PFCOPYALL", IFF_PFCOPYALL, 0},
 #endif
 #ifdef IFF_UIOMOVE		/* DART.  */
-    {"UIOMOVE", IFF_UIOMOVE},
+    {"UIOMOVE", IFF_UIOMOVE, 0},
 #endif
 #ifdef IFF_PKTOK		/* DART.  */
-    {"PKTOK", IFF_PKTOK},
+    {"PKTOK", IFF_PKTOK, 0},
 #endif
 #ifdef IFF_SOCKBUF		/* DART.  */
-    {"SOCKBUF", IFF_SOCKBUF},
+    {"SOCKBUF", IFF_SOCKBUF, 0},
 #endif
 #ifdef IFF_VAR_MTU		/* Interface supports variable MTUs.  */
-    {"VAR_MTU", IFF_VAR_MTU},
+    {"VAR_MTU", IFF_VAR_MTU, 0},
 #endif
 #ifdef IFF_NOCHECKSUM		/* No checksums needed (reliable media).  */
-    {"NOCHECKSUM", IFF_NOCHECKSUM},
+    {"NOCHECKSUM", IFF_NOCHECKSUM, 0},
     {"CHECKSUM", IFF_NOCHECKSUM, 1},
 #endif
 #ifdef IFF_MULTINET		/* Multiple networks on interface.  */
-    {"MULTINET", IFF_MULTINET},
+    {"MULTINET", IFF_MULTINET, 0},
 #endif
 #ifdef IFF_VMIFNET		/* Used to identify a virtual MAC address.  */
-    {"VMIFNET", IFF_VMIFNET},
+    {"VMIFNET", IFF_VMIFNET, 0},
 #endif
 #if defined IFF_D1 && defined IFF_SNAP
 # if IFF_D1 == IFF_SNAP
     /* IFF_SNAP == IFF_D1 on OSF 4.0g systems.  This entry is used as a
        fallback for if_flagtoname conversion, if no relevant EXPECT_
        macro is specified to figure out which one is meant.  */
-    {"D1/SNAP", IFF_D2},
+    {"D1/SNAP", IFF_D2, 0},
 # endif
 #endif
 #ifdef IFF_D2			/* Flag is specific to device.  */
-    {"D2", IFF_D2},
+    {"D2", IFF_D2, 0},
 #endif
 #ifdef IFF_SNAP			/* Ethernet driver outputs SNAP header.  */
-    {"SNAP", IFF_SNAP},
-#endif
-#ifdef IFF_D2			/* Flag is specific to device.  */
-    {"D2", IFF_D2},
+    {"SNAP", IFF_SNAP, 0},
 #endif
-    { NULL }
+    { NULL, 0, 0}
   };
 
 static int
@@ -434,7 +428,7 @@ static struct if_flag_char flag_char_tab[] = {
 #ifdef IFF_UP
   { IFF_UP,          'U' },
 #endif
-  { 0 }
+  { 0, 0 }
 };
 
 void
diff --git a/ifconfig/ifconfig.c b/ifconfig/ifconfig.c
index 9cef95f..a8abdb1 100644
--- a/ifconfig/ifconfig.c
+++ b/ifconfig/ifconfig.c
@@ -72,7 +72,7 @@ main (int argc, char *argv[])
 	    continue;
 
 	  /* Use ERR as a marker of previous output.
-	   * It will never mix with a call to configure_if().  */
+	   * It will never interfere with a call to configure_if().  */
 	  if (err++)
 	    putchar (' ');
 	  printf ("%s", ifp->name);
diff --git a/ifconfig/options.c b/ifconfig/options.c
index 095d566..c49163d 100644
--- a/ifconfig/options.c
+++ b/ifconfig/options.c
@@ -37,6 +37,9 @@
 
 #include <sys/socket.h>
 #include <net/if.h>
+
+#include <unused-parameter.h>
+
 #include "ifconfig.h"
 
 /* List available interfaces.  */
@@ -45,6 +48,10 @@ int list_mode;
 /* Be verbose about actions.  */
 int verbose;
 
+/* Flags asked for, possibly still pending application.  */
+int pending_setflags;
+int pending_clrflags;
+
 /* Array of all interfaces on the command line.  */
 struct ifconfig *ifs;
 
@@ -54,6 +61,7 @@ int nifs;
 static struct ifconfig ifconfig_initializer = {
   NULL,				/* name */
   0,				/* valid */
+  NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, 0
 };
 
 struct format formats[] = {
@@ -190,7 +198,7 @@ struct format formats[] = {
    "${newline}"
    "}"
    "${exit}{0}"},
-  {0, 0}
+  {NULL, NULL, NULL}
 };
 
 /* Default format.  */
@@ -208,39 +216,43 @@ enum {
 };
 
 static struct argp_option argp_options[] = {
+#define GRP 10
   { "verbose", 'v', NULL, 0,
-    "output information when configuring interface" },
+    "output information when configuring interface", GRP },
   { "all", 'a', NULL, 0,
-    "display all available interfaces" },
+    "display all available interfaces", GRP },
   { "interface", 'i', "NAME", 0,
-    "configure network interface NAME" },
+    "configure network interface NAME", GRP },
   { "address", 'A', "ADDR", 0,
-    "set interface address to ADDR" },
+    "set interface address to ADDR", GRP },
   { "netmask", 'm', "MASK", 0,
-    "set netmask to MASK" },
+    "set netmask to MASK", GRP },
   { "dstaddr", 'd', "ADDR", 0,
-    "set destination (peer) address to ADDR" },
-  { "peer", 'p', "ADDR", OPTION_ALIAS },
+    "set destination (peer) address to ADDR", GRP },
+  { "peer", 'p', "ADDR", OPTION_ALIAS,
+    "synonym for dstaddr", GRP },
   { "broadcast", 'B', "ADDR", 0,
-    "set broadcast address to ADDR" },
-  { "brdaddr", 'b', NULL, OPTION_ALIAS, }, /* FIXME: Do we really need it? */
+    "set broadcast address to ADDR", GRP },
+  { "brdaddr", 'b', NULL, OPTION_ALIAS,
+    "synonym for broadcast", GRP }, /* FIXME: Do we really need it? */
   { "mtu", 'M', "N", 0,
-    "set mtu of interface to N" },
+    "set mtu of interface to N", GRP },
   { "metric", METRIC_OPTION, "N", 0,
-    "set metric of interface to N" },
+    "set metric of interface to N", GRP },
   { "format", FORMAT_OPTION, "FORMAT", 0,
-    "select output format; set to `help' for info" },
+    "select output format; set to `help' for info", GRP },
   { "up", UP_OPTION, NULL, 0,
-    "activate the interface (default if address is given)" },
+    "activate the interface (default if address is given)", GRP },
   { "down", DOWN_OPTION, NULL, 0,
-    "shut the interface down" },
+    "shut the interface down", GRP },
   { "flags", 'F', "FLAG[,FLAG...]", 0,
-    "set interface flags" },
+    "set interface flags", GRP },
   { "list", 'l', NULL, 0,
-    "list available or selected interfaces" },
+    "list available or selected interfaces", GRP },
   { "short", 's', NULL, 0,
-    "short output format" },
-  { NULL }
+    "short output format", GRP },
+#undef GRP
+  { NULL, 0, NULL, 0, NULL, 0 }
 };
 
 const char doc[] = "Configure network interfaces.";
@@ -337,12 +349,19 @@ void parse_opt_set_af (struct ifconfig *ifp, char *af)
 }
 
 void
-parse_opt_set_flag (struct ifconfig *ifp, int flag, int rev)
+parse_opt_set_flag (struct ifconfig *ifp _GL_UNUSED_PARAMETER,
+		    int flag, int rev)
 {
   if (rev)
-    ifp->clrflags |= flag;
+    {
+      pending_clrflags |= flag;
+      pending_setflags &= ~flag;
+    }
   else
-    ifp->setflags |= flag;
+    {
+      pending_setflags |= flag;
+      pending_clrflags &= ~flag;
+    }
 }
 
 void
@@ -452,6 +471,8 @@ parse_opt_finalize (struct ifconfig *ifp)
     {
       ifp->valid = IF_VALID_FORMAT;
       ifp->format = default_format;
+      ifp->setflags |= pending_setflags;
+      ifp->clrflags |= pending_clrflags;
     }
 }
 
@@ -541,7 +562,8 @@ parse_opt (int key, char *arg, struct argp_state *state)
 }
 
 static char *
-default_help_filter (int key, const char *text, void *input)
+default_help_filter (int key, const char *text,
+		     void *input _GL_UNUSED_PARAMETER)
 {
   char *s;
 
@@ -565,7 +587,8 @@ static struct argp argp =
     NULL,
     doc,
     NULL,
-    default_help_filter
+    default_help_filter,
+    NULL
   };
 
 static int
diff --git a/ifconfig/options.h b/ifconfig/options.h
index bc2060d..1cbfdb7 100644
--- a/ifconfig/options.h
+++ b/ifconfig/options.h
@@ -65,6 +65,9 @@ extern struct format formats[];
 extern int all_option;
 extern int ifs_cmdline;
 
+extern int pending_setflags;
+extern int pending_clrflags;
+
 /* Array of interfaces mentioned on the command line.  */
 extern struct ifconfig *ifs;
 extern int nifs;
diff --git a/ifconfig/printif.c b/ifconfig/printif.c
index e41582c..5dbd8c5 100644
--- a/ifconfig/printif.c
+++ b/ifconfig/printif.c
@@ -47,6 +47,7 @@
 #include <arpa/inet.h>
 #include "ifconfig.h"
 #include "xalloc.h"
+#include <unused-parameter.h>
 
 FILE *ostream;			/* Either stdout or stderror.  */
 int column_stdout;		/* The column position of the cursor on stdout.  */
@@ -114,7 +115,7 @@ struct format_handle format_handles[] = {
 /* Various helper functions to get the job done.  */
 
 void
-put_char (format_data_t form, char c)
+put_char (format_data_t form _GL_UNUSED_PARAMETER, char c)
 {
   switch (c)
     {
@@ -142,7 +143,8 @@ put_string (format_data_t form, const char *s)
 }
 
 void
-put_int (format_data_t form, int argc, char *argv[], int nr)
+put_int (format_data_t form _GL_UNUSED_PARAMETER,
+	 int argc, char *argv[], int nr)
 {
   char *fmt;
   if (argc > 0)
@@ -198,7 +200,8 @@ put_int (format_data_t form, int argc, char *argv[], int nr)
 }
 
 void
-put_ulong (format_data_t form, int argc, char *argv[], unsigned long value)
+put_ulong (format_data_t form _GL_UNUSED_PARAMETER,
+	   int argc, char *argv[], unsigned long value)
 {
   char *fmt;
   if (argc > 0)
@@ -337,7 +340,8 @@ put_flags (format_data_t form, int argc, char *argv[], short flags)
 }
 
 void
-put_flags_short (format_data_t form, int argc, char *argv[], short flags)
+put_flags_short (format_data_t form, int argc _GL_UNUSED_PARAMETER,
+		 char *argv[] _GL_UNUSED_PARAMETER, short flags)
 {
   char buf[IF_FORMAT_FLAGS_BUFSIZE];
   if_format_flags (flags, buf, sizeof buf);
@@ -368,7 +372,9 @@ format_handler (const char *name, format_data_t form, int argc, char *argv[])
 }
 
 void
-fh_nothing (format_data_t form, int argc, char *argv[])
+fh_nothing (format_data_t form _GL_UNUSED_PARAMETER,
+	    int argc _GL_UNUSED_PARAMETER,
+	    char *argv[] _GL_UNUSED_PARAMETER)
 {
 }
 
@@ -427,13 +433,15 @@ fh_foreachformat (format_data_t form, int argc, char *argv[])
 }
 
 void
-fh_newline (format_data_t form, int argc, char *argv[])
+fh_newline (format_data_t form, int argc _GL_UNUSED_PARAMETER,
+	    char *argv[] _GL_UNUSED_PARAMETER)
 {
   put_char (form, '\n');
 }
 
 void
-fh_tabulator (format_data_t form, int argc, char *argv[])
+fh_tabulator (format_data_t form, int argc _GL_UNUSED_PARAMETER,
+	      char *argv[] _GL_UNUSED_PARAMETER)
 {
   put_char (form, '\t');
 }
@@ -588,13 +596,15 @@ fh_error (format_data_t form, int argc, char *argv[])
 }
 
 void
-fh_progname (format_data_t form, int argc, char *argv[])
+fh_progname (format_data_t form, int argc _GL_UNUSED_PARAMETER,
+	     char *argv[] _GL_UNUSED_PARAMETER)
 {
   put_string (form, program_name);
 }
 
 void
-fh_exit (format_data_t form, int argc, char *argv[])
+fh_exit (format_data_t form _GL_UNUSED_PARAMETER,
+	 int argc, char *argv[])
 {
   int err = 0;
 
@@ -605,7 +615,8 @@ fh_exit (format_data_t form, int argc, char *argv[])
 }
 
 void
-fh_name (format_data_t form, int argc, char *argv[])
+fh_name (format_data_t form, int argc _GL_UNUSED_PARAMETER,
+	 char *argv[] _GL_UNUSED_PARAMETER)
 {
   put_string (form, form->name);
 }
@@ -617,7 +628,8 @@ fh_index_query (format_data_t form, int argc, char *argv[])
 }
 
 void
-fh_index (format_data_t form, int argc, char *argv[])
+fh_index (format_data_t form, int argc _GL_UNUSED_PARAMETER,
+	  char *argv[] _GL_UNUSED_PARAMETER)
 {
   int indx = if_nametoindex (form->name);
 
diff --git a/ifconfig/system/bsd.c b/ifconfig/system/bsd.c
index 59a792a..adf8945 100644
--- a/ifconfig/system/bsd.c
+++ b/ifconfig/system/bsd.c
@@ -28,6 +28,8 @@
 #include <net/if_dl.h>
 #include <netinet/if_ether.h>
 #include <ifaddrs.h>
+
+#include <unused-parameter.h>
 
 
 /* Output format stuff.  */
@@ -44,7 +46,9 @@ NAME [ADDR [DSTADDR]] [broadcast BRDADDR] [netmask MASK] "
 struct argp_child system_argp_child;
 
 int
-system_parse_opt (struct ifconfig **ifp, char option, char *optarg)
+system_parse_opt (struct ifconfig **ifp _GL_UNUSED_PARAMETER,
+		  char option _GL_UNUSED_PARAMETER,
+		  char *optarg _GL_UNUSED_PARAMETER)
 {
   return 0;
 }
@@ -139,7 +143,9 @@ system_parse_opt_rest (struct ifconfig **ifp, int argc, char *argv[])
 }
 
 int
-system_configure (int sfd, struct ifreq *ifr, struct system_ifconfig *ifs)
+system_configure (int sfd _GL_UNUSED_PARAMETER,
+		  struct ifreq *ifr _GL_UNUSED_PARAMETER,
+		  struct system_ifconfig *ifs _GL_UNUSED_PARAMETER)
 {
   return 0;
 }
@@ -184,7 +190,8 @@ system_fh_hwaddr_query (format_data_t form, int argc, char *argv[])
 }
 
 void
-system_fh_hwaddr (format_data_t form, int argc, char *argv[])
+system_fh_hwaddr (format_data_t form, int argc _GL_UNUSED_PARAMETER,
+		  char *argv[] _GL_UNUSED_PARAMETER)
 {
   ESTABLISH_IFADDRS
   if (!ifp)
@@ -223,7 +230,8 @@ system_fh_hwtype_query (format_data_t form, int argc, char *argv[])
 }
 
 void
-system_fh_hwtype (format_data_t form, int argc, char *argv[])
+system_fh_hwtype (format_data_t form, int argc _GL_UNUSED_PARAMETER,
+		  char *argv[] _GL_UNUSED_PARAMETER)
 {
   ESTABLISH_IFADDRS
   if (!ifp)
diff --git a/ifconfig/system/linux.c b/ifconfig/system/linux.c
index 95c0e60..d676af5 100644
--- a/ifconfig/system/linux.c
+++ b/ifconfig/system/linux.c
@@ -45,6 +45,7 @@
 #include <linux/if_ether.h>
 
 #include <read-file.h>
+#include <unused-parameter.h>
 
 #include "../ifconfig.h"
 
@@ -52,22 +53,28 @@
 /* ARPHRD stuff.  */
 
 static void
-print_hwaddr_ether (format_data_t form, unsigned char *data)
+print_hwaddr_ether (format_data_t form _GL_UNUSED_PARAMETER,
+		    unsigned char *data)
 {
   *column += printf ("%02X:%02X:%02X:%02X:%02X:%02X",
 		     data[0], data[1], data[2], data[3], data[4], data[5]);
+  had_output = 1;
 }
 
 static void
-print_hwaddr_arcnet (format_data_t form, unsigned char *data)
+print_hwaddr_arcnet (format_data_t form _GL_UNUSED_PARAMETER,
+		     unsigned char *data)
 {
   *column += printf ("%02X", data[0]);
+  had_output = 1;
 }
 
 static void
-print_hwaddr_dlci (format_data_t form, unsigned char *data)
+print_hwaddr_dlci (format_data_t form _GL_UNUSED_PARAMETER,
+		   unsigned char *data)
 {
   *column += printf ("%i", *((short *) data));
+  had_output = 1;
 }
 
 static void
@@ -81,22 +88,29 @@ print_hwaddr_ax25 (format_data_t form, unsigned char *data)
     }
   i = (data[6] & 0x1E) >> 1;
   if (i)
-    *column += printf ("-%i", i);
+    {
+      *column += printf ("-%i", i);
+      had_output = 1;
+    }
 #undef mangle
 }
 
 static void
-print_hwaddr_irda (format_data_t form, unsigned char *data)
+print_hwaddr_irda (format_data_t form _GL_UNUSED_PARAMETER,
+		   unsigned char *data)
 {
   *column += printf ("%02X:%02X:%02X:%02X",
 		     data[3], data[2], data[1], data[0]);
+  had_output = 1;
 }
 
 static void
-print_hwaddr_rose (format_data_t form, unsigned char *data)
+print_hwaddr_rose (format_data_t form _GL_UNUSED_PARAMETER,
+		   unsigned char *data)
 {
   *column += printf ("%02X%02X%02X%02X%02X",
 		     data[0], data[1], data[2], data[3], data[4]);
+  had_output = 1;
 }
 
 struct arphrd_symbol
@@ -535,7 +549,8 @@ system_fh_hwaddr_query (format_data_t form, int argc, char *argv[])
 }
 
 void
-system_fh_hwaddr (format_data_t form, int argc, char *argv[])
+system_fh_hwaddr (format_data_t form, int argc _GL_UNUSED_PARAMETER,
+		  char *argv[] _GL_UNUSED_PARAMETER)
 {
 #ifdef SIOCGIFHWADDR
   if (ioctl (form->sfd, SIOCGIFHWADDR, form->ifr) < 0)
@@ -571,7 +586,8 @@ system_fh_hwtype_query (format_data_t form, int argc, char *argv[])
 }
 
 void
-system_fh_hwtype (format_data_t form, int argc, char *argv[])
+system_fh_hwtype (format_data_t form, int argc _GL_UNUSED_PARAMETER,
+		  char *argv[] _GL_UNUSED_PARAMETER)
 {
 #ifdef SIOCGIFHWADDR
   if (ioctl (form->sfd, SIOCGIFHWADDR, form->ifr) < 0)
@@ -693,8 +709,8 @@ system_parse_opt_set_txqlen (struct ifconfig *ifp, char *arg)
 
 static struct argp_option linux_argp_options[] = {
   { "txqlen", 'T', "N", 0,
-    "set transmit queue length to N" },
-  { NULL }
+    "set transmit queue length to N", 0 },
+  { NULL, 0, NULL, 0, NULL, 0 }
 };
 
 static error_t
@@ -713,7 +729,8 @@ linux_argp_parser (int key, char *arg, struct argp_state *state)
   return 0;
 }
 
-static struct argp linux_argp = { linux_argp_options, linux_argp_parser };
+static struct argp linux_argp =
+  { linux_argp_options, linux_argp_parser, NULL, NULL, NULL, NULL, NULL };
 
 struct argp_child system_argp_child = {
   &linux_argp,
diff --git a/ifconfig/system/solaris.c b/ifconfig/system/solaris.c
index 8a0b58f..c4da17e 100644
--- a/ifconfig/system/solaris.c
+++ b/ifconfig/system/solaris.c
@@ -45,6 +45,8 @@
 #include <net/if_arp.h>
 #include <netinet/if_ether.h>
 
+#include <unused-parameter.h>
+
 #include "../ifconfig.h"
 
 
@@ -62,7 +64,9 @@ NAME [ADDR [DSTADDR]] [broadcast BRDADDR] [netmask MASK] "
 struct argp_child system_argp_child;
 
 int
-system_parse_opt (struct ifconfig **ifp, char option, char *optarg)
+system_parse_opt (struct ifconfig **ifp _GL_UNUSED_PARAMETER,
+		  char option _GL_UNUSED_PARAMETER,
+		  char *optarg _GL_UNUSED_PARAMETER)
 {
   return 0;
 }
@@ -165,7 +169,7 @@ system_configure (int sfd, struct ifreq *ifr, struct system_ifconfig *ifs)
 # ifndef SIOCSIFTXQLEN
       error (0, 0, "don't know how to set the txqlen on this system");
       return -1;
-# else
+# else /* SIOCSIFTXQLEN */
       int err = 0;
 
       ifr->ifr_qlen = ifs->txqlen;
@@ -175,10 +179,14 @@ system_configure (int sfd, struct ifreq *ifr, struct system_ifconfig *ifs)
       if (verbose)
 	printf ("Set txqlen value of `%s' to `%i'.\n",
 		ifr->ifr_name, ifr->ifr_qlen);
-# endif
+# endif /* SIOCSIFTXQLEN */
     }
+#else /* !IF_VALID_TXQLEN */
+  (void) sfd;
+  (void) ifr;
+  (void) ifs;
+#endif /* !IF_VALID_TXQLEN */
   return 0;
-#endif
 }
 
 
diff --git a/ifconfig/system/solaris.h b/ifconfig/system/solaris.h
index 64898ff..ed06d57 100644
--- a/ifconfig/system/solaris.h
+++ b/ifconfig/system/solaris.h
@@ -28,9 +28,12 @@
 
 
 /* XXX: Gross. Have autoconf check and put in system.h or so.
-   The correctness is documented in Solaris 2.7, if_tcp(7p).  */
+   The correctness is documented in Solaris 2.7, if_tcp(7p).
+   At least OpenSolaris and later systems do provide ifr_mtu.  */
 
-# define ifr_mtu ifr_metric
+# ifndef HAVE_STRUCT_IFREQ_IFR_MTU
+#  define ifr_mtu ifr_metric
+# endif /* !HAVE_STRUCT_IFREQ_IFR_MTU */
 
 
 /* Option support.  */

http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=72e61402af942ed672b3dd6e937aa4854db330ae


commit 72e61402af942ed672b3dd6e937aa4854db330ae
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Wed Dec 5 00:24:26 2012 +0100

    ifconfig: Parse command line for BSD.

diff --git a/ChangeLog b/ChangeLog
index d40e5bb..8665f35 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2012-12-04  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	* ifconfig/system/bsd.c (system_help): Update.
+	(system_parse_opt_rest): Populate function with
+	parser and actions for command line arguments.
+
+	* ifconfig/system/solaris.c (system_help): Update.
+	(system_parse_opt_rest): Implement actions for the
+	arguments "up" and "down" of an interface.
+
 2012-12-03  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	ifconfig: Audit displaying of metrics.
diff --git a/ifconfig/COMPATIBILITY b/ifconfig/COMPATIBILITY
index 81302fb..5621434 100644
--- a/ifconfig/COMPATIBILITY
+++ b/ifconfig/COMPATIBILITY
@@ -27,6 +27,7 @@ hpux10.20
 
 
 sparc-sun-solaris-2.7
+OpenSolaris
 
 	Uses the output format `unix'.
 
@@ -34,3 +35,9 @@ sparc-sun-solaris-2.7
 alphaev56-dec-osf4.0g
 
 	Uses the output format `osf'.
+
+
+*BSD
+
+	Uses output format `unix'.  Basic functionality for
+	DragonflyBSD, FreeBSD, NetBSD, and OpenBSD.
diff --git a/ifconfig/system/bsd.c b/ifconfig/system/bsd.c
index e8d0fff..59a792a 100644
--- a/ifconfig/system/bsd.c
+++ b/ifconfig/system/bsd.c
@@ -1,4 +1,4 @@
-/* generic.c -- generic system code for ifconfig
+/* bsd.c -- BSD specific code for ifconfig
   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
   2010, 2011, 2012 Free Software Foundation, Inc.
 
@@ -38,7 +38,8 @@ const char *system_default_format = "unix";
 /* Argument parsing stuff.  */
 
 const char *system_help = "\
-NAME [ADDR [DSTADDR]] [broadcast BRDADDR] [netmask MASK] [metric N] [mtu N]";
+NAME [ADDR [DSTADDR]] [broadcast BRDADDR] [netmask MASK] "
+"[metric N] [mtu N] [up|down]";
 
 struct argp_child system_argp_child;
 
@@ -51,7 +52,90 @@ system_parse_opt (struct ifconfig **ifp, char option, char *optarg)
 int
 system_parse_opt_rest (struct ifconfig **ifp, int argc, char *argv[])
 {
-  return 0;
+  int i = 0;
+  enum
+  {
+    EXPECT_NOTHING,
+    EXPECT_BROADCAST,
+    EXPECT_NETMASK,
+    EXPECT_METRIC,
+    EXPECT_MTU
+  } expect = EXPECT_NOTHING;
+
+  *ifp = parse_opt_new_ifs (argv[0]);
+
+  while (++i < argc)
+    {
+      switch (expect)
+	{
+	case EXPECT_BROADCAST:
+	  parse_opt_set_brdaddr (*ifp, argv[i]);
+	  break;
+
+	case EXPECT_NETMASK:
+	  parse_opt_set_netmask (*ifp, argv[i]);
+	  break;
+
+	case EXPECT_MTU:
+	  parse_opt_set_mtu (*ifp, argv[i]);
+	  break;
+
+	case EXPECT_METRIC:
+	  parse_opt_set_metric (*ifp, argv[i]);
+	  break;
+
+	case EXPECT_NOTHING:
+	  break;
+	}
+
+      if (expect != EXPECT_NOTHING)
+	expect = EXPECT_NOTHING;
+      else if (!strcmp (argv[i], "broadcast"))
+	expect = EXPECT_BROADCAST;
+      else if (!strcmp (argv[i], "netmask"))
+	expect = EXPECT_NETMASK;
+      else if (!strcmp (argv[i], "metric"))
+	expect = EXPECT_METRIC;
+      else if (!strcmp (argv[i], "mtu"))
+	expect = EXPECT_MTU;
+      else if (!strcmp (argv[i], "up"))
+	parse_opt_set_flag (*ifp, IFF_UP | IFF_RUNNING, 0);
+      else if (!strcmp (argv[i], "down"))
+	parse_opt_set_flag (*ifp, IFF_UP, 1);
+      else
+	{
+	  /* Recognize AF here.  */
+	  /* Also alias, -alias, promisc, -promisc,
+	     create, destroy, monitor, -monitor.  */
+	  if (!((*ifp)->valid & IF_VALID_ADDR))
+	    parse_opt_set_address (*ifp, argv[i]);
+	  else if (!((*ifp)->valid & IF_VALID_DSTADDR))
+	    parse_opt_set_dstaddr (*ifp, argv[i]);
+	}
+    }
+
+  switch (expect)
+    {
+    case EXPECT_BROADCAST:
+      error (0, 0, "option `broadcast' requires an argument");
+      break;
+
+    case EXPECT_NETMASK:
+      error (0, 0, "option `netmask' requires an argument");
+      break;
+
+    case EXPECT_METRIC:
+      error (0, 0, "option `metric' requires an argument");
+      break;
+
+    case EXPECT_MTU:
+      error (0, 0, "option `mtu' requires an argument");
+      break;
+
+    case EXPECT_NOTHING:
+      break;
+    }
+  return expect == EXPECT_NOTHING;
 }
 
 int
diff --git a/ifconfig/system/solaris.c b/ifconfig/system/solaris.c
index 0d53694..8a0b58f 100644
--- a/ifconfig/system/solaris.c
+++ b/ifconfig/system/solaris.c
@@ -56,7 +56,8 @@ const char *system_default_format = "unix";
 /* Argument parsing stuff.  */
 
 const char *system_help = "\
-NAME [ADDR [DSTADDR]] [broadcast BRDADDR] [netmask MASK] [metric N] [mtu N]";
+NAME [ADDR [DSTADDR]] [broadcast BRDADDR] [netmask MASK] "
+"[metric N] [mtu N] [up|down]";
 
 struct argp_child system_argp_child;
 
@@ -115,10 +116,13 @@ system_parse_opt_rest (struct ifconfig **ifp, int argc, char *argv[])
 	expect = EXPECT_METRIC;
       else if (!strcmp (argv[i], "mtu"))
 	expect = EXPECT_MTU;
+      else if (!strcmp (argv[i], "up"))
+	parse_opt_set_flag (*ifp, IFF_UP | IFF_RUNNING, 0);
+      else if (!strcmp (argv[i], "down"))
+	parse_opt_set_flag (*ifp, IFF_UP, 1);
       else
 	{
 	  /* Recognize AF here.  */
-	  /* Recognize up/down.  */
 	  /* Also auto-revarp, trailers, -trailers,
 	     private, -private, arp, -arp, plumb, unplumb.  */
 	  if (!((*ifp)->valid & IF_VALID_ADDR))

http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=0d19e38f4f71e2137d88b4aafa917f519fc70e9d


commit 0d19e38f4f71e2137d88b4aafa917f519fc70e9d
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Mon Dec 3 23:20:27 2012 +0100

    ifconfig: Displaying of interface metric.

diff --git a/ChangeLog b/ChangeLog
index 89efac9..d40e5bb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,28 @@
 2012-12-03  Mats Erik Andersson  <gnu@gisladisker.se>
 
+	ifconfig: Audit displaying of metrics.
+	The portable display is to supress metric naught.
+
+	* ifconfig/printif.c (fh_metric_query) [SIOCGIFMETRIC]:
+	Add the further condition `form->ifr->ifr_metric > 0'
+	(fh_metric) [SIOCGIFMETRIC]: Do not report value 0 of
+	`form->ifr->ifr_metric' as 1.
+	* ifconfig/system/bsd.c (system_fh_metric): Remove.
+	* ifconfig/system/bsd.h (SYSTEM_FORMAT_HANDLER):
+	Delete key "metric".
+	(system_fh_metric): Remove prototype.
+
+	Implement exceptional handler for GNU/Linux.
+
+	* ifconfig/system/linux.c (system_fh_metric_query)
+	(system_fh_metric): New functions.
+	* ifconfig/system/linux.h (SYSTEM_FORMAT_HANDLER):
+	Add new keys "metric?" and "metric".
+	(system_fh_metric_query, system_fh_metric):
+	New prototypes.
+
+2012-12-03  Mats Erik Andersson  <gnu@gisladisker.se>
+
 	ifconfig.sh: Avoid substring matches.
 
 	* tests/ifconfig.sh (LO): Assign inside a loop,
diff --git a/ifconfig/printif.c b/ifconfig/printif.c
index 5bd93b7..e41582c 100644
--- a/ifconfig/printif.c
+++ b/ifconfig/printif.c
@@ -788,11 +788,15 @@ fh_mtu (format_data_t form, int argc, char *argv[])
 #endif
 }
 
+/* The portable behaviour is to display strictly positive
+ * metrics, but to supress the default value naught.
+ */
 void
 fh_metric_query (format_data_t form, int argc, char *argv[])
 {
 #ifdef SIOCGIFMETRIC
-  if (ioctl (form->sfd, SIOCGIFMETRIC, form->ifr) >= 0)
+  if (ioctl (form->sfd, SIOCGIFMETRIC, form->ifr) >= 0
+      && form->ifr->ifr_metric > 0)
     select_arg (form, argc, argv, 0);
   else
 #endif
@@ -808,8 +812,7 @@ fh_metric (format_data_t form, int argc, char *argv[])
 	   "SIOCGIFMETRIC failed for interface `%s'",
 	   form->ifr->ifr_name);
   else
-    put_int (form, argc, argv,
-	     form->ifr->ifr_metric ? form->ifr->ifr_metric : 1);
+    put_int (form, argc, argv, form->ifr->ifr_metric);
 #else
   *column += printf ("(not available)");
   had_output = 1;
diff --git a/ifconfig/system/bsd.c b/ifconfig/system/bsd.c
index 4b337ed..e8d0fff 100644
--- a/ifconfig/system/bsd.c
+++ b/ifconfig/system/bsd.c
@@ -169,19 +169,3 @@ system_fh_hwtype (format_data_t form, int argc, char *argv[])
 	put_string (form, "(unknown hwtype)");
     }
 }
-
-void
-system_fh_metric (format_data_t form, int argc, char *argv[])
-{
-#ifdef SIOCGIFMETRIC
-  if (ioctl (form->sfd, SIOCGIFMETRIC, form->ifr) < 0)
-    error (EXIT_FAILURE, errno,
-	   "SIOCGIFMETRIC failed for interface `%s'",
-	   form->ifr->ifr_name);
-  else
-    put_int (form, argc, argv, form->ifr->ifr_metric);
-#else
-  *column += printf ("(not available)");
-  had_output = 1;
-#endif
-}
diff --git a/ifconfig/system/bsd.h b/ifconfig/system/bsd.h
index 49dcfaa..75cdae1 100644
--- a/ifconfig/system/bsd.h
+++ b/ifconfig/system/bsd.h
@@ -61,13 +61,11 @@ struct system_ifconfig
   {"hwaddr?", system_fh_hwaddr_query}, \
   {"hwaddr", system_fh_hwaddr}, \
   {"hwtype?", system_fh_hwtype_query}, \
-  {"hwtype", system_fh_hwtype}, \
-  {"metric", system_fh_metric},
+  {"hwtype", system_fh_hwtype},
 
 void system_fh_hwaddr_query (format_data_t form, int argc, char *argv[]);
 void system_fh_hwaddr (format_data_t form, int argc, char *argv[]);
 void system_fh_hwtype_query (format_data_t form, int argc, char *argv[]);
 void system_fh_hwtype (format_data_t form, int argc, char *argv[]);
-void system_fh_metric (format_data_t form, int argc, char *argv[]);
 
 #endif /* IFCONFIG_SYSTEM_BSD_H */
diff --git a/ifconfig/system/linux.c b/ifconfig/system/linux.c
index c7f3638..95c0e60 100644
--- a/ifconfig/system/linux.c
+++ b/ifconfig/system/linux.c
@@ -594,6 +594,38 @@ system_fh_hwtype (format_data_t form, int argc, char *argv[])
 #endif
 }
 
+/* Accept every value of metric as printable.  The net-tools'
+ * implementation of ifconfig displays metric 0 as `1', so we
+ * aim at the same thing, even though all other unices disagree.
+ */
+void
+system_fh_metric_query (format_data_t form, int argc, char *argv[])
+{
+#ifdef SIOCGIFMETRIC
+  if (ioctl (form->sfd, SIOCGIFMETRIC, form->ifr) >= 0)
+    select_arg (form, argc, argv, 0);
+  else
+#endif
+    select_arg (form, argc, argv, 1);
+}
+
+void
+system_fh_metric (format_data_t form, int argc, char *argv[])
+{
+#ifdef SIOCGIFMETRIC
+  if (ioctl (form->sfd, SIOCGIFMETRIC, form->ifr) < 0)
+    error (EXIT_FAILURE, errno,
+	   "SIOCGIFMETRIC failed for interface `%s'",
+	   form->ifr->ifr_name);
+  else
+    put_int (form, argc, argv,
+	     form->ifr->ifr_metric ? form->ifr->ifr_metric : 1);
+#else
+  *column += printf ("(not available)");
+  had_output = 1;
+#endif
+}
+
 void
 system_fh_txqlen_query (format_data_t form, int argc, char *argv[])
 {
diff --git a/ifconfig/system/linux.h b/ifconfig/system/linux.h
index 5fe8906..50f2dde 100644
--- a/ifconfig/system/linux.h
+++ b/ifconfig/system/linux.h
@@ -51,6 +51,8 @@ struct system_ifconfig
   {"hwaddr", system_fh_hwaddr}, \
   {"hwtype?", system_fh_hwtype_query}, \
   {"hwtype", system_fh_hwtype}, \
+  {"metric?", system_fh_metric_query}, \
+  {"metric", system_fh_metric}, \
   {"txqlen?", system_fh_txqlen_query}, \
   {"txqlen", system_fh_txqlen}, \
   {"ifstat?", system_fh_ifstat_query}, \
@@ -82,6 +84,8 @@ void system_fh_hwaddr_query (format_data_t form, int argc, char *argv[]);
 void system_fh_hwaddr (format_data_t form, int argc, char *argv[]);
 void system_fh_hwtype_query (format_data_t form, int argc, char *argv[]);
 void system_fh_hwtype (format_data_t form, int argc, char *argv[]);
+void system_fh_metric_query (format_data_t form, int argc, char *argv[]);
+void system_fh_metric (format_data_t form, int argc, char *argv[]);
 void system_fh_txqlen_query (format_data_t form, int argc, char *argv[]);
 void system_fh_txqlen (format_data_t form, int argc, char *argv[]);
 

http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=065f43884cfbc7ba1dc7639d4bd87a650fa05b33


commit 065f43884cfbc7ba1dc7639d4bd87a650fa05b33
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Mon Dec 3 19:59:30 2012 +0100

    Small fixes.

diff --git a/ChangeLog b/ChangeLog
index 787dd48..89efac9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2012-12-03  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	ifconfig.sh: Avoid substring matches.
+
+	* tests/ifconfig.sh (LO): Assign inside a loop,
+	after matching by `expr' against interface name.
+
+	Format string errors and warnings.
+
+	* ifconfig/options.c (parse_opt_flag_list):
+	Cast LEN as int for use as width in `%*.*s'.
+	* src/rcp.c (source): Use "%zd" instead of "%lld".
+	* src/rexecd.c (doit): Format "%d" for `pwd->pw_gid'.
+	* telnet/commands.c (ayt_status) [SIGINFO]:
+	Return status 1.
+	(help): Cast HELPIDENT as int for use as format width.
+
 2012-11-28  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	libinetutils.a: Build if_nametoindex(), if_nameindex(),
diff --git a/ifconfig/options.c b/ifconfig/options.c
index 6e6317d..095d566 100644
--- a/ifconfig/options.c
+++ b/ifconfig/options.c
@@ -360,7 +360,8 @@ parse_opt_flag_list (struct ifconfig *ifp, const char *name)
 	len = strlen (name);
 
       if ((mask = if_nametoflag (name, len, &rev)) == 0)
-	error (EXIT_FAILURE, 0, "unknown flag %*.*s", len, len, name);
+	error (EXIT_FAILURE, 0, "unknown flag %*.*s",
+	       (int) len, (int) len, name);
       parse_opt_set_flag (ifp, mask, rev);
 
       name += len;
diff --git a/src/rcp.c b/src/rcp.c
index 0e97cbd..2a35112 100644
--- a/src/rcp.c
+++ b/src/rcp.c
@@ -731,7 +731,7 @@ source (int argc, char *argv[])
 #define RCP_MODEMASK	(S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)
       snprintf (buf, sizeof buf,
 		(sizeof (stb.st_size) > sizeof (long)
-		 ? "C%04o %lld %s\n"
+		 ? "C%04o %zd %s\n"
 		 : "C%04o %ld %s\n"),
 		stb.st_mode & RCP_MODEMASK, stb.st_size, last);
       write (rem, buf, strlen (buf));
diff --git a/src/rexecd.c b/src/rexecd.c
index 32a2228..b7ff3b2 100644
--- a/src/rexecd.c
+++ b/src/rexecd.c
@@ -455,7 +455,7 @@ doit (int f, struct sockaddr *fromp, socklen_t fromlen)
 # ifdef WITH_PAM
       pam_rc = PAM_ABORT;
 # endif
-      syslog (LOG_DEBUG | LOG_AUTH, "initgroups(%s, %s): %m",
+      syslog (LOG_DEBUG | LOG_AUTH, "initgroups(%s, %d): %m",
 	      pwd->pw_name, pwd->pw_gid);
       die (EXIT_FAILURE, "Failed group protections.");
     }
diff --git a/telnet/commands.c b/telnet/commands.c
index 651b3e6..7c409a9 100644
--- a/telnet/commands.c
+++ b/telnet/commands.c
@@ -2427,8 +2427,9 @@ int
 ayt_status ()
 {
   call (status, "status", "notmuch", 0);
+  return 1;	/* not used */
 }
-#endif
+#endif /* SIGINFO */
 
 static void cmdrc (char *m1, char *m2);
 
@@ -3004,7 +3005,7 @@ help (int argc, char *argv[])
       for (c = cmdtab; c->name; c++)
 	if (c->help)
 	  {
-	    printf ("%-*s\t%s\n", HELPINDENT, c->name, c->help);
+	    printf ("%-*s\t%s\n", (int) HELPINDENT, c->name, c->help);
 	  }
       return 0;
     }
diff --git a/tests/ifconfig.sh b/tests/ifconfig.sh
index dbb6e8e..8472e8e 100755
--- a/tests/ifconfig.sh
+++ b/tests/ifconfig.sh
@@ -70,8 +70,15 @@ fi
 
 # Locate the loopback interface.
 #
+# Avoid cases where `lo' is a substring
+# of another interface name, like for
+# `pflog0' of OpenBSD.
+#
 IF_LIST=`$IFCONFIG -l`
-LO=`expr "$IF_LIST" : '.*\(lo0\{0,\}\).*'`
+for nn in $IF_LIST; do
+    LO=`expr $nn : '\(lo0\{0,\}\).*'`
+    test -z "$LO" || break
+done
 
 if test -z "$LO"; then
     echo >&2 'Unable to locate loopback interface.  Failing.'

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

Summary of changes:
 ChangeLog                 |  116 ++++++++++++++++++++++++++++++++++++++++++
 configure.ac              |   11 ++--
 ifconfig/COMPATIBILITY    |    7 +++
 ifconfig/flags.c          |  104 ++++++++++++++++++--------------------
 ifconfig/ifconfig.c       |    2 +-
 ifconfig/options.c        |   74 ++++++++++++++++++---------
 ifconfig/options.h        |    3 +
 ifconfig/printif.c        |   43 +++++++++++-----
 ifconfig/system/bsd.c     |  122 ++++++++++++++++++++++++++++++++++++---------
 ifconfig/system/bsd.h     |    4 +-
 ifconfig/system/linux.c   |   71 ++++++++++++++++++++++----
 ifconfig/system/linux.h   |    4 ++
 ifconfig/system/solaris.c |   24 +++++++--
 ifconfig/system/solaris.h |    7 ++-
 src/rcp.c                 |    2 +-
 src/rexecd.c              |    2 +-
 telnet/commands.c         |    5 +-
 tests/ifconfig.sh         |    9 +++-
 18 files changed, 460 insertions(+), 150 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Thu Dec 06 19:58:06 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1TgmGU-0008N4-9H
	for mharc-commit-inetutils@gnu.org; Thu, 06 Dec 2012 19:58:06 -0500
Received: from eggs.gnu.org ([208.118.235.92]:58664)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TgmGQ-0008MV-81
	for commit-inetutils@gnu.org; Thu, 06 Dec 2012 19:58:03 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TgmGO-0002LI-Hf
	for commit-inetutils@gnu.org; Thu, 06 Dec 2012 19:58:02 -0500
Received: from vcs.savannah.gnu.org ([140.186.70.72]:36947)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TgmGO-0002LE-EM
	for commit-inetutils@gnu.org; Thu, 06 Dec 2012 19:58:00 -0500
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1TgmGN-0000jG-NM
	for commit-inetutils@gnu.org; Fri, 07 Dec 2012 00:57:59 +0000
Date: Fri, 07 Dec 2012 00:57:59 +0000
Message-Id: <E1TgmGN-0000jG-NM@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1-222-g67b49c5
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 188433bc0760e8ea8f2947831d1a53b78bc523e5
X-Git-Newrev: 67b49c54c0304942737f5409ec4e0c0435443114
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 07 Dec 2012 00:58:04 -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  67b49c54c0304942737f5409ec4e0c0435443114 (commit)
      from  188433bc0760e8ea8f2947831d1a53b78bc523e5 (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=67b49c54c0304942737f5409ec4e0c0435443114


commit 67b49c54c0304942737f5409ec4e0c0435443114
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Fri Dec 7 01:52:36 2012 +0100

    rcp: Tracking of allocated buffer.

diff --git a/ChangeLog b/ChangeLog
index 483ecc6..f1caf37 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2012-12-07  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	Keep track of allocations.  Was an unlimited use of malloc()!
+
+	* src/rcp.c (sink): Change CURSIZE to size_t.  Initialize
+	NAMEBUF and CURSIZE.  Free buffer at each allocation, and
+	set CURSIZE.  Capture error condition after failed malloc(),
+	resetting CURSIZE and continuing with next loop iteration.
+
+	Signedness warnings in src/.
+
+	* src/hostname.c (parse_file): Use ssize_t for NREAD.
+	* src/logger.c (IU_MAX_FAC): New macro.
+	(decode): Remove C.  Use `n >= IU_MAX_FAC' to detect
+	input error.  Return N for successful values.
+	(send_to_syslog): Cast LEN as ssize_t in comparison.
+	* src/rcp.c (allocbuf): Cast `bp->cnt' as size_t in comparison.
+	* src/rexecd.c (die): Cast `sizeof buf' as int in comparison.
+	(getstr): Cast `buf_len >> 3' as ssize_t in comparison.
+	* src/rshd.c (getstr): Likewise.
+
 2012-12-06  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	ifconfig: Allow `--up', `--down' to be used before
diff --git a/src/hostname.c b/src/hostname.c
index ed89d7f..83cd564 100644
--- a/src/hostname.c
+++ b/src/hostname.c
@@ -372,7 +372,7 @@ parse_file (const char *const file_name)
   char *buffer = NULL;
   char *name;
   FILE *file;
-  size_t nread;
+  ssize_t nread;
   size_t size = 0;
 
   file = fopen (file_name, "r");
diff --git a/src/logger.c b/src/logger.c
index 5b003f1..6da5b84 100644
--- a/src/logger.c
+++ b/src/logger.c
@@ -71,6 +71,12 @@ static int host_family = AF_INET;
 
 
 
+#ifdef LOG_NFACILITIES
+# define IU_MAX_FAC LOG_NFACILITIES
+#else
+# define IU_MAX_FAC 32
+#endif
+
 int
 decode (char *name, CODE *codetab, const char *what)
 {
@@ -79,12 +85,12 @@ decode (char *name, CODE *codetab, const char *what)
   if (isdigit (*name))
     {
       char *p;
-      int c;
       unsigned long n = strtoul (name, &p, 0);
 
-      if (*p || (c = n) != n)
+      if (*p || n >= IU_MAX_FAC)	/* Includes range errors.  */
 	error (EXIT_FAILURE, 0, "%s: invalid %s number", what, name);
-      return c;
+
+      return n;
     }
 
   for (cp = codetab; cp->c_name; cp++)
@@ -374,7 +380,7 @@ send_to_syslog (const char *msg)
   free (pbuf);
   if (rc == -1)
     error (0, errno, "send failed");
-  else if (rc != len)
+  else if (rc != (ssize_t) len)
     error (0, errno, "sent less bytes than expected (%lu vs. %lu)",
 	   (unsigned long) rc, (unsigned long) len);
 }
diff --git a/src/rcp.c b/src/rcp.c
index 2a35112..7bbe9ff 100644
--- a/src/rcp.c
+++ b/src/rcp.c
@@ -972,17 +972,25 @@ sink (int argc, char *argv[])
 	SCREWUP ("size not delimited");
       if (targisdir)
 	{
-	  static char *namebuf;
-	  static int cursize;
+	  static char *namebuf = NULL;
+	  static size_t cursize = 0;
 	  size_t need;
 
 	  need = strlen (targ) + strlen (cp) + 250;
 	  if (need > cursize)
 	    {
-	      if (!(namebuf = malloc (need)))
-		run_err ("%s", strerror (errno));
+	      free (namebuf);
+	      namebuf = malloc (need);
+	      if (namebuf)
+		cursize = need;
+	      else
+		{
+		  run_err ("%s", strerror (errno));
+		  cursize = 0;
+		  continue;
+		}
 	    }
-	  snprintf (namebuf, need, "%s%s%s", targ, *targ ? "/" : "", cp);
+	  snprintf (namebuf, cursize, "%s%s%s", targ, *targ ? "/" : "", cp);
 	  np = namebuf;
 	}
       else
@@ -1457,7 +1465,7 @@ allocbuf (BUF * bp, int fd, int blksize)
   size = roundup (BUFSIZ, blksize);
   if (size == 0)
     size = blksize;
-  if (bp->cnt >= size)
+  if ((size_t) bp->cnt >= size)
     return (bp);
   if ((bp->buf = realloc (bp->buf, size)) == NULL)
     {
diff --git a/src/rexecd.c b/src/rexecd.c
index b7ff3b2..15bee0e 100644
--- a/src/rexecd.c
+++ b/src/rexecd.c
@@ -652,10 +652,10 @@ die (int code, const char *fmt, ...)
   int n;
 
   va_start (ap, fmt);
-  buf[0] = 1;
+  buf[0] = 1;		/* Error condition.  */
   n = vsnprintf (buf + 1, sizeof buf - 1, fmt, ap);
   va_end (ap);
-  if (n > sizeof buf - 1)
+  if (n + 1 > (int) sizeof buf)
     n = sizeof buf - 1;
   buf[n++] = '\n';
   write (STDERR_FILENO, buf, n);
@@ -688,7 +688,7 @@ getstr (const char *err)
 	}
 
       end += rd;
-      if ((buf + buf_len - end) < (buf_len >> 3))
+      if ((buf + buf_len - end) < (ssize_t) (buf_len >> 3))
 	{
 	  /* Not very much room left in our buffer, grow it. */
 	  size_t end_offs = end - buf;
diff --git a/src/rshd.c b/src/rshd.c
index 0feda9d..4ba6c09 100644
--- a/src/rshd.c
+++ b/src/rshd.c
@@ -1695,6 +1695,7 @@ getstr (const char *err)
     {
       /* Oh this is efficient, oh yes.  [But what can be done?] */
       int rd = read (STDIN_FILENO, end, 1);
+
       if (rd <= 0)
 	{
 	  if (rd == 0)
@@ -1705,7 +1706,7 @@ getstr (const char *err)
 	}
 
       end += rd;
-      if ((buf + buf_len - end) < (buf_len >> 3))
+      if ((buf + buf_len - end) < (ssize_t) (buf_len >> 3))
 	{
 	  /* Not very much room left in our buffer, grow it. */
 	  size_t end_offs = end - buf;

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

Summary of changes:
 ChangeLog      |   21 +++++++++++++++++++++
 src/hostname.c |    2 +-
 src/logger.c   |   14 ++++++++++----
 src/rcp.c      |   20 ++++++++++++++------
 src/rexecd.c   |    6 +++---
 src/rshd.c     |    3 ++-
 6 files changed, 51 insertions(+), 15 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Fri Dec 07 08:44:13 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1TgyDt-0006lO-L4
	for mharc-commit-inetutils@gnu.org; Fri, 07 Dec 2012 08:44:13 -0500
Received: from eggs.gnu.org ([208.118.235.92]:57602)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TgyDl-0006kg-6d
	for commit-inetutils@gnu.org; Fri, 07 Dec 2012 08:44:11 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TgyDe-0001bj-NZ
	for commit-inetutils@gnu.org; Fri, 07 Dec 2012 08:44:05 -0500
Received: from vcs.savannah.gnu.org ([140.186.70.72]:54544)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TgyDe-0001be-Jr
	for commit-inetutils@gnu.org; Fri, 07 Dec 2012 08:43:58 -0500
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1TgyDZ-00032C-MF
	for commit-inetutils@gnu.org; Fri, 07 Dec 2012 13:43:54 +0000
Date: Fri, 07 Dec 2012 13:43:53 +0000
Message-Id: <E1TgyDZ-00032C-MF@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1-223-g3d9eadf
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 67b49c54c0304942737f5409ec4e0c0435443114
X-Git-Newrev: 3d9eadf7d2e1325cb42fdee7d875b675403304a8
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 07 Dec 2012 13:44:12 -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  3d9eadf7d2e1325cb42fdee7d875b675403304a8 (commit)
      from  67b49c54c0304942737f5409ec4e0c0435443114 (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=3d9eadf7d2e1325cb42fdee7d875b675403304a8


commit 3d9eadf7d2e1325cb42fdee7d875b675403304a8
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Fri Dec 7 14:25:10 2012 +0100

    Activate servers for FreeBSD 9.
    
    Remove inhibition of ftpd, rlogind, telnetd,
    and uucpd.  They seem to work sufficiently well.

diff --git a/ChangeLog b/ChangeLog
index f1caf37..a2ae553 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,27 @@
 2012-12-07  Mats Erik Andersson  <gnu@gisladisker.se>
 
+	Activate servers in FreeBSD 9 and 10.  They work
+	sufficiently well with the previous adaptions.
+
+	* configure.ac <*-freebsd9* || *-freebsd10*>:
+	Delete inhibition of ftpd, rlogind, telnetd, and uucpd.
+
+	Mixed compilation warnings.
+
+	* ftp/cmdtab.c (help): Cast strlen() as int.
+	* libls/ls.c (display): MAXBLOCK is portably `long'.
+	* src/rlogind.c (protocol): Make NFD an unsigned int.
+	* telnet/sys_bsd.c (ayt) [SIGINFO]: Mark `sig' as unused.
+	* telnet/telnet.c (init_term): Declare static.  Delete
+	unused parameter `fd'.  Rewrite numerical end of TERMBUF.
+	(gettermname): Update call to init_term().
+	(lm_will, lm_do, lm_mode, slc_import): Cast sizeof()
+	as int when comparing to NETROOM.
+	(telnet) [!AUTHENTICATION && !ENCRYPTION]: Trivially
+	use parameter `user'.
+
+2012-12-07  Mats Erik Andersson  <gnu@gisladisker.se>
+
 	Keep track of allocations.  Was an unlimited use of malloc()!
 
 	* src/rcp.c (sink): Change CURSIZE to size_t.  Initialize
diff --git a/configure.ac b/configure.ac
index c94e996..e793c00 100644
--- a/configure.ac
+++ b/configure.ac
@@ -960,11 +960,11 @@ case "$host" in
   # FreeBSD 9.0 has implemented a non-standard and singular
   # UTMPX interface.  The readutmp module from GNUlib does
   # not support it, but we can fall back to getutxuser() for
-  # use in syslogd and talkd.
-  IU_DISABLE_TARGET(ftpd)
-  IU_DISABLE_TARGET(rlogind)
-  IU_DISABLE_TARGET(telnetd)
-  IU_DISABLE_TARGET(uucpd)
+  # use in syslogd and talkd.  For ftpd, rlogind, telnetd,
+  # and uucpd the use of pututxent() should suffice, but
+  # this needs continued observations.
+  #
+  # Other issues?
   ;;
 *olaris*)
   AC_DEFINE([SOLARIS], 1, [FIXME])
diff --git a/ftp/cmdtab.c b/ftp/cmdtab.c
index 0905ea7..6615ee8 100644
--- a/ftp/cmdtab.c
+++ b/ftp/cmdtab.c
@@ -284,7 +284,7 @@ help (int argc, char *argv[])
 		}
 	      else if (c->c_name)
 		{
-		  for (k = 0; k < strlen (c->c_name); k++)
+		  for (k = 0; k < (int) strlen (c->c_name); k++)
 		    putchar (' ');
 		}
 	      if (c + lines >= &cmdtab[NCMDS])
diff --git a/libls/ls.c b/libls/ls.c
index 481f76f..0444417 100644
--- a/libls/ls.c
+++ b/libls/ls.c
@@ -426,7 +426,8 @@ display (FTSENT *p, FTSENT *list)
   FTSENT *cur;
   NAMES *np;
   unsigned long long maxsize;
-  unsigned long btotal, maxblock, maxinode, maxlen, maxnlink;
+  unsigned long btotal, maxinode, maxlen, maxnlink;
+  long maxblock;
   int bcfile, flen, glen, ulen, maxflags, maxgroup, maxuser;
   int entries, needstats;
   char *user = NULL, *group = NULL, buf[INT_BUFSIZE_BOUND (uintmax_t)];
diff --git a/src/rlogind.c b/src/rlogind.c
index 2a5428e..04a1721 100644
--- a/src/rlogind.c
+++ b/src/rlogind.c
@@ -1698,7 +1698,8 @@ protocol (int f, int p, struct auth_data *ap)
 {
   char fibuf[BUFLEN], *pbp = NULL, *fbp = NULL;
   int pcc = 0, fcc = 0;
-  int cc, nfd, n;
+  int cc, n;
+  unsigned int nfd;
   char cntl;
 
 #ifndef SHISHI
diff --git a/telnet/sys_bsd.c b/telnet/sys_bsd.c
index eb610d1..af21a90 100644
--- a/telnet/sys_bsd.c
+++ b/telnet/sys_bsd.c
@@ -1000,7 +1000,7 @@ sendwin (int sig _GL_UNUSED_PARAMETER)
 
 #ifdef	SIGINFO
 void
-ayt (int sig)
+ayt (int sig _GL_UNUSED_PARAMETER)
 {
   if (connected)
     sendayt ();
diff --git a/telnet/telnet.c b/telnet/telnet.c
index b5e4b64..ab1cb99 100644
--- a/telnet/telnet.c
+++ b/telnet/telnet.c
@@ -736,8 +736,8 @@ mklist (char *buf, char *name)
 
 char termbuf[1024];
 
-int
-init_term (char *tname, int fd, int *errp)
+static int
+init_term (char *tname, int *errp)
 {
   int err = -1;
 #ifdef HAVE_TGETENT
@@ -745,7 +745,7 @@ init_term (char *tname, int fd, int *errp)
 #endif
   if (err == 1)
     {
-      termbuf[1023] = '\0';
+      termbuf[sizeof (termbuf) - 1] = '\0';
       if (errp)
 	*errp = 1;
       return (0);
@@ -771,7 +771,7 @@ gettermname (void)
       if (tnamep && tnamep != unknown)
 	free (tnamep);
       if ((tname = (char *) env_getvalue ("TERM")) &&
-	  (init_term (tname, 1, &err) == 0))
+	  (init_term (tname, &err) == 0))
 	{
 	  tnamep = mklist (termbuf, tname);
 	}
@@ -1108,7 +1108,7 @@ lm_will (unsigned char *cmd, int len)
     default:
       str_lm[3] = DONT;
       str_lm[4] = cmd[0];
-      if (NETROOM () > sizeof (str_lm))
+      if (NETROOM () > (int) sizeof (str_lm))
 	{
 	  ring_supply_data (&netoring, str_lm, sizeof (str_lm));
 	  printsub ('>', &str_lm[2], sizeof (str_lm) - 2);
@@ -1153,7 +1153,7 @@ lm_do (unsigned char *cmd, int len)
     default:
       str_lm[3] = WONT;
       str_lm[4] = cmd[0];
-      if (NETROOM () > sizeof (str_lm))
+      if (NETROOM () > (int) sizeof (str_lm))
 	{
 	  ring_supply_data (&netoring, str_lm, sizeof (str_lm));
 	  printsub ('>', &str_lm[2], sizeof (str_lm) - 2);
@@ -1200,7 +1200,7 @@ lm_mode (unsigned char *cmd, int len, int init)
   str_lm_mode[4] = linemode;
   if (!init)
     str_lm_mode[4] |= MODE_ACK;
-  if (NETROOM () > sizeof (str_lm_mode))
+  if (NETROOM () > (int) sizeof (str_lm_mode))
     {
       ring_supply_data (&netoring, str_lm_mode, sizeof (str_lm_mode));
       printsub ('>', &str_lm_mode[2], sizeof (str_lm_mode) - 2);
@@ -1328,7 +1328,7 @@ unsigned char slc_import_def[] = {
 void
 slc_import (int def)
 {
-  if (NETROOM () > sizeof (slc_import_val))
+  if (NETROOM () > (int) sizeof (slc_import_val))
     {
       if (def)
 	{
@@ -2415,7 +2415,9 @@ telnet (char *user)
     auth_encrypt_init (local_host, hostname, NULL, "TELNET", 0);
     auth_encrypt_user (user);
   }
-#endif /* defined(AUTHENTICATION) || defined(ENCRYPTION)  */
+#else /* !defined(AUTHENTICATION) && !defined(ENCRYPTION)  */
+  (void) user;
+#endif
 #if !defined TN3270
   if (telnetport)
     {

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

Summary of changes:
 ChangeLog        |   22 ++++++++++++++++++++++
 configure.ac     |   10 +++++-----
 ftp/cmdtab.c     |    2 +-
 libls/ls.c       |    3 ++-
 src/rlogind.c    |    3 ++-
 telnet/sys_bsd.c |    2 +-
 telnet/telnet.c  |   20 +++++++++++---------
 7 files changed, 44 insertions(+), 18 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Thu Dec 13 08:56:46 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Tj9HK-0003r1-DS
	for mharc-commit-inetutils@gnu.org; Thu, 13 Dec 2012 08:56:46 -0500
Received: from eggs.gnu.org ([208.118.235.92]:46253)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1Tj9HA-0003LU-8s
	for commit-inetutils@gnu.org; Thu, 13 Dec 2012 08:56:42 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1Tj9H0-0003KP-RZ
	for commit-inetutils@gnu.org; Thu, 13 Dec 2012 08:56:35 -0500
Received: from vcs.savannah.gnu.org ([140.186.70.72]:45376)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1Tj9H0-0003Jt-N0
	for commit-inetutils@gnu.org; Thu, 13 Dec 2012 08:56:26 -0500
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1Tj9Gw-0006lR-2S
	for commit-inetutils@gnu.org; Thu, 13 Dec 2012 13:56:24 +0000
Date: Thu, 13 Dec 2012 13:56:22 +0000
Message-Id: <E1Tj9Gw-0006lR-2S@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1-224-gf88d586
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 3d9eadf7d2e1325cb42fdee7d875b675403304a8
X-Git-Newrev: f88d5862859fa7416d62becd1482ef6a677ed805
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 13 Dec 2012 13:56:43 -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  f88d5862859fa7416d62becd1482ef6a677ed805 (commit)
      from  3d9eadf7d2e1325cb42fdee7d875b675403304a8 (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=f88d5862859fa7416d62becd1482ef6a677ed805


commit f88d5862859fa7416d62becd1482ef6a677ed805
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Thu Dec 13 14:54:10 2012 +0100

    Documentation (silent change)

diff --git a/TODO b/TODO
index a296de9..050313a 100644
--- a/TODO
+++ b/TODO
@@ -129,13 +129,9 @@ Ability to ping multiple host in one go.
 * ifconfig
 
 ** Implement flags support in changeif.c and options.c
-** Port to BSD.
 ** Make sure it is a drop in replacement at least for the most
    common options on Linux and BSD.
 
-** Parse options before taking actions: `ifconfig --down -i gif0'
-   segfaults, but `ifconfig -i gif0 --down' does not.
-
 ** Some systems can provide more interfaces than
   SIOCGIFCONF/if_nameindex, interfaces which are usually not UP but
   registered nevertheless.  (linux: /prov/net/dev). Some support for
diff --git a/doc/inetutils.texi b/doc/inetutils.texi
index 8ac50ed..4d03776 100644
--- a/doc/inetutils.texi
+++ b/doc/inetutils.texi
@@ -33,7 +33,7 @@
 * ftpd: (inetutils)ftpd invocation.               FTP Daemon.
 * hostname: (inetutils)hostname invocation.       Show or set system host name.
 * dnsdomainname: (inetutils)dnsdomainname invocation.       Show DNS domain name.
-* inetd: (inetutils)inetd invocation.             Interner super-server.
+* inetd: (inetutils)inetd invocation.             Internet super-server.
 * logger: (inetutils)logger invocation.           Send messages to the system log.
 * ping: (inetutils)ping invocation.               Packets to network hosts.
 * rcp: (inetutils)rcp invocation.                 Remote copy
@@ -112,14 +112,14 @@ Clients
 * tftp invocation::                    TFTP client.
 * rsh invocation::                     Remote shell.
 * rlogin invocation::                  Remote login.
-* rexec invocation::                   Remote execution client.
 * rcp invocation::                     Remote copy
+* rexec invocation::                   Remote execution client.
 * talk invocation::                    Talk client.
 * telnet invocation::                  User interface to TELNET.
 
 Daemons
 
-* inetd invocation::                   Interner super-server.
+* inetd invocation::                   Internet super-server.
 * syslogd invocation::                 Syslog server.
 * ftpd invocation::                    FTP Daemon.
 * tftpd invocation::                   TFTP server.
@@ -230,12 +230,23 @@ nonzero.
 @chapter @command{hostname}: Show or set system host name.
 @cindex hostname
 
-@command{hostname} is a program to show or set the name of host system.
+@command{hostname} is a program to show or to set the name of a
+host system.
+
+@noindent
+Synopsis:
 
 @example
-hostname [@var{option}@dots{}] [@var{name}]
+hostname [@var{option}@dots{}]
+hostname @var{name}
 @end example
 
+@noindent
+where @var{name} is the name to be used by the running host.
+
+@section Command line options
+@anchor{hostname options}
+
 @table @option
 @item -a
 @itemx --aliases
@@ -257,8 +268,8 @@ Get DNS domain name.
 @opindex --long
 Get DNS host name or Fully Qualified Domain Name.
 
-@item -F
-@itemx --file
+@item -F @var{file}
+@itemx --file=@var{file}
 @opindex -F
 @opindex --file
 Set host name or NIS domain name from FILE.
@@ -292,30 +303,42 @@ Get NIS/YP domain name.
 system's fully qualified domain name.  For example, if the FQDN of the
 system is @code{name.example.org} the command will show
 @code{example.org}.
+The output is not necessarily related to the NIS/YP domain name.
 
 The tool uses gethostname to get the host name of the system and
-getaddrinfo to resolve it into a canonical name.  The part after the
-first period (@code{.}) of the canonical name is shown.
+then getaddrinfo to resolve it into a canonical name.
+The domain part of the canonical name is shown, i.e., the part
+after the first period@tie{}(@code{.}) of the official name.
 
-The output is not necessarily related to the NIS/YP domain name.
+@noindent
+Synopsis:
 
 @example
 dnsdomainname [@var{option}@dots{}]
 @end example
 
+@noindent
+There is no command specific option.
+
 @node logger invocation
 @chapter @command{logger}: Send messages to system log
 @cindex logger
 
 @command{logger} is a program to send entries to system log.  It
 provides a shell command interface similar to the system log module.
-@xref{Syslog, , Syslog, libc, The GNU C Library Reference Manual}, for
-details.
+For background information,
+@pxref{Syslog, , Syslog, libc, The GNU C Library Reference Manual}.
+
+@noindent
+Synopsis:
 
 @example
 logger [@var{option}@dots{}] [@var{message}]
 @end example
 
+@section Command line options
+@anchor{logger options}
+
 @table @option
 @item -4
 @itemx --ipv4
@@ -420,7 +443,8 @@ The options are followed by the message which should be written to the
 log.  If not specified, and the @option{-f} flag is not provided,
 standard input is logged.
 
-The logger utility exits 0 on success, and >0 if an error occurs.
+@section Examples
+@anchor{logger examples}
 
 The following examples illustrate the usage of the @command{logger}
 command:
@@ -437,7 +461,7 @@ logger System rebooted
 @samp{local0.err}.  Mark each message with tag @samp{cmd}:
 
 @example
-command 2>&1 | logger -p local0.notice -t cmd
+command 2>&1 | logger -p local0.err -t cmd
 @end example
 
 @item Log each line from file @file{warnings} to channel
@@ -445,8 +469,8 @@ command 2>&1 | logger -p local0.notice -t cmd
 using the source IP @samp{10.10.10.1}:
 
 @example
-logger -p daemon.warn -h logger.runasimi.org -S 10.10.10.1 --file
-warnings
+logger -p daemon.warn -h logger.runasimi.org -S 10.10.10.1  \
+@verb{|       |}--file warnings
 @end example
 @end enumerate
 
@@ -458,16 +482,48 @@ warnings
 @c of ping.  A user doesn't need to know that we are using TIMEVAL, or
 @c how things are padded.
 
-@command{ping} uses the ICMP protocol's mandatory @code{ECHO_REQUEST}
-datagram to elicit an ICMP @code{ECHO_RESPONSE} from a host or
-gateway.  @code{ECHO_REQUEST} datagrams (@dfn{pings}) have an IP and
-ICMP header, followed by a @dfn{struct timeval} and then an arbitrary
-number of @dfn{pad} bytes used to fill out the packet.
+@command{ping} uses @acronym{ICMP} datagrams to provoke a response
+from the chosen destination host, mainly intending to probe
+whether it is alive.
+
+The used datagram, of type @code{ECHO_REQUEST}, contains some header
+information and some additional payload, usually a time stamp.
+By a suitable choice of payload, different host or router properties
+are detectable, as the emitted datagram travels to its destination.
+
+@ignore %* Too detailed for end user.
+@command{ping} uses the @acronym{ICMP} protocol's mandatory
+@code{ECHO_REQUEST} datagram to elicit an ICMP @code{ECHO_RESPONSE}
+from a host or gateway.
+@code{ECHO_REQUEST} datagrams (@dfn{pings}) have an @acronym{IP} and
+an @acronym{ICMP} header, followed by a @dfn{struct timeval} and then
+an arbitrary number of @dfn{padding} bytes used to fill out the packet.
+@end ignore
+
+@noindent
+Synopsis:
 
 @example
 ping [@var{option}@dots{}] @var{host}@dots{}
 @end example
 
+@noindent
+Sending echo requests is the standard use of @command{ping},
+but by far not the only use case.
+
+@menu
+* Ping options::
+* Fault isolation::
+* Duplicate and damaged packets::
+* Data patterns::
+* TTL details::
+* Further remarks::
+@end menu
+
+@node Ping options
+@section Command line options
+@anchor{ping options}
+
 @c Options controlling ICMP request types:
 @c       --address              Send ICMP_ADDRESS packets (root only)
 @c       --echo                 Send ICMP_ECHO packets (default)
@@ -475,19 +531,18 @@ ping [@var{option}@dots{}] @var{host}@dots{}
 @c       --timestamp            Send ICMP_TIMESTAMP packets
 @c   -t, --type=TYPE            Send TYPE packets
 
-Sending echo requests is the standard use of @command{ping},
-but not the only use case.  Selection of packet type is handled
-with these few options:
+Selection of packet type is handled by these first options:
 
 @table @option
 @item --address
 @opindex --address
 Send ICMP_ADDRESS packets, thus requesting the address netmask
-being in use by the targetted host.
+in use by the targetted host.
 
 @item --echo
 @opindex --echo
-Send ICMP_ECHO requests (default).
+Send ICMP_ECHO requests.
+This is the default action.
 
 @item --mask
 @opindex --mask
@@ -496,12 +551,15 @@ Identical to @option{--address}.
 @item --timestamp
 @opindex --timestamp
 Send ICMP_TIMESTAMP packets, thereby requesting a timed response
-from the targetted host.  In successful cases three time values
-will be returned.  All are expected to state the number of
-milliseconds since midnight UTC.  The first, @samp{icmp_otime},
-contains the original time for sending the request.  Then,
-@samp{icmp_rtime}, is the time of reception by the target, and
-finally, @samp{icmp_ttime}, is the time for transmitting an answer
+from the targetted host.
+
+In successful cases three time values are returned.
+All are expected to state the number of milliseconds since
+midnight@tie{}@acronym{UTC}.
+The first of these, @samp{icmp_otime}, contains the original
+time of sending the request.
+Then comes @samp{icmp_rtime}, the time of reception by the target,
+and finally, @samp{icmp_ttime}, the time of transmitting an answer
 back to the originator.
 
 @item -t @var{type}
@@ -521,6 +579,7 @@ Send @var{type} packets.  Accepted values are @samp{address},
 @c   -T, --tos=NUM              Set type-of-service to NUM
 @c       --ttl=NUMBER           Set specified time-to-live on packet
 
+@noindent
 The following options are available for all packet types:
 
 @table @option
@@ -528,7 +587,8 @@ The following options are available for all packet types:
 @itemx --count=@var{n}
 @opindex -c
 @opindex --count
-Stop after sending (and receiving) @var{n} ECHO_RESPONSE packets.
+Stop after sending and receiving answers to a total of
+@var{n} packets.
 
 @item -d
 @itemx -debug
@@ -540,23 +600,23 @@ Set the SO_DEBUG option on the socket being used.
 @itemx --interval=@var{n}
 @opindex -i
 @opindex --interval
-Wait @var{n} seconds between sending each packet.  The default is to
-wait for one second between each packet.  This option is incompatible
-with the @option{-f} option.
+Wait @var{n} seconds until sending next packet.
+The default is to wait for one second between packets.
+This option is incompatible with the option @option{-f}.
 
 @item -n
 @itemx --numeric
 @opindex -n
 @opindex --numeric
-Numeric output only.  No attempt will be made to lookup symbolic names
-for host addresses.
+Numeric output only.  No attempt will be made to resolve
+symbolic names for host addresses.
 
 @item -r
 @itemx --ignore-routing
 @opindex -r
 @opindex --ignore-routing-log
 Bypass the normal routing tables and send directly to a host on an
-attached network.  If the host is not on a directly-attached network,
+attached network.  If the host is not on a directly attached network,
 an error is returned.  This option can be used to ping a local host
 through an interface that has no route through it (e.g., after the
 interface was dropped by @command{routed}).
@@ -565,7 +625,8 @@ interface was dropped by @command{routed}).
 @itemx --tos=@var{num}
 @opindex -T
 @opindex --tos
-Set type-of-service, TOS, to NUM on transmitted packets.
+Set type-of-service, @acronym{TOS} field, to @var{num} on
+transmitted packets.
 
 @item --ttl=@var{n}
 @opindex --ttl
@@ -612,25 +673,26 @@ the targeted host, or the intermediary routers for that matter.
 @opindex -f
 @opindex --flood
 Flood ping.  Outputs packets as fast as they come back or one hundred
-times per second, whichever is more.  For every ECHO_REQUEST sent a
-period @samp{.} is printed, while for every ECHO_REPLY received a
-backspace is printed.  This provides a rapid display of how many
-packets are being dropped.  Only the super-user may use this option.
+times per second, whichever is more.  For every ECHO_REQUEST packet
+sent, a period @samp{.} is printed, while for every ECHO_REPLY
+received in reply, a backspace is printed.
+This provides a rapid display of how many packets are being dropped.
+Only the super-user may use this option.
 This can be very hard on a network and should be used with caution.
 
 @item --ip-timestamp=@var{flag}
 @opindex --ip-timestamp
-Include IP option Timestamp in transmitted packets.  The value
-@var{flag} is either of @samp{tsonly}, which only records up to nine
-time stamps, and @samp{tsaddr}, which records IP addresses as well
-as time stamps for at most four hosts.
+Include @acronym{IP} option Timestamp in transmitted packets.
+The value @var{flag} is either @samp{tsonly}, which only records up
+to nine time stamps, or @samp{tsaddr}, which records @acronym{IP}
+addresses as well as time stamps, but for at most four hosts.
 
 @item -l @var{n}
 @itemx --preload=@var{n}
 @opindex -l
 @opindex --preload
 If @var{n} is specified, ping sends that many packets as fast as
-possible before falling into its normal mode of behavior.
+possible before falling into its normal mode of operation.
 
 @item -p @var{pat}
 @itemx --pattern=@var{pat}
@@ -652,7 +714,8 @@ Do not print timing for each transmitted packet.
 @opindex --route
 Record route.  Includes the @code{RECORD_ROUTE} field in the
 ECHO_REQUEST packet and displays the route buffer on returned packets.
-Note that the IP header is only large enough for nine such routes.
+Note that the @acronym{IP} header is only large enough for nine
+such routes.
 Many hosts ignore or discard this option.
 
 @item -s @var{n}
@@ -660,10 +723,11 @@ Many hosts ignore or discard this option.
 @opindex -s
 @opindex --size
 Specifies the number of data bytes to be sent.  The default is 56,
-which translates into 64 ICMP data bytes when combined with the 8
-bytes of ICMP header data.
+which translates into 64@tie{}@acronym{ICMP} data bytes, taking
+the 8@tie{}bytes of @acronym{ICMP} header data into account.
 @end table
 
+@node Fault isolation
 @section Using ping for network fault isolation
 
 When using @command{ping} for fault isolation, it should first be run
@@ -684,13 +748,15 @@ unwise to use ping during normal operations or from automated scripts.
 @ignore
 @section ICMP Packet Details
 
-An IP header without options is 20 bytes.  An ICMP ECHO_REQUEST packet
-contains an additional 8 bytes worth of ICMP header followed by an
-arbitrary amount of data.  When a packetsize is given, this indicated
-the size of this extra piece of data (the default is 56).  Thus the
-amount of data received inside of an IP packet of type ICMP ECHO_REPLY
-will always be 8 bytes more than the requested data space (the ICMP
-header).
+An @acronym{IP} header without options consists of 20 bytes.
+An @acronym{ICMP} ECHO_REQUEST packet contains an additional
+8 bytes worth of @acronym{ICMP} header followed by an arbitrary
+amount of data.
+When a packet size is stated, that indicates
+the size of the extra piece of data (the default is 56).
+Thus the amount of data received as an @acronym{IP} packet
+of type @acronym{ICMP} ECHO_REPLY, will always be 8 bytes larger
+than the requested data space (the @acronym{ICMP} header).
 
 If the data space is at least eight bytes large, ping uses the first
 eight bytes of this space to include a timestamp which it uses in the
@@ -698,7 +764,8 @@ computation of round trip times.  If less than eight bytes of pad are
 specified, no round trip times are given.
 @end ignore
 
-@section Duplicate And Damaged Packets
+@node Duplicate and damaged packets
+@section Duplicate and damaged packets
 
 Ping will report duplicate and damaged packets.  Duplicate packets
 should never occur, and seem to be caused by inappropriate link-level
@@ -710,7 +777,8 @@ Damaged packets are obviously serious cause for alarm and often
 indicate broken hardware somewhere in the ping packet's path (in the
 network or in the hosts).
 
-@section Trying Different Data Patterns
+@node Data patterns
+@section Trying different data patterns
 
 The (inter)network layer should never treat packets differently
 depending on the data contained in the data portion.  Unfortunately,
@@ -731,175 +799,271 @@ that takes much longer to transfer than other similar length files.
 You can then examine this file for repeated patterns that you can test
 using the @option{-p} option of ping.
 
-@section TTL Details
+@node TTL details
+@section TTL details
 
-The TTL, Time To Live value of an IP packet represents the maximum
-number of IP routers that the packet can go through before being
-thrown away.  In current practice you can expect each router in the
-Internet to decrement the TTL field by exactly one.
+The @acronym{TTL} field, @dfn{Time To Live}, of an @acronym{IP}
+packet represents the maximum number of @acronym{IP} routers
+that the packet can go through before being discarded.
+In current practice you can expect each router on the
+Internet to decrement the @acronym{TTL} field by exactly one.
 
-The TCP/IP specification states that the TTL field for TCP packets
-should be set to 60, but many systems use smaller values (4.3 BSD uses
-30, 4.2 used 15).
+The TCP/IP specification states that the @acronym{TTL} field
+of a new @acronym{TCP} packet should be set to 60,
+but many systems use smaller values (4.3BSD uses 30
+and 4.2BSD used 15).
 
 The maximum possible value of this field is 255, and most UNIX systems
-set the TTL field of ICMP (@code{ECHO_REQUEST}) packets to 255.  This
-is why you will find you can ping some hosts, but not reach them with
-@command{telnet} or @command{ftp}.
+set the @acronym{TTL} field of @acronym{ICMP} (type @code{ECHO_REQUEST})
+packets to 255.  This is why you will find you can ping some hosts,
+but not reach them with @command{telnet} or @command{ftp}.
 
-In normal operation @command{ping} prints the TTL value from the
-packet it receives.  When a remote system receives a ICMP packet, it
-can do one of three things with the TTL field in its response:
+During normal operation, @command{ping} prints the @acronym{TTL} value
+for every packet it receives.
+When a remote system receives an @acronym{ICMP} packet,
+it can do one of three things to the @acronym{TTL} field
+in its response packet:
 
-@table @bullet
+@itemize @bullet
 @item
-Not change it; this is what Berkeley UNIX systems did before the
-4.3BSD-Tahoe release.  In this case the TTL value in the received
-packet will be 255 minus the number of routers in the round-trip path.
+Not to change it.  This is what Berkeley UNIX systems did before the
+4.3BSD-Tahoe release.  In this case the @acronym{TTL} value in the
+received packet will be 255 minus the number of routers in the
+round-trip path.
 
 @item
-Set it to 255; this is what current Berkeley UNIX systems do.  In this
-case the @code{TTL} value in the received packet will be 255 minus the
+Set it to 255.  This is what current Berkeley UNIX systems do.  In this
+case the @acronym{TTL} value in the received packet will be 255 minus the
 number of routers in the path from the remote system to the pinging
 host.
 
 @item
-Set it to some other value.  Some machines use the same value for ICMP
-packets that they use for TCP packets, for example either 30 or 60.
-Others may use completely wild values.
+Set it to some other value.  Some machines use the same value for
+@acronym{ICMP} packets that they use for @acronym{TCP} packets,
+for example either 30 or 60.
+Others may use completely arbitrary values.
 
-@end table
+@end itemize
 
+@node Further remarks
+@section Further observations
 Many hosts and gateways ignore the @code{RECORD_ROUTE} field, since
-the maximum IP header length is far to small to hold all the routes.
-There's not much that can be done about this.
+the maximum @acronym{IP} header length is far to small to hold all
+the routes.
+There is not much that can be done about this.
 
 Flood pinging is not recommended in general, and flood pinging the
 broadcast address should only be done under very controlled
 conditions.
 
+Some BSD variants offer a kernel setting to inhibit all replies
+to ICMP_MASKREQ packets.
+This setting can detected using
+
+@example
+$ sysctl net.inet.icmp.maskrepl
+net.inet.icmp.maskrepl: 0
+@end example
+
+@noindent
+where a value 1 would be needed for sending a reply, and where 0
+means that any request is simply dropped.
+FreeBSD goes even further by providing a faked netmask:
+
+@example
+# sysctl -w net.inet.icmp.maskfake=`expr 255 + 252 \* 256`
+net.inet.icmp.maskfake: 0 -> 64767
+@end example
+
+@noindent
+thus setting the netmask to @samp{255.252.0.0} on a little
+endian architecture.
+
 @node traceroute invocation
 @chapter @command{traceroute}: Trace the route to a host
 @cindex traceroute
 
-@command{traceroute} traces the route packets take to a host.
+@command{traceroute} prints a trace of the route
+@acronym{IP}@tie{}packets are travelling to a remote host.
+
+@noindent
 Synopsis:
 
 @example
 traceroute [@var{option}@dots{}] @var{host}
 @end example
 
+@section Command line options
+@anchor{traceroute options}
+
 @table @option
 @item -M @var{method}
 @itemx --type=@var{method}
 @opindex -M
 @opindex --type
-Use @var{method} (@samp{icmp} or @samp{udp}) for traceroute
-operations.
+Use @var{method} as carrier packets for traceroute operations.
+Supported choices are @samp{icmp} and @samp{udp}.
 
 @item -p @var{port}
 @itemx --port=@var{port}
 @opindex -p
 @opindex --port
-Use destination @var{port} (default: 33434).
+Set destination port of target to @var{port}.
+The default value is 33434.
 
 @item -q @var{num}
 @itemx --tries=@var{num}
 @opindex -q
 @opindex --tries
-Send @var{num} probe packets per hop (default: 3).
+Send a total of @var{num} probe packets per hop, defaulting to 3.
 
 @item --resolve-hostnames
 @opindex --resolve-hostnames
-Resolve hostnames.
+Attempt to resolve all addresses as hostnames.
 
 @item -t @var{num}
 @itemx --tos=@var{num}
 @opindex -t
 @opindex --tos
-Set type-of-service, TOS, to NUM on transmitted packets.
+Set type-of-service, @acronym{TOS} field, to @var{num} on
+transmitted packets.
 @end table
 
 @node whois invocation
-@chapter @command{whois}: Whois user interface
+@chapter @command{whois}: User interface to WHOIS data bases.
 @cindex whois
 
+The functionality of a world wide Internet is dependent on
+stored node information of different kinds.
+Registrars keep much relevant material in WHOIS data bases.
+This utility @command{whois} is able to query those sources
+for general and for particular properties of most domains.
+
+For many domains there are names of suitable data base servers
+hard coded into @command{whois}, ready to query for domain
+relevant information.
+Since servers' names do change from time to time,
+this utility might occasionally need some guidance using
+a suitable command line option.
+
+@noindent
 Synopsis:
 
 @example
-whois [@var{OPTION}]... @var{OBJECT}...
+whois [@var{OPTION}@dots{}] @var{OBJECT}@dots{}
 @end example
 
+@section Command line options
+@anchor{whois options}
+
 @table @option
 @item -a
-Search all databases.
+@opindex -a
+Search all data bases.
 
 @item -F
-Fast raw output (implies -r).
+@opindex -F
+Fast and raw output. Implies @option{-r}.
 
-@item -g SOURCE:FIRST-LAST
-Find updates from SOURCE from serial FIRST to LAST.
+@item -g @var{source}:@var{first}-@var{last}
+@opindex -g
+Find updates for an object from provider @var{source},
+starting from the version with serial key @var{first},
+and ending with serial key @var{last}.
 
-@item -h HOST
-Connect to server HOST.
+@item -h @var{host}
+@itemx --server=@var{host}
+@opindex -h
+@opindex --server
+Connect to server @var{host}.
 
 @item -H
+@opindex -H
 Hide legal disclaimers.
 
-@item -i ATTR[,ATTR]...
+@item -i @var{attr}[,@var{attr2}@dots{}]
+@opindex -i
 Do an inverse lookup for specified attributes.
+Use a comma separated list for multiple attributes.
 
 @item -l
-One level less specific lookup (RPSL only).
+@opindex -l
+One level less specific lookup.
+Applies to @acronym{RPSL} only.
 
 @item -L
-Find all Less specific matches.
+@opindex -L
+Find all less specific matches.
+
+@item -m
+@opindex -m
+Find more specific matches, one level deeper.
 
 @item -M
-Find all More specific matches.
+@opindex -M
+Find all more specific matches.
 
-@item -m
-Find first level more specific matches.
+@item -p @var{port}
+@opindex -p
+Connect to server port @var{port}.
+
+@item -q @{version|sources@}
+@opindex -q
+Query specified server info.
+Applies to @acronym{RPSL} only.
 
 @item -r
+@opindex -r
 Turn off recursive lookups.
 
-@item -p PORT
-Connect to PORT.
-
 @item -R
-Force to show local copy of the domain object even if it contains
-referral.
-
-@item -S
-Tell server to leave out syntactic sugar.
+@opindex -R
+Force output to show local copy of the domain object,
+even if it contains a referral.
 
-@item -s SOURCE[,SOURCE]...
-Search the database from SOURCE.
+@item -s @var{source}[,@var{source2}@dots{}]
+@opindex -s
+Search the data base at @var{source}.
+A comma separated list queries multiple providers.
 
-@item -T TYPE[,TYPE]...
-Only look for objects of TYPE.
+@item -S
+@opindex -S
+Tell server to refrain from syntactic sugar.
 
-@item -q [version|sources]
-Query specified server info (RPSL only).
+@item -t @var{type}
+@opindex -t
+Request a template for objects of type @var{type}.
+Use the value @samp{all} for a list of possible types.
 
-@item -t TYPE
-Requests template for object of TYPE ('all' for a list).
+@item -T @var{type}[,@var{type2}@dots{}]
+@opindex -T
+Search only for objects of type @var{type}.
+A comma separated list allows for multiple types.
 
-@item -v TYPE
-Requests verbose template for object of TYPE.
+@item -V
+@itemx --verbose
+@opindex -V
+@opindex --verbose
+Verbosely explain all actions taken.
 
 @item -x
-Exact match only (RPSL only).
+@opindex -x
+Search only for exact matches.
+Applicable only to @acronym{RPSL}.
 @end table
 
+
 @node ftp invocation
 @chapter @command{ftp}: FTP client
 @cindex ftp
 
-@command{ftp} is the user interface for FTP, File Transfer Protocol.
+@command{ftp} is the user interface to @acronym{FTP},
+the File Transfer Protocol.
 The program allows a user to transfer files to and from a remote
-network site.  Synopsis:
+network site.
+
+@noindent
+Synopsis:
 
 @example
 ftp [@var{option}@dots{}] [@var{host} [@var{port}]]
@@ -909,7 +1073,34 @@ pftp [@var{option}@dots{}] [@var{host} [@var{port}]]
 @noindent
 The alternate name @command{pftp} is starting in passive mode,
 but is otherwise identical to @command{ftp}.
-The available command line options are as follows:
+
+The client host with which @command{ftp} is to communicate may be
+specified on the command line.
+If this is done, @command{ftp} will immediately attempt to establish
+a connection to the @acronym{FTP} server running on that host.
+Otherwise, the program will start a command interpreter and will await
+further instructions from the user.
+Commands can either be entered interactively,
+or piped as a batched job read from standard input.
+@command{ftp} is able to distinguish between these two modes
+of operation.
+
+@menu
+* Ftp options::
+* Ftp commands::
+* Ftp environment::
+* The .netrc file::
+* Aborting a file transfer::
+* File naming conventions::
+* File transfer parameters::
+@end menu
+
+@node Ftp options
+@section Command line options
+@anchor{ftp options}
+
+Many command line options have counterparts among the
+commands handled by the internal interpreter.
 
 @table @option
 @item -4
@@ -968,14 +1159,14 @@ Turns off interactive prompting during multiple file transfers.
 @opindex --no-login
 Restrains @command{ftp} from attempting @dfn{auto-login} upon initial
 connection.  If auto-login is enabled, @command{ftp} will check the
-@file{.netrc} (@pxref{The .netrc File}) file in the user's home
+@file{.netrc} (@pxref{The .netrc file}) file in the user's home
 directory for an entry describing an account on the remote machine.
 If no entry exists, @command{ftp} will prompt for the remote machine
 login name (default is the user identity on the local machine), and,
 if necessary, prompt for a password and an account with which to
 login.
 
-@itemx --prompt[=@var{prompt}]
+@item --prompt[=@var{prompt}]
 @opindex --prompt
 Print a command-line prompt, even if not on a tty.  If @var{prompt} is
 supplied, its value is used instead of the default @samp{ftp> }.
@@ -995,24 +1186,18 @@ Start in verbose mode, printing informational messages.
 This is default for interactive mode.
 @end table
 
-@menu
-* Commands::
-* Aborting A File Transfer::
-* File Naming Conventions::
-* File Transfer Parameters::
-* The .netrc File::
-@end menu
+@node Ftp commands
+@section Commands interpreted by @command{ftp}
 
-@node Commands
-@section Commands
+When @command{ftp} is awaiting commands from the user,
+a prompt is displayed.
+The default string is @samp{ftp>}, but it can been
+changed in a command line option, perhaps to enhance
+uniqueness for recording a session.
 
-The client host with which @command{ftp} is to communicate may be
-specified on the command line.  If this is done, @command{ftp} will
-immediately attempt to establish a connection to an FTP server on that
-host; otherwise, it will enter its command interpreter and await
-instructions from the user.  When @command{ftp} is awaiting commands
-from the user the prompt @samp{ftp>} is provided to the user.  The
-following commands are recognized by @command{ftp}:
+Be aware that correct execution of many commands depends upon the
+proper behavior of the remote server.
+The following commands are recognized by @command{ftp} itself, though:
 
 @table @code
 @item ! [@var{command} [@var{args}]]
@@ -1055,37 +1240,41 @@ Terminate the FTP session with the remote server and exit
 exit.
 
 @item case
-Toggle remote computer file name case mapping during @code{mget}
-commands.  When case is on (default is off), remote computer file
-names with all letters in upper case are written in the local
-directory with the letters mapped to lower case.
+Toggle the remote computer's use of letter case mapping during
+@code{mget} commands.
+When @code{case} is @samp{on},
+a file name at the remote site whose every letter appear
+in upper case, will be renamed in such a way that all letters
+are changed to lower case for a local copy of the same file.
+The default setting is @samp{off},
 
 @item cd @var{remote-directory}
 Change the working directory on the remote machine to
-remote-directory.
+@var{remote-directory}.
 
 @item cdup
-Change the remote machine working directory to the parent of the
-current remote machine working directory.
+Change the remote machine's working directory to the parent of the
+current working directory.
 
 @item chmod @var{mode} @var{file-name}
-Change the permission modes of the file @var{file-name} on the remote
+Change the access permission of the file @var{file-name} on the remote
 sytem to @var{mode}.
 
 @item close
 @itemx disconnect
-Terminate the FTP session with the remote server, and return to the
-command interpreter.  Any defined macros are erased.
+Terminate the @acronym{FTP} session with the remote server,
+and return to the command interpreter.
+Any defined macros are erased.
 
 @item cr
 Toggle carriage return stripping during ASCII type file retrieval.
 Records are denoted by a carriage return/linefeed sequence during
-ASCII type file transfer.  When @code{cr} is on (the default),
+ASCII type file transfer.  When @code{cr} is @samp{on} (the default),
 carriage returns are stripped from this sequence to conform with the
 UNIX single linefeed record delimiter.  Records on non-UNIX remote
 systems may contain single linefeeds; when an ASCII type transfer is
 made, these linefeeds may be distinguished from a record delimiter
-only when cr is off.
+only when @code{cr} is @samp{off}.
 
 @item delete @var{remote-file}
 Delete the file @var{remote-file} on the remote machine.
@@ -1103,8 +1292,8 @@ Print a listing of the directory contents in the directory,
 prompt the user to verify that the last argument is indeed the target
 local file for receiving dir output.  If no directory is specified,
 the current working directory on the remote machine is used.  If no
-local file is specified, or @var{local-file} is @samp{-}, output comes
-to the terminal.
+local file is specified, or @var{local-file} is a dash @samp{-},
+output goes to the terminal.
 
 @item epsv4
 Toggle the use of EPSV/EPRT for IPv4 addressing.  Default is off.
@@ -1121,24 +1310,27 @@ Retrieve the @var{remote-file} and store it on the local machine.  If
 the local file name is not specified, it is given the same name it has
 on the remote machine, subject to alteration by the current
 @code{case}, @code{ntrans}, and @code{nmap} settings.  The current
-settings for type, form, mode, and structure are used while
+settings for @code{type}, @code{form}, @code{mode},
+and @code{structure} are used while
 transferring the file.
 
 @item glob
-Toggle filename expansion for @code{mdelete}, @code{mget} and
+Toggle file name expansion for @code{mdelete}, @code{mget}, and
 @code{mput}.  If globbing is turned off with @code{glob}, the file
-name arguments are taken literally and not expanded.  Globbing for
-@code{mput} is done as in @command{csh}.  For @code{mdelete} and
+name arguments are taken literally and are not expanded.  Globbing for
+@code{mput} is done as in @command{csh} syntax.
+For @code{mdelete} and
 @code{mget}, each remote file name is expanded separately on the
 remote machine and the lists are not merged.  Expansion of a directory
 name is likely to be different from expansion of the name of an
-ordinary file: the exact result depends on the foreign operating
-system and FTP server, and can be previewed by doing @code{mls
-remote-files -}.
+ordinary file: the exact result depends on the remote operating
+system and on the @acronym{FTP} server, and can be previewed by
+issuing @samp{mls remote-files -}.
 
 Note: @code{mget} and @code{mput} are not meant to transfer entire
-directory subtrees of files.  That can be done by transferring a
-@command{tar} archive of the subtree (in binary mode).
+directory subtrees of files.  That can be achieved by transferring
+an already created @command{tar} or @command{cpio} archive of the
+subtree, then making certain that @command{ftp} uses binary mode.
 
 @item hash [@var{size}]
 Toggle hash-sign (@samp{#}) printing for each data block transferred.
@@ -1172,24 +1364,31 @@ specified, the user's home directory is used.
 Print a listing of the contents of a directory on the remote machine.
 The listing includes any system-dependent information that the server
 chooses to include; for example, most UNIX systems will produce output
-from the command @command{ls -l}. If @var{remote}-directory is left
-unspecified, the current working directory is used.  If interactive
-prompting is on, @command{ftp} will prompt the user to verify that the
-last argument is indeed the target local file for receiving ls output.
-If no local file is specified, or if @var{local-file} is @samp{-}, the
-output is sent to the terminal.
+like the command @command{ls -l} does.
+Use @code{nlist} for a simple file listing.
+
+If @var{remote-directory} is left unspecified, the current working
+directory is used.  With interactive prompting set,
+@command{ftp} will prompt the user to verify that the
+last argument is indeed the intended local file for storing output.
+Should no local file be specified, or if @var{local-file} is a
+dash@tie{}@samp{-}, then output is sent to the terminal.
 
 @item macdef @var{macro-name}
 Define a macro called @var{macro-name}, with subsequent lines as the
-macro definition; a null line (consecutive newline characters in a
-file or carriage returns from the terminal) terminates macro input
-mode.  There is a limit of 16 macros and 4096 total characters in all
-defined macros.  Macros remain defined until a close command is
-executed.  The macro processor interprets @samp{$} and @samp{\} as
+macro definition. A null line (consecutive newline characters in a
+file, or carriage returns from the terminal) terminates macro input
+mode.  There is a limit of 16 macros and a total of 4096 characters
+in all defined macros.
+Macros remain defined until a close command is executed.
+
+The macro processor interprets @samp{$} and @samp{\} as
 special characters.  A @samp{$} followed by a number (or numbers) is
 replaced by the corresponding argument on the macro invocation command
-line.  A @samp{$} followed by an @samp{i} signals that macro processor
-that the executing macro is to be looped.  On the first pass @samp{$i}
+line.
+A @samp{$} followed by the letter @samp{i} tells the macro processor
+that the macro is to perform a loop.
+On the first pass @samp{$i}
 is replaced by the first argument on the macro invocation command
 line, on the second pass it is replaced by the second argument, and so
 on.  A @samp{\} followed by any character is replaced by that
@@ -1197,19 +1396,20 @@ character.  Use the @samp{\} to prevent special treatment of the
 @samp{$}.
 
 @item mdelete [@var{remote-files}]
-Delete the remote-files on the remote machine.
+Delete all @var{remote-files} on the remote machine.
 
 @item mdir @var{remote-files} @var{local-file}
 Like @code{dir}, except multiple remote files may be specified.  If
 interactive prompting is on, @command{ftp} will prompt the user to
-verify that the last argument is indeed the target local file for
-receiving @code{mdir} output.
+verify that the last argument is indeed the intended local file for
+storing any output from @code{mdir}.
 
 @item mget @var{remote-files}
-Expand the @var{remote-files} on the remote machine and do a get for
-each file name thus produced.  Resulting file names will then be
-processed according to @code{case}, @code{ntrans}, and @code{nmap}
-settings.  Files are transferred into the local working directory,
+Expand the @var{remote-files} on the remote machine and execute
+a @code{get} for each file name thus produced.
+Resulting file names will then be processed according to
+@code{case}, @code{ntrans}, and @code{nmap} settings.
+Files are transferred to the local working directory,
 which can be changed with @code{lcd directory}; new local directories
 can be created with @code{! mkdir directory}.
 
@@ -1220,8 +1420,8 @@ Make a directory on the remote machine.
 Like @code{nlist}, except multiple remote files may be specified, and
 the @var{local-file} must be specified.  If interactive prompting is
 on, @command{ftp} will prompt the user to verify that the last
-argument is indeed the target local file for receiving @code{mls}
-output.
+argument is the intended local file for storing output.
+A dash @samp{-} is accepted as last argument without check!
 
 @item mode [@var{mode-name}]
 Set the file transfer mode to @var{mode-name}.  The default mode is
@@ -1231,70 +1431,78 @@ Set the file transfer mode to @var{mode-name}.  The default mode is
 Show the last modification time of the file on the remote machine.
 
 @item mput @var{local-files}
-Expand wild cards in the list of local files given as arguments and do
-a put for each file in the resulting list.  Resulting file names will
-then be processed according to @code{ntrans} and @code{nmap} settings.
+Consider the arguments to be local names and expand any wild card.
+Execute a @code{put} for each file in the resulting list.
+The remote file names are then computed by use of
+@code{ntrans} and @code{nmap} settings.
 
 @item newer @var{file-name}
 Get the file only if the modification time of the remote file is more
-recent that the file on the current system.  If the file does not
+recent than the file on the current system.  If the file does not
 exist on the current system, the remote file is considered newer.
-Otherwise, this command is identical to get.
+In other respects, this command is identical to @code{get}.
 
 @item nlist [@var{remote-directory}] [@var{local-file}]
 Print a list of the files in a directory on the remote machine.  If
 @var{remote-directory} is left unspecified, the current working
 directory is used.  If interactive prompting is on, @command{ftp} will
-prompt the user to verify that the last argument is indeed the target
-local file for receiving nlist output.  If no local file is specified,
+prompt the user to verify that the last argument is the intended
+local file for storing output.  If no local file is specified,
 or if @var{local-file} is @samp{-}, the output is sent to the
 terminal.
 
 @item nmap [@var{inpattern} @var{outpattern}]
-Set or unset the filename mapping mechanism.  If no arguments are
-specified, the filename mapping mechanism is unset.  If arguments are
-specified, remote filenames are mapped during @code{mput} commands and
+Set or unset the file name mapping mechanism.  If no arguments are
+specified, the file name mapping mechanism is unset.
+Name mapping is applied during @code{mput} and
 @code{put} commands issued without a specified remote target filename.
-If arguments are specified, local filenames are mapped during
-@code{mget} commands and @code{get} commands issued without a
-specified local target filename.  This command is useful when
+It as also applied to local file names during
+@code{mget} and @code{get} commands issued without
+local target file name.  This command is useful when
 connecting to a non-UNIX remote computer with different file naming
 conventions or practices.
 
 The mapping follows the pattern set by @var{inpattern} and
-@var{outpattern}.  The template @var{inpattern} is used for incoming
+@var{outpattern}.  The template @var{inpattern} is used on incoming
 filenames (which may have already been processed according to the
-@code{ntrans} and case settings).  Variable templating is accomplished
+@code{ntrans} and @code{case} settings).
+Variable templating is accomplished
 by including the sequences @samp{$1}, @samp{$2}, @dots{}, @samp{$9} in
 @var{inpattern}.  Use @samp{\} to prevent this special treatment of
-the @samp{$} character.  All other characters are treated literally,
-and are used to determine the @code{nmap} @var{inpattern} variable
-values.
-
-For example, given inpattern @samp{$1.$2} and the remote file name
-@file{mydata.data}, @samp{$1} would have the value @samp{mydata}, and
-@samp{$2} would have the value @samp{data}.  The @var{outpattern}
-determines the resulting mapped filename.  The sequences @samp{$1},
-@samp{$2}, @dots{}., @samp{$9} are replaced by any value resulting
-from the @var{inpattern} template.  The sequence @samp{$0} is replaced
-by the original filename.  Additionally, the sequence
-@samp{[@var{seq1}, @var{seq2}]} is replaced by @var{seq1} if
-@var{seq1} is not a null string; otherwise it is replaced by
-@var{seq2}.  For example, the command
+the character @kbd{$}.  All other characters are treated literally,
+and must be matched in a file name for @var{inpattern}
+to bind substrings to variables.
+
+For example, take a pattern @samp{$1.$2} and a file name
+@file{mydata.data}.
+Then @samp{$1} would have the value @samp{mydata}, and
+@samp{$2} would be @samp{data}.
+
+@var{outpattern} determines the final file name.
+The sequences @samp{$1} to @samp{$9} are
+replaced by any values bound to them by @var{inpattern}.
+A special sequence @samp{$0} always contains the original filename.
+In addition, a bracketted sequence @samp{[@var{seq1},@var{seq2}]}
+expands to @var{seq1} if @var{seq1} contains a non-empty string,
+and expands to @var{seq2} otherwise.  For example, the command
 
 @example
 nmap $1.$2.$3 [$1,$2].[$2,file]
 @end example
 
-would yield the output filename @file{myfile.data} for input filenames
-@file{myfile.data} and @file{myfile.data.old}, @file{myfile.file} for
-the input filename @file{myfile}, and @file{myfile.myfile} for the
-input filename @file{.myfile}.
+would yield the output file name @file{myfile.data} for input names
+@file{myfile.data} and @file{myfile.data.old},
+but produces @file{myfile.file} from the input @file{myfile},
+and @file{myfile.myfile} from @file{.myfile}.
+
+Spaces may be included in @var{outpattern}, but are easily removed:
 
-Spaces may be included in @var{outpattern}, as in the example:
-@code{nmap $1 sed "s/ *$//" > $1}.  Use the @samp{\} character to
-prevent special treatment of the @samp{$}, @samp{[}, @samp{]}, and
-@samp{,} characters.
+@smallexample
+nmap $1 |sed "s/ *$//" > $1
+@end smallexample
+
+Use a backslash @kbd{\} to escape the characters
+@kbd{$}, @kbd{[}, @kbd{]}, and @kbd{,}.
 
 @item ntrans [@var{inchars} [@var{outchars}]]
 Set or unset the filename character translation mechanism.  If no
@@ -1314,11 +1522,12 @@ character's position in @var{inchars} is longer than the length of
 @var{outchars}, the character is deleted from the file name.
 
 @item open @var{host} [@var{port}]
-Establish a connection to the specified host FTP server.  An optional
-port number may be supplied, in which case, @command{ftp} will attempt
-to contact an FTP server at that port.  If the @code{autologin} option
-is on (default), @command{ftp} will also attempt to automatically log
-the user in to the FTP server.
+Establish a connection to the specified @acronym{FTP} server
+at @var{host}.  An optional port number may be supplied,
+in which case, @command{ftp} will attempt to contact the server
+at that specific @acronym{TCP} port.  If the @code{autologin} option
+is on (is so by default), @command{ftp} will also attempt to
+automatically log the user in to the FTP server.
 
 @item passive
 Toggle passive mode.  If passive mode is turned on (default is off),
@@ -1348,9 +1557,9 @@ store files.  If prompting is turned off (default is on), any
 Execute an @command{ftp} command on a secondary control connection.
 This command allows simultaneous connection to two remote FTP servers
 for transferring files between the two servers.  The first proxy
-command should be an open, to establish the secondary control
-connection.  Enter the command @code{proxy ?} to see other ftp
-commands executable on the secondary connection.  The following
+command should be @code{open}, to establish the secondary control
+connection.  Enter the command @code{proxy ?} to see other
+commands usable for the secondary connection.  The following
 commands behave differently when prefaced by @code{proxy}: @code{open}
 will not define new macros during the auto-login process, @code{close}
 will not erase existing macro definitions, @code{get} and @code{mget}
@@ -1358,8 +1567,10 @@ transfer files from the host on the primary control connection to the
 host on the secondary control connection, and @code{put}, @code{mput},
 and @code{append} transfer files from the host on the secondary
 control connection to the host on the primary control connection.
-Third party file transfers depend upon support of the FTP protocol
-@code{PASV} command by the server on the secondary control connection.
+
+Note that the protocol command @code{PASV} must be understood
+by the server on the secondary control connection for this kind
+of file transfer to succeed.
 
 @item put @var{local-file} [@var{remote-file}]
 @itemx send @var{local-file} [@var{remote-file}]
@@ -1376,23 +1587,24 @@ Print the name of the current working directory on the remote machine.
 The arguments specified are sent, verbatim, to the remote FTP server.
 
 @item reget @var{remote-file} [@var{local-file}]
-@code{Reget} acts like @code{get}, except that if @var{local-file}
-exists and is smaller than @var{remote-file}, @var{local-file} is
+@code{reget} acts like @code{get}, except that if @var{local-file}
+exists and is smaller than @var{remote-file}, then @var{local-file} is
 presumed to be a partially transferred copy of @var{remote-file} and
 the transfer is continued from the apparent point of failure.  This
 command is useful when transferring very large files over networks
 that are prone to dropping connections.
 
-@item remotehelp [@var{command-name}]
-Request help from the remote FTP server.  If a command-name is
-specified it is supplied to the server as well.
+@item rhelp [@var{command-name}]
+Request help from the remote @acronym{FTP} server.
+If @var{command-name} is specified it is passed to the server as well.
 
-@item remotestatus [@var{file-name}]
+@item rstatus [@var{file-name}]
 With no arguments, show status of remote machine.  If filename is
 specified, show status of @var{file-name} on remote machine.
 
-@item rename [@var{from}] [@var{to}]
-Rename the file from on the remote machine, to the file to.
+@item rename [@var{from}] [@var{to}]]
+Rename the file @var{from} on the remote machine as @var{to}.
+Name mapping takes effect without @var{to}.
 
 @item reset
 Clear reply queue.  This command re-synchronizes command/reply
@@ -1402,17 +1614,18 @@ server.
 
 @item restart @var{marker}
 Restart the immediately following @code{get} or @code{put} at the
-indicated marker.  On UNIX systems, marker is usually a byte offset
-into the file.
+indicated marker.  On UNIX systems, @code{marker} is usually
+a byte offset into the file.
 
 @item rmdir @var{directory-name}
 Delete a directory on the remote machine.
 
 @item runique
-Toggle storing of files on the local system with unique filenames.  If
-a file already exists with a name equal to the target local filename
-for a @code{get} or @code{mget} command, a @samp{.1} is appended to
-the name.  If the resulting name matches another existing file, a
+Toggle the storing of files on the local system with unique filenames.
+If a file already exists with a name equal to the inteded local file
+name for a @code{get} or @code{mget} command,
+then a string @samp{.1} is appended to the name.
+If the resulting name matches another existing file,
 @samp{.2} is appended to the original name.  If this process continues
 up to @samp{.99}, an error message is printed, and the transfer does
 not take place.  The generated unique filename will be reported.  Note
@@ -1442,7 +1655,8 @@ Show the current status of @command{ftp}.
 
 @item struct [@var{struct-name}]
 Set the file transfer structure to @var{struct-name}.  By default
-@samp{stream} structure is used.
+@samp{file} structure is used, which also is the only supported
+value.
 
 @item sunique
 Toggle storing of files on remote machine under unique file names.
@@ -1486,16 +1700,17 @@ a file transfer completes, statistics regarding the efficiency of the
 transfer are reported.  By default, verbose is on.
 @end table
 
-Command arguments which have embedded spaces may be quoted with quote
-@samp{"} marks.
+Command arguments which have embedded spaces may be inclosed within
+citation characters @kbd{"}.
 
-@node Aborting A File Transfer
-@section Aborting A File Transfer
+@node Aborting a file transfer
+@section Aborting a file transfer
 
 To abort a file transfer, use the terminal interrupt key (usually
-@kbd{C-c}).  Sending transfers will be immediately halted.  Receiving
-transfers will be halted by sending a FTP protocol ABOR command to the
-remote server, and discarding any further data received.  The speed at
+@kbd{C-c}).  Sending transfers will be immediately halted.
+Receiving transfers will be halted by sending a @acronym{FTP}
+protocol command @code{ABOR} to the remote server,
+discarding any further data received.  The speed at
 which this is accomplished depends upon the remote server's support
 for @code{ABOR} processing.  If the remote server does not support the
 @code{ABOR} command, an @samp{ftp>} prompt will not appear until the
@@ -1505,12 +1720,13 @@ The terminal interrupt key sequence will be ignored when @command{ftp}
 has completed any local processing and is awaiting a reply from the
 remote server.  A long delay in this mode may result from the
 @code{ABOR} processing described above, or from unexpected behavior by
-the remote server, including violations of the FTP protocol.  If the
+the remote server, including violations of the @acronym{FTP} protocol.
+If the
 delay results from unexpected remote server behavior, the local
 @command{ftp} program must be killed by hand.
 
-@node File Naming Conventions
-@section File Naming Conventions
+@node File naming conventions
+@section File naming conventions
 
 Files specified as arguments to @command{ftp} commands are processed
 according to the following rules.
@@ -1521,38 +1737,47 @@ If the file name @samp{-} is specified, standard input (for reading)
 or standard output (for writing) is used.
 
 @item
-If the first character of the file name is @samp{|}, the remainder of
+If the first character of the file name is @kbd{|}, the remainder of
 the argument is interpreted as a shell command.  @command{ftp} then
 forks a shell, using @code{popen} with the argument supplied, and
 reads/writes from standard input/output.  If the shell command
 includes spaces, the argument must be quoted; e.g.  @samp{"ls -lt"}.
-A particularly useful example of this mechanism is @samp{dir more}.
+
+A particularly useful example of this mechanism in action, is
+
+@smallexample
+ftp> dir . |less
+@end smallexample
+
+which allows the user to scroll through a long directory listing.
 
 @item
 Failing the above checks, if @dfn{globbing} is enabled, local file
-names are expanded according to the rules used in the @command{csh};
-c.f.  the @code{glob} command.  If the @command{ftp} command expects a
-single local file (e.g.  @code{put}), only the first filename
+names are expanded according to the rules used by @command{csh};
+c.f. the @code{glob} command.  If the @command{ftp} command expects a
+single local file (e.g. @code{put}), only the first filename
 generated by the globbing operation is used.
 
 @item
-For @code{mget} commands and @code{get} commands with unspecified
-local file names, the local filename is the remote filename, which may
-be altered by a @code{case}, @code{ntrans}, or @code{nmap} setting.
-The resulting filename may then be altered if @code{runique} is on.
+For the commands @code{mget} and @code{get} with unspecified
+local file name, the local file name is set to the remote file name,
+which may be altered by a @code{case}, @code{ntrans}, or @code{nmap}
+settings.
+The resulting file name may then be modified if @code{runique} is set.
 
 @item
-For @code{mput} commands and @code{put} commands with unspecified
-remote file names, the remote filename is the local filename, which
-may be altered by a @code{ntrans} or @code{nmap} setting.  The
-resulting filename may then be altered by the remote server if
-@code{sunique} is on.
+For the commands @code{mput} and @code{put} with unspecified
+remote file name, the remote file name is copied from the local
+file name, which may be altered by a @code{ntrans} or @code{nmap}
+settings.
+The resulting file name may also be modified by the remote server if
+@code{sunique} is set.
 @end enumerate
 
-@node File Transfer Parameters
-@section File Transfer Parameters
+@node File transfer parameters
+@section File transfer parameters
 
-The FTP specification specifies many parameters which may affect a
+The @acronym{FTP} specification includes many parameters which may affect a
 file transfer.  The type may be one of @samp{ascii}, @samp{image}
 (binary), @samp{ebcdic}, and @samp{local} byte size (for PDP-10's and
 PDP-20's mostly).  @command{ftp} supports the @samp{ascii} and
@@ -1562,8 +1787,15 @@ mode transfers.
 @command{ftp} supports only the default values for the remaining file
 transfer parameters: @code{mode}, @code{form}, and @code{struct}.
 
-@node The .netrc File
-@section The @file{.netrc} File
+An error in the treatment of carriage returns in the 4.2BSD ascii-mode
+transfer code has been corrected by the present implementation.
+This correction may result in corrupt transfers of binary files
+to and from 4.2BSD servers, when done using the ascii type.
+Avoid this problem by using the binary image type.
+
+@node The .netrc file
+@section The @file{.netrc} file
+@flindex .netrc
 
 The @file{.netrc} file contains login and initialization information
 used by the auto-login process.  It resides in the user's home
@@ -1619,24 +1851,19 @@ encountered.  If a macro named init is defined, it is automatically
 executed as the last step in the auto-login process.
 @end table
 
-@command{ftp} utilizes the following environment variables.
+@node Ftp environment
+@section Environment variables in use
+
+@command{ftp} accesses the following environment variables.
 
 @table @env
 @item HOME
-For default location of a @file{.netrc} file, if one exists.
+Used for locating a @file{.netrc} file, if one exists.
 
 @item SHELL
-For default shell.
+For determining the default shell interpreter.
 @end table
 
-Correct execution of many commands depends upon proper behavior by the
-remote server.
-
-An error in the treatment of carriage returns in the 4.2BSD ascii-mode
-transfer code has been corrected.  This correction may result in
-incorrect transfers of binary files to and from 4.2BSD servers using
-the ascii type.  Avoid this problem by using the binary image type.
-
 @node tftp invocation
 @chapter @command{tftp}: TFTP client
 @cindex tftp
@@ -1647,6 +1874,9 @@ from a remote machine.  The remote host may be specified on the
 command line, in which case @command{tftp} uses host as the default
 host for future transfers.
 
+@noindent
+Synopsis:
+
 @example
 tftp [@var{option}]@dots{} @var{host}
 @end example
@@ -1762,7 +1992,8 @@ For details, @xref{rcmd, , rcmd, libc, The GNU C Library Reference Manual}.
 If no command is specified for @command{rsh} ar argument following the
 host name, then you will be logged in on the remote host using @command{rlogin}.
 
-@section Invoking
+@section Command line options
+@anchor{rsh options}
 
 The options are as follows :
 
@@ -1903,7 +2134,8 @@ named @var{hostname}.
 password.  The prerequisite is a suitable specification in @file{~/.rhosts}.
 For details, @xref{rcmd, , rcmd, libc, The GNU C Library Reference Manual}.
 
-@section Invoking
+@section Command line options
+@anchor{rlogin options}
 
 The options are as follows :
 
@@ -2068,11 +2300,17 @@ argument is either a remote file name of the form
 @samp{rname@@rhost:path}, or a local file name (containing no @samp{:}
 characters, or a @samp{/} before any @samp{:}s).
 
+@noindent
+Synopsis:
+
 @example
 rcp [@var{option}]@dots{} @var{old-file} @var{new-file}
 rcp [@var{option}]@dots{} @var{files}@dots{} @var{directory}
 @end example
 
+@section Command line options
+@anchor{rcp options}
+
 @table @option
 @item -4
 @itemx --ipv4
@@ -2162,12 +2400,16 @@ version of @command{rcp}.
 
 @command{rexec} is a program that executes a program on another host.
 
+@noindent
+Synopsis:
+
 @example
 rexec --user=@var{login} --password=@var{pass} --host=@var{host}  \
-      [OPTION] @var{command}
+@verb{|      |}[OPTION] @var{command}
 @end example
 
-The command line arguments are as follows:
+@section Command line options
+@anchor{rexec options}
 
 @table @option
 @item -4
@@ -2295,12 +2537,18 @@ previous state.
 @cindex telnet
 
 Login to a remote system HOST, optionally using a (non-standard)
-service port PORT:
+service port PORT.
+
+@noindent
+Synpsis:
 
 @example
 telnet [@var{OPTION}...] [@var{HOST} [@var{PORT}]]
 @end example
 
+@section Command line options
+@anchor{telnet options}
+
 @table @option
 @item -4
 @itemx --ipv4
@@ -2404,7 +2652,7 @@ is to be disabled.  Standard choices are @samp{null},
 @end table
 
 @node inetd invocation
-@chapter @command{inetd}: Interner super-server
+@chapter @command{inetd}: Internet super-server
 @cindex inetd
 
 @command{inetd} program should be run at boot time by /etc/rc.  It
@@ -3279,6 +3527,7 @@ Displayed and access refused.
 @chapter @command{tftpd}: TFTP server
 @cindex tftpd
 
+@noindent
 Synopsis:
 
 @example

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

Summary of changes:
 TODO               |    4 -
 doc/inetutils.texi |  851 +++++++++++++++++++++++++++++++++-------------------
 2 files changed, 550 insertions(+), 305 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Fri Dec 14 17:26:50 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1TjdiU-0004H8-T8
	for mharc-commit-inetutils@gnu.org; Fri, 14 Dec 2012 17:26:50 -0500
Received: from eggs.gnu.org ([208.118.235.92]:33072)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TjdiO-0004Gx-8M
	for commit-inetutils@gnu.org; Fri, 14 Dec 2012 17:26:49 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TjdiJ-0003sg-1z
	for commit-inetutils@gnu.org; Fri, 14 Dec 2012 17:26:44 -0500
Received: from vcs.savannah.gnu.org ([140.186.70.72]:42923)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TjdiI-0003rl-TG
	for commit-inetutils@gnu.org; Fri, 14 Dec 2012 17:26:38 -0500
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1TjdiI-0001yJ-1r
	for commit-inetutils@gnu.org; Fri, 14 Dec 2012 22:26:38 +0000
Date: Fri, 14 Dec 2012 22:26:38 +0000
Message-Id: <E1TjdiI-0001yJ-1r@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1-225-g8b7266b
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: f88d5862859fa7416d62becd1482ef6a677ed805
X-Git-Newrev: 8b7266bbea9c489b147cf3dece2eb05f2f3c4ecc
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 14 Dec 2012 22:26:49 -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  8b7266bbea9c489b147cf3dece2eb05f2f3c4ecc (commit)
      from  f88d5862859fa7416d62becd1482ef6a677ed805 (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=8b7266bbea9c489b147cf3dece2eb05f2f3c4ecc


commit 8b7266bbea9c489b147cf3dece2eb05f2f3c4ecc
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Fri Dec 14 22:55:15 2012 +0100

    Documentation (silent change)

diff --git a/doc/inetutils.texi b/doc/inetutils.texi
index 4d03776..4561606 100644
--- a/doc/inetutils.texi
+++ b/doc/inetutils.texi
@@ -482,7 +482,7 @@ logger -p daemon.warn -h logger.runasimi.org -S 10.10.10.1  \
 @c of ping.  A user doesn't need to know that we are using TIMEVAL, or
 @c how things are padded.
 
-@command{ping} uses @acronym{ICMP} datagrams to provoke a response
+@command{ping} uses ICMP datagrams to provoke a response
 from the chosen destination host, mainly intending to probe
 whether it is alive.
 
@@ -492,11 +492,11 @@ By a suitable choice of payload, different host or router properties
 are detectable, as the emitted datagram travels to its destination.
 
 @ignore %* Too detailed for end user.
-@command{ping} uses the @acronym{ICMP} protocol's mandatory
-@code{ECHO_REQUEST} datagram to elicit an ICMP @code{ECHO_RESPONSE}
-from a host or gateway.
-@code{ECHO_REQUEST} datagrams (@dfn{pings}) have an @acronym{IP} and
-an @acronym{ICMP} header, followed by a @dfn{struct timeval} and then
+@command{ping} uses the ICMP protocol's mandatory
+@code{ECHO_REQUEST} datagram to elicit an ICMP type @code{ECHO_REPLY}
+packet from a host or gateway.
+@code{ECHO_REQUEST} datagrams (@dfn{pings}) have an IP and
+an ICMP header, followed by a @dfn{struct timeval} and then
 an arbitrary number of @dfn{padding} bytes used to fill out the packet.
 @end ignore
 
@@ -555,7 +555,7 @@ from the targetted host.
 
 In successful cases three time values are returned.
 All are expected to state the number of milliseconds since
-midnight@tie{}@acronym{UTC}.
+midnight@tie{}UTC.
 The first of these, @samp{icmp_otime}, contains the original
 time of sending the request.
 Then comes @samp{icmp_rtime}, the time of reception by the target,
@@ -625,7 +625,7 @@ interface was dropped by @command{routed}).
 @itemx --tos=@var{num}
 @opindex -T
 @opindex --tos
-Set type-of-service, @acronym{TOS} field, to @var{num} on
+Set type-of-service, TOS field, to @var{num} on
 transmitted packets.
 
 @item --ttl=@var{n}
@@ -682,9 +682,9 @@ This can be very hard on a network and should be used with caution.
 
 @item --ip-timestamp=@var{flag}
 @opindex --ip-timestamp
-Include @acronym{IP} option Timestamp in transmitted packets.
+Include IP option Timestamp in transmitted packets.
 The value @var{flag} is either @samp{tsonly}, which only records up
-to nine time stamps, or @samp{tsaddr}, which records @acronym{IP}
+to nine time stamps, or @samp{tsaddr}, which records IP
 addresses as well as time stamps, but for at most four hosts.
 
 @item -l @var{n}
@@ -714,7 +714,7 @@ Do not print timing for each transmitted packet.
 @opindex --route
 Record route.  Includes the @code{RECORD_ROUTE} field in the
 ECHO_REQUEST packet and displays the route buffer on returned packets.
-Note that the @acronym{IP} header is only large enough for nine
+Note that the IP header is only large enough for nine
 such routes.
 Many hosts ignore or discard this option.
 
@@ -723,8 +723,8 @@ Many hosts ignore or discard this option.
 @opindex -s
 @opindex --size
 Specifies the number of data bytes to be sent.  The default is 56,
-which translates into 64@tie{}@acronym{ICMP} data bytes, taking
-the 8@tie{}bytes of @acronym{ICMP} header data into account.
+which translates into 64@tie{}ICMP data bytes, taking
+the 8@tie{}bytes of ICMP header data into account.
 @end table
 
 @node Fault isolation
@@ -748,15 +748,15 @@ unwise to use ping during normal operations or from automated scripts.
 @ignore
 @section ICMP Packet Details
 
-An @acronym{IP} header without options consists of 20 bytes.
-An @acronym{ICMP} ECHO_REQUEST packet contains an additional
-8 bytes worth of @acronym{ICMP} header followed by an arbitrary
+An IP header without options consists of 20 bytes.
+An ICMP type ECHO_REQUEST packet contains an additional
+8 bytes worth of ICMP header followed by an arbitrary
 amount of data.
 When a packet size is stated, that indicates
 the size of the extra piece of data (the default is 56).
-Thus the amount of data received as an @acronym{IP} packet
-of type @acronym{ICMP} ECHO_REPLY, will always be 8 bytes larger
-than the requested data space (the @acronym{ICMP} header).
+Thus the amount of data received as an IP packet
+with an ICMP type ECHO_REPLY, will always be 8 bytes larger
+than the requested data space (the ICMP header).
 
 If the data space is at least eight bytes large, ping uses the first
 eight bytes of this space to include a timestamp which it uses in the
@@ -802,44 +802,44 @@ using the @option{-p} option of ping.
 @node TTL details
 @section TTL details
 
-The @acronym{TTL} field, @dfn{Time To Live}, of an @acronym{IP}
-packet represents the maximum number of @acronym{IP} routers
+The TTL field, @dfn{Time To Live}, of an IP
+packet represents the maximum number of IP routers
 that the packet can go through before being discarded.
 In current practice you can expect each router on the
-Internet to decrement the @acronym{TTL} field by exactly one.
+Internet to decrement the TTL field by exactly one.
 
-The TCP/IP specification states that the @acronym{TTL} field
-of a new @acronym{TCP} packet should be set to 60,
-but many systems use smaller values (4.3BSD uses 30
+The TCP/IP specification states that the TTL field
+of a new TCP packet should be set to 60,
+but many systems use smaller values (4.3BSD used 30
 and 4.2BSD used 15).
 
 The maximum possible value of this field is 255, and most UNIX systems
-set the @acronym{TTL} field of @acronym{ICMP} (type @code{ECHO_REQUEST})
+set the TTL field of ICMP (type @code{ECHO_REQUEST})
 packets to 255.  This is why you will find you can ping some hosts,
 but not reach them with @command{telnet} or @command{ftp}.
 
-During normal operation, @command{ping} prints the @acronym{TTL} value
+During normal operation, @command{ping} prints the TTL value
 for every packet it receives.
-When a remote system receives an @acronym{ICMP} packet,
-it can do one of three things to the @acronym{TTL} field
+When a remote system receives an ICMP packet,
+it can do one of three things to the TTL field
 in its response packet:
 
 @itemize @bullet
 @item
 Not to change it.  This is what Berkeley UNIX systems did before the
-4.3BSD-Tahoe release.  In this case the @acronym{TTL} value in the
+4.3BSD-Tahoe release.  In this case the TTL value in the
 received packet will be 255 minus the number of routers in the
 round-trip path.
 
 @item
 Set it to 255.  This is what current Berkeley UNIX systems do.  In this
-case the @acronym{TTL} value in the received packet will be 255 minus the
+case the TTL value in the received packet will be 255 minus the
 number of routers in the path from the remote system to the pinging
 host.
 
 @item
 Set it to some other value.  Some machines use the same value for
-@acronym{ICMP} packets that they use for @acronym{TCP} packets,
+ICMP packets that they use for TCP packets,
 for example either 30 or 60.
 Others may use completely arbitrary values.
 
@@ -848,7 +848,7 @@ Others may use completely arbitrary values.
 @node Further remarks
 @section Further observations
 Many hosts and gateways ignore the @code{RECORD_ROUTE} field, since
-the maximum @acronym{IP} header length is far to small to hold all
+the maximum IP header length is far to small to hold all
 the routes.
 There is not much that can be done about this.
 
@@ -857,34 +857,16 @@ broadcast address should only be done under very controlled
 conditions.
 
 Some BSD variants offer a kernel setting to inhibit all replies
-to ICMP_MASKREQ packets.
-This setting can detected using
-
-@example
-$ sysctl net.inet.icmp.maskrepl
-net.inet.icmp.maskrepl: 0
-@end example
-
-@noindent
-where a value 1 would be needed for sending a reply, and where 0
-means that any request is simply dropped.
-FreeBSD goes even further by providing a faked netmask:
-
-@example
-# sysctl -w net.inet.icmp.maskfake=`expr 255 + 252 \* 256`
-net.inet.icmp.maskfake: 0 -> 64767
-@end example
-
-@noindent
-thus setting the netmask to @samp{255.252.0.0} on a little
-endian architecture.
+to ICMP_MASKREQ packets, but in general, Unices are designed either
+to answer the request with a valid netmask, or to drop the request,
+causing @command{ping} to wait for a timeout condition.
 
 @node traceroute invocation
 @chapter @command{traceroute}: Trace the route to a host
 @cindex traceroute
 
 @command{traceroute} prints a trace of the route
-@acronym{IP}@tie{}packets are travelling to a remote host.
+IP@tie{}packets are travelling to a remote host.
 
 @noindent
 Synopsis:
@@ -925,7 +907,7 @@ Attempt to resolve all addresses as hostnames.
 @itemx --tos=@var{num}
 @opindex -t
 @opindex --tos
-Set type-of-service, @acronym{TOS} field, to @var{num} on
+Set type-of-service, TOS field, to @var{num} on
 transmitted packets.
 @end table
 
@@ -989,7 +971,7 @@ Use a comma separated list for multiple attributes.
 @item -l
 @opindex -l
 One level less specific lookup.
-Applies to @acronym{RPSL} only.
+Applies to RPSL only.
 
 @item -L
 @opindex -L
@@ -1010,7 +992,7 @@ Connect to server port @var{port}.
 @item -q @{version|sources@}
 @opindex -q
 Query specified server info.
-Applies to @acronym{RPSL} only.
+Applies to RPSL only.
 
 @item -r
 @opindex -r
@@ -1049,7 +1031,7 @@ Verbosely explain all actions taken.
 @item -x
 @opindex -x
 Search only for exact matches.
-Applicable only to @acronym{RPSL}.
+Applicable only to RPSL.
 @end table
 
 
@@ -1057,7 +1039,7 @@ Applicable only to @acronym{RPSL}.
 @chapter @command{ftp}: FTP client
 @cindex ftp
 
-@command{ftp} is the user interface to @acronym{FTP},
+@command{ftp} is the user interface to FTP,
 the File Transfer Protocol.
 The program allows a user to transfer files to and from a remote
 network site.
@@ -1077,7 +1059,7 @@ but is otherwise identical to @command{ftp}.
 The client host with which @command{ftp} is to communicate may be
 specified on the command line.
 If this is done, @command{ftp} will immediately attempt to establish
-a connection to the @acronym{FTP} server running on that host.
+a connection to the FTP server running on that host.
 Otherwise, the program will start a command interpreter and will await
 further instructions from the user.
 Commands can either be entered interactively,
@@ -1262,7 +1244,7 @@ sytem to @var{mode}.
 
 @item close
 @itemx disconnect
-Terminate the @acronym{FTP} session with the remote server,
+Terminate the FTP session with the remote server,
 and return to the command interpreter.
 Any defined macros are erased.
 
@@ -1324,7 +1306,7 @@ For @code{mdelete} and
 remote machine and the lists are not merged.  Expansion of a directory
 name is likely to be different from expansion of the name of an
 ordinary file: the exact result depends on the remote operating
-system and on the @acronym{FTP} server, and can be previewed by
+system and on the FTP server, and can be previewed by
 issuing @samp{mls remote-files -}.
 
 Note: @code{mget} and @code{mput} are not meant to transfer entire
@@ -1469,7 +1451,7 @@ filenames (which may have already been processed according to the
 Variable templating is accomplished
 by including the sequences @samp{$1}, @samp{$2}, @dots{}, @samp{$9} in
 @var{inpattern}.  Use @samp{\} to prevent this special treatment of
-the character @kbd{$}.  All other characters are treated literally,
+the character @samp{$}.  All other characters are treated literally,
 and must be matched in a file name for @var{inpattern}
 to bind substrings to variables.
 
@@ -1501,8 +1483,8 @@ Spaces may be included in @var{outpattern}, but are easily removed:
 nmap $1 |sed "s/ *$//" > $1
 @end smallexample
 
-Use a backslash @kbd{\} to escape the characters
-@kbd{$}, @kbd{[}, @kbd{]}, and @kbd{,}.
+Use a backslash @samp{\} to escape the characters
+@samp{$}, @samp{[}, @samp{]}, and @samp{,}.
 
 @item ntrans [@var{inchars} [@var{outchars}]]
 Set or unset the filename character translation mechanism.  If no
@@ -1522,10 +1504,10 @@ character's position in @var{inchars} is longer than the length of
 @var{outchars}, the character is deleted from the file name.
 
 @item open @var{host} [@var{port}]
-Establish a connection to the specified @acronym{FTP} server
+Establish a connection to the specified FTP server
 at @var{host}.  An optional port number may be supplied,
 in which case, @command{ftp} will attempt to contact the server
-at that specific @acronym{TCP} port.  If the @code{autologin} option
+at that specific TCP port.  If the @code{autologin} option
 is on (is so by default), @command{ftp} will also attempt to
 automatically log the user in to the FTP server.
 
@@ -1595,14 +1577,14 @@ command is useful when transferring very large files over networks
 that are prone to dropping connections.
 
 @item rhelp [@var{command-name}]
-Request help from the remote @acronym{FTP} server.
+Request help from the remote FTP server.
 If @var{command-name} is specified it is passed to the server as well.
 
 @item rstatus [@var{file-name}]
 With no arguments, show status of remote machine.  If filename is
 specified, show status of @var{file-name} on remote machine.
 
-@item rename [@var{from}] [@var{to}]]
+@item rename [@var{from}] [@var{to}]
 Rename the file @var{from} on the remote machine as @var{to}.
 Name mapping takes effect without @var{to}.
 
@@ -1701,14 +1683,14 @@ transfer are reported.  By default, verbose is on.
 @end table
 
 Command arguments which have embedded spaces may be inclosed within
-citation characters @kbd{"}.
+citation characters @samp{"}.
 
 @node Aborting a file transfer
 @section Aborting a file transfer
 
 To abort a file transfer, use the terminal interrupt key (usually
 @kbd{C-c}).  Sending transfers will be immediately halted.
-Receiving transfers will be halted by sending a @acronym{FTP}
+Receiving transfers will be halted by sending a FTP
 protocol command @code{ABOR} to the remote server,
 discarding any further data received.  The speed at
 which this is accomplished depends upon the remote server's support
@@ -1720,7 +1702,7 @@ The terminal interrupt key sequence will be ignored when @command{ftp}
 has completed any local processing and is awaiting a reply from the
 remote server.  A long delay in this mode may result from the
 @code{ABOR} processing described above, or from unexpected behavior by
-the remote server, including violations of the @acronym{FTP} protocol.
+the remote server, including violations of the FTP protocol.
 If the
 delay results from unexpected remote server behavior, the local
 @command{ftp} program must be killed by hand.
@@ -1737,7 +1719,7 @@ If the file name @samp{-} is specified, standard input (for reading)
 or standard output (for writing) is used.
 
 @item
-If the first character of the file name is @kbd{|}, the remainder of
+If the first character of the file name is @samp{|}, the remainder of
 the argument is interpreted as a shell command.  @command{ftp} then
 forks a shell, using @code{popen} with the argument supplied, and
 reads/writes from standard input/output.  If the shell command
@@ -1777,7 +1759,7 @@ The resulting file name may also be modified by the remote server if
 @node File transfer parameters
 @section File transfer parameters
 
-The @acronym{FTP} specification includes many parameters which may affect a
+The FTP specification includes many parameters which may affect a
 file transfer.  The type may be one of @samp{ascii}, @samp{image}
 (binary), @samp{ebcdic}, and @samp{local} byte size (for PDP-10's and
 PDP-20's mostly).  @command{ftp} supports the @samp{ascii} and

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

Summary of changes:
 doc/inetutils.texi |  132 ++++++++++++++++++++++-----------------------------
 1 files changed, 57 insertions(+), 75 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Sat Dec 15 09:56:20 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1TjtA4-0001qk-Hq
	for mharc-commit-inetutils@gnu.org; Sat, 15 Dec 2012 09:56:20 -0500
Received: from eggs.gnu.org ([208.118.235.92]:36896)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TjtA2-0001qE-7h
	for commit-inetutils@gnu.org; Sat, 15 Dec 2012 09:56:19 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TjtA0-00062J-LH
	for commit-inetutils@gnu.org; Sat, 15 Dec 2012 09:56:18 -0500
Received: from vcs.savannah.gnu.org ([140.186.70.72]:49111)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TjtA0-00062F-Hy
	for commit-inetutils@gnu.org; Sat, 15 Dec 2012 09:56:16 -0500
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1Tjt9n-0004qD-QJ
	for commit-inetutils@gnu.org; Sat, 15 Dec 2012 14:56:10 +0000
Date: Sat, 15 Dec 2012 14:56:04 +0000
Message-Id: <E1Tjt9n-0004qD-QJ@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1-226-g4d08115
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 8b7266bbea9c489b147cf3dece2eb05f2f3c4ecc
X-Git-Newrev: 4d0811532f03ca76fec3f5ba5b7d90644d027510
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 15 Dec 2012 14:56:19 -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  4d0811532f03ca76fec3f5ba5b7d90644d027510 (commit)
      from  8b7266bbea9c489b147cf3dece2eb05f2f3c4ecc (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=4d0811532f03ca76fec3f5ba5b7d90644d027510


commit 4d0811532f03ca76fec3f5ba5b7d90644d027510
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Sat Dec 15 14:50:48 2012 +0100

    ftp: Check for allocated buffer.

diff --git a/ChangeLog b/ChangeLog
index a2ae553..5f25421 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-12-15  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	* ftp/cmds.c (put, mput, getit, mget): Check if
+	domap() has allocated new memory, and only then
+	update string pointer and free old memory.
+	(domap) <'[', LOOP>: If cp_subst() substituted
+	something, set MATCH to 1.
+
 2012-12-07  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	Activate servers in FreeBSD 9 and 10.  They work
diff --git a/ftp/cmds.c b/ftp/cmds.c
index 9886fd2..362c277 100644
--- a/ftp/cmds.c
+++ b/ftp/cmds.c
@@ -569,8 +569,11 @@ put (int argc, char **argv)
   if (loc && mapflag)
     {
       char *new = domap (remote);
-      free (remote);
-      remote = new;
+      if (new != remote)
+	{
+	  free (remote);
+	  remote = new;
+	}
     }
   sendrequest (cmd, local, remote,
 	       strcmp (argv[1], local) != 0 || strcmp (argv[2], remote) != 0);
@@ -625,9 +628,12 @@ mput (int argc, char **argv)
 	      if (mapflag)
 		{
 		  char *new = domap (tp);
-		  if (tp != cp)
-		    free (tp);
-		  tp = new;
+		  if (new != tp)
+		    {
+		      if (tp != cp)
+			free (tp);
+		      tp = new;
+		    }
 		}
 	      sendrequest ((sunique) ? "STOU" : "STOR",
 			   cp, tp, cp != tp || !interactive);
@@ -668,9 +674,12 @@ mput (int argc, char **argv)
 	      if (mapflag)
 		{
 		  char *new = domap (tp);
-		  if (tp != argv[i])
-		    free (tp);
-		  tp = new;
+		  if (new != tp)
+		    {
+		      if (tp != argv[i])
+			free (tp);
+		      tp = new;
+		    }
 		}
 	      sendrequest ((sunique) ? "STOU" : "STOR",
 			   argv[i], tp, tp != argv[i] || !interactive);
@@ -717,9 +726,12 @@ mput (int argc, char **argv)
 	      if (mapflag)
 		{
 		  char *new = domap (tp);
-		  if (tp != *cpp)
-		    free (tp);
-		  tp = new;
+		  if (new != tp)
+		    {
+		      if (tp != *cpp)
+			free (tp);
+		      tp = new;
+		    }
 		}
 	      sendrequest ((sunique) ? "STOU" : "STOR",
 			   *cpp, tp, *cpp != tp || !interactive);
@@ -799,8 +811,11 @@ getit (int argc, char **argv, int restartit, char *mode)
   if (loc && mapflag)
     {
       char *new = domap (local);
-      free (local);
-      local = new;
+      if (new != local)
+	{
+	  free (local);
+	  local = new;
+	}
     }
   if (restartit)
     {
@@ -937,9 +952,12 @@ mget (int argc, char **argv)
 	  if (mapflag)
 	    {
 	      char *new = domap (tp);
-	      if (tp != cp)
-		free (tp);
-	      tp = new;
+	      if (new != tp)
+		{
+		  if (tp != cp)
+		    free (tp);
+		  tp = new;
+		}
 	    }
 	  recvrequest ("RETR", tp, cp, "w", tp != cp || !interactive);
 	  if (!mflag && fromatty)
@@ -2104,6 +2122,9 @@ setntrans (int argc, char **argv)
   ntout[sizeof (ntout) - 1] = '\0';
 }
 
+/* NOTE: dotrans() always returns a newly allocated string.
+ */
+
 char *
 dotrans (char *name)
 {
@@ -2218,6 +2239,10 @@ cp_subst (char **from_p, char **to_p, int *toks, char **tp, char **te, char *tok
   return 1;
 }
 
+/* NOTE: domap() can return a newly allocated string,
+ * but need not do so every time.
+ */
+
 char *
 domap (char *name)
 {
@@ -2291,7 +2316,10 @@ domap (char *name)
 	case '[':
 	LOOP:
 	  if (*++cp2 == '$' && isdigit (*(cp2 + 1)))
-	    cp_subst (&cp2, &cp1, toks, tp, te, name, &buf, &buf_len);
+	    {
+	      if (cp_subst (&cp2, &cp1, toks, tp, te, name, &buf, &buf_len))
+		match = 1;
+	    }
 	  else
 	    {
 	      while (*cp2 && *cp2 != ',' && *cp2 != ']')

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

Summary of changes:
 ChangeLog  |    8 +++++++
 ftp/cmds.c |   62 +++++++++++++++++++++++++++++++++++++++++++----------------
 2 files changed, 53 insertions(+), 17 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Tue Dec 18 16:46:43 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Tl4zr-0004Vc-4x
	for mharc-commit-inetutils@gnu.org; Tue, 18 Dec 2012 16:46:43 -0500
Received: from eggs.gnu.org ([208.118.235.92]:55938)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1Tl4zl-0004Sq-BH
	for commit-inetutils@gnu.org; Tue, 18 Dec 2012 16:46:41 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1Tl4zh-0003wR-EB
	for commit-inetutils@gnu.org; Tue, 18 Dec 2012 16:46:37 -0500
Received: from vcs.savannah.gnu.org ([140.186.70.72]:60681)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1Tl4zh-0003wI-6P
	for commit-inetutils@gnu.org; Tue, 18 Dec 2012 16:46:33 -0500
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1Tl4zg-0006Db-RB
	for commit-inetutils@gnu.org; Tue, 18 Dec 2012 21:46:33 +0000
Date: Tue, 18 Dec 2012 21:46:32 +0000
Message-Id: <E1Tl4zg-0006Db-RB@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1-227-g9859672
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 4d0811532f03ca76fec3f5ba5b7d90644d027510
X-Git-Newrev: 98596728f57c78b24930910ff9d442bab9e39c32
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 18 Dec 2012 21:46:42 -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  98596728f57c78b24930910ff9d442bab9e39c32 (commit)
      from  4d0811532f03ca76fec3f5ba5b7d90644d027510 (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=98596728f57c78b24930910ff9d442bab9e39c32


commit 98596728f57c78b24930910ff9d442bab9e39c32
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Mon Dec 17 16:11:07 2012 +0100

    ftp: Buffer errors in nmap mode.
    
    Segmentation faults and infinite loop.

diff --git a/ChangeLog b/ChangeLog
index 5f25421..fc4d1e6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-12-17  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	* ftp/cmds.c (cp_subst): Change SRC_LEN to size_t.
+	New variable OFFSET.  Update `*to_p' after realloc(),
+	making the cursor a valid pointer.
+	(domap): Calculate BUF_LEN from `mapout', not `name'.
+	<LOOP, subcase `no token'>: Move character copying
+	to outer if-block, thus breaking an infinite loop.
+
 2012-12-15  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	* ftp/cmds.c (put, mput, getit, mget): Check if
diff --git a/ftp/cmds.c b/ftp/cmds.c
index 362c277..93aafcd 100644
--- a/ftp/cmds.c
+++ b/ftp/cmds.c
@@ -2211,7 +2211,7 @@ cp_subst (char **from_p, char **to_p, int *toks, char **tp, char **te, char *tok
 {
   int toknum;
   char *src;
-  int src_len;
+  size_t src_len;
 
   if (*++(*from_p) == '0')
     {
@@ -2226,13 +2226,19 @@ cp_subst (char **from_p, char **to_p, int *toks, char **tp, char **te, char *tok
   else
     return 0;
 
-  if (src_len > 2)
+  if (src_len > strlen ("$2"))
     {
-      /* This subst will be longer than the original, so make room
-         for it.  */
-      *buf_len_p += src_len - 2;
+      /* This substitution will be longer than the original text.
+       * Allocate a larger buffer and update the cursor, pointing
+       * within the new memory area.
+       */
+      size_t offset = *to_p - *buf_p;
+
+      *buf_len_p += src_len - strlen ("$2");
       *buf_p = realloc (*buf_p, *buf_len_p);
+      *to_p = *buf_p + offset;
     }
+
   while (src_len--)
     *(*to_p)++ = *src++;
 
@@ -2246,7 +2252,12 @@ cp_subst (char **from_p, char **to_p, int *toks, char **tp, char **te, char *tok
 char *
 domap (char *name)
 {
-  int buf_len = strlen (name) + 1;
+  /* The string `mapout' will have its tokens expanded,
+   * but is essentially the minimal output string.
+   * Some brackets and some alternate strings might
+   * need to be suppressed.
+   */
+  int buf_len = strlen (mapout) + 1;
   char *buf = xmalloc (buf_len);
   char *cp1 = name, *cp2 = mapin;
   char *tp[9], *te[9];
@@ -2256,6 +2267,9 @@ domap (char *name)
     {
       toks[i] = 0;
     }
+
+  /* Tokenize the input pattern against incoming file name.
+   */
   while (match && *cp1 && *cp2)
     {
       switch (*cp2)
@@ -2269,16 +2283,18 @@ domap (char *name)
 	case '$':
 	  if (*(cp2 + 1) >= '1' && (*cp2 + 1) <= '9')
 	    {
-	      if (*cp1 != *(++cp2 + 1))
+	      if (*cp1 != *(++cp2 + 1))	/* Break at delimiter.  */
 		{
 		  toks[toknum = *cp2 - '1']++;
 		  tp[toknum] = cp1;
-		  while (*++cp1 && *(cp2 + 1) != *cp1);
+		  while (*++cp1 && *(cp2 + 1) != *cp1)
+		    ;
 		  te[toknum] = cp1;
 		}
 	      cp2++;
 	      break;
 	    }
+	  /* Fall through, as '$' must be used verbatim.  */
 	default:
 	  if (*cp2 != *cp1)
 	    {
@@ -2299,6 +2315,11 @@ domap (char *name)
     {
       toks[toknum] = 0;
     }
+
+  /* Back substitute tokens into output template
+   * string `mapout'.  All fixed characters were
+   * already accounted for in presetting BUF_LEN.
+   */
   cp1 = buf;
   *cp1 = '\0';
   cp2 = mapout;
@@ -2333,9 +2354,9 @@ domap (char *name)
                       if (cp_subst (&cp2,
                                     &cp1, toks, tp, te, name, &buf, &buf_len))
                         match = 1;
-                      else if (*cp2)
-			*cp1++ = *cp2++;
                     }
+                  else if (*cp2)
+		    *cp1++ = *cp2++;
 		}
 	      if (!*cp2)
 		{
@@ -2347,6 +2368,7 @@ domap (char *name)
 	    }
 	  if (match)
 	    {
+	      /* Skip over all alternate text.  */
 	      while (*++cp2 && *cp2 != ']')
 		{
 		  if (*cp2 == '\\' && *(cp2 + 1))
@@ -2379,7 +2401,7 @@ domap (char *name)
 		match = 1;
 	      break;
 	    }
-	  /* intentional drop through */
+	  /* intentional fall through */
 	default:
 	  *cp1++ = *cp2;
 	  break;

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

Summary of changes:
 ChangeLog  |    9 +++++++++
 ftp/cmds.c |   44 +++++++++++++++++++++++++++++++++-----------
 2 files changed, 42 insertions(+), 11 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Wed Dec 19 07:29:02 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1TlIli-0002Ca-CK
	for mharc-commit-inetutils@gnu.org; Wed, 19 Dec 2012 07:29:02 -0500
Received: from eggs.gnu.org ([208.118.235.92]:42660)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TlIle-0002C8-8z
	for commit-inetutils@gnu.org; Wed, 19 Dec 2012 07:29:01 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TlIlb-0002lv-ST
	for commit-inetutils@gnu.org; Wed, 19 Dec 2012 07:28:58 -0500
Received: from vcs.savannah.gnu.org ([140.186.70.72]:59294)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1TlIlb-0002lp-MV
	for commit-inetutils@gnu.org; Wed, 19 Dec 2012 07:28:55 -0500
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1TlIla-000536-Oq
	for commit-inetutils@gnu.org; Wed, 19 Dec 2012 12:28:55 +0000
Date: Wed, 19 Dec 2012 12:28:54 +0000
Message-Id: <E1TlIla-000536-Oq@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1-228-g160598f
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 98596728f57c78b24930910ff9d442bab9e39c32
X-Git-Newrev: 160598f05ba99a6abc4852314679548c209f5831
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 19 Dec 2012 12:29:01 -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  160598f05ba99a6abc4852314679548c209f5831 (commit)
      from  98596728f57c78b24930910ff9d442bab9e39c32 (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=160598f05ba99a6abc4852314679548c209f5831


commit 160598f05ba99a6abc4852314679548c209f5831
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Wed Dec 19 13:22:25 2012 +0100

    ftp-localhost.sh: New subtest.

diff --git a/ChangeLog b/ChangeLog
index fc4d1e6..9e5a1cb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2012-12-19  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	Detect a writable directory for better coverage.
+	Add a test for mapping of file names.
+
+	* tests/ftp-localhost.sh (DLDIR): New variable.
+	Put files in $DLDIR of the chrooted user.
+	(GETME, PUTME): Use mktemp() to generate names.
+	[do_transfer]: New test of two nmap modes.
+
 2012-12-17  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	* ftp/cmds.c (cp_subst): Change SRC_LEN to size_t.
diff --git a/doc/inetutils.texi b/doc/inetutils.texi
index 4561606..47573fa 100644
--- a/doc/inetutils.texi
+++ b/doc/inetutils.texi
@@ -3286,7 +3286,7 @@ Daemon uses only IPv6 addressing.  Ignored in inetd mode.
 Only anonymous login is allowed.
 
 @item -a @var{auth}
-@item --auth=@var{auth}
+@itemx --auth=@var{auth}
 @opindex -a
 @opindex --auth
 Specify what authentication mechanism to use for incoming connections.
@@ -3297,8 +3297,8 @@ Anonymous logins will continue to work when this option is used.
 
 @item  -D
 @itemx --daemon
-@opindex --daemon
 @opindex -D
+@opindex --daemon
 @command{ftpd} enters daemon-mode.  That allows @command{ftpd} to be
 run without @command{inetd}.
 
@@ -3320,20 +3320,20 @@ directory, remove directory and rename operations and their filename
 arguments are also logged.
 
 @item -p @var{pidfile}
-@item --pidfile=@var{pidfile}
+@itemx --pidfile=@var{pidfile}
 @opindex -p
 @opindex --pidfile
 Change default location of @var{pidfile}.
 
 @item -q
-@item --no-version
+@itemx --no-version
 @opindex -q
 @opindex --no-version
 Quiet mode.  No information about the version of the @command{ftpd} is
 given to the client.
 
 @item -T
-@item --max-timeout
+@itemx --max-timeout
 @opindex -T
 @opindex --max-timeout
 A client may also request a different timeout period; the maximum
@@ -3341,17 +3341,17 @@ period allowed may be set to timeout seconds with the @option{-T}
 option.  The default limit is 2 hours.
 
 @item -t @var{timeout}
-@item --timeout=@var{timeout}
+@itemx --timeout=@var{timeout}
 @opindex -t
 @opindex --timeout
 The inactivity timeout period is set to timeout seconds (the default
 is 15 minutes).
 
 @item -u @var{umask}
-@item --umask=@var{umask}
+@itemx --umask=@var{umask}
 @opindex -u
 @opindex --umask
-Set default umask(base 8).
+Set default umask, expressed in base 8.
 @end table
 
 The file @file{/etc/nologin} can be used to disable FTP access.  If
@@ -3437,7 +3437,7 @@ transfer status will be returned.
 conventions used by @command{csh}.  This allows users to utilize the
 metacharacters @samp{*?[]@{@}~}.
 
-@command{ftpd} authenticates users according to three rules.
+@command{ftpd} authenticates users according to four rules.
 
 @enumerate
 @item
@@ -3467,10 +3467,10 @@ constructed with care, following these rules:
 
 @table @file
 @item ~ftp
-Make the home directory owned by @samp{root} and unwritable by anyone.
+Make the home directory owned by @samp{root} and not writable by anyone.
 
 @item ~ftp/bin
-Make this directory owned by @samp{root} and unwritable by anyone
+Make this directory owned by @samp{root} and not writable by anyone
 (mode 555).  The program @command{ls} must be present to support the
 list command.  This program should be mode 111.
 
@@ -3492,17 +3492,24 @@ this directory.
 @section Configuration files
 
 @table @samp
+@item @file{/etc/ftpchroot}
+List of users to enclose in a chrooted directory.
+The anonymous user @samp{ftp} is always considered
+to be a member of this list, explicit or not.
+
 @item @file{/etc/ftpusers}
 List of unwelcome/restricted users.
 
 @item @file{/etc/ftpwelcome}
-Welcome notice.
+Welcome notice printed before server identification
+and any authentication exchange.
 
 @item @file{/etc/motd}
-Welcome notice after login.
+Welcome notice presented after completed login.
 
 @item @file{/etc/nologin}
-Displayed and access refused.
+If present, the contents are displayed and all further
+access is refused.
 @end table
 
 @node tftpd invocation
diff --git a/tests/ftp-localhost.sh b/tests/ftp-localhost.sh
index 41a68b1..de13851 100755
--- a/tests/ftp-localhost.sh
+++ b/tests/ftp-localhost.sh
@@ -64,10 +64,6 @@ TARGET46=${TARGET46:-::ffff:127.0.0.1}
 do_transfer=false
 test "${TRANSFERTEST+yes}" = "yes" && do_transfer=true
 
-# Files used in transmission tests.
-GETME=getme.$$
-PUTME=putme.$$
-
 # Portability fix for SVR4
 PWD="${PWD:-`pwd`}"
 
@@ -153,6 +149,26 @@ else
     exit 77
 fi
 
+# Try common subdirectories for writability.
+# Result is in DLDIR, usable in chrooted setting.
+# Assigns an empty value when no writable candidate
+# was found.
+
+if test -z "$DLDIR"; then
+    for DLDIR in /pub /download /downloads /dl / ; do
+	test -d $FTPHOME$DLDIR || continue
+	set -- `ls -ld $FTPHOME$DLDIR`
+	# Check owner.
+	test "$3" = $FTPUSER || continue
+	# Check for write access.
+	test `expr $1 : 'drwx'` -eq 4 && break
+	DLDIR=	# Reset failed value
+    done
+
+    test -z "$DLDIR" && do_transfer=false
+    test x"$DLDIR" = x"/" && DLDIR=
+fi
+
 # Note that inetd changes directory to / when --debug is not given so
 # all paths must be absolute for things to work.
 
@@ -169,7 +185,7 @@ posttesting () {
 	     || kill -9 "`cat $TMPDIR/inetd.pid`"; }
     test -n "$TMPDIR" && test -d "$TMPDIR" && rm -rf "$TMPDIR"
     $do_transfer && test -n "$FTPHOME" \
-	&& test -f "$FTPHOME/$PUTME" && rm -f "$FTPHOME/$PUTME" \
+	&& test -f "$FTPHOME$DLDIR/$PUTME" && rm -f "$FTPHOME$DLDIR/$PUTME" \
 	|| true
 }
 
@@ -188,6 +204,13 @@ locate_port () {
     fi
 }
 
+# Files used in transmission tests.
+GETME=`$MKTEMP $TMPDIR/file.XXXXXXXX` || do_transfer=false
+
+test -n "$GETME" && GETME=`expr "$GETME" : "$TMPDIR/\(.*\)"`
+
+PUTME=putme.$GETME
+
 # Find an available port number.  There will be some
 # room left for a race condition, but we try to be
 # flexible enough for running copies of this script.
@@ -294,6 +317,8 @@ echo "PASV to $TARGET (IPv4) using inetd."
 cat <<STOP |
 rstatus
 dir
+`$do_transfer && test -n "$DLDIR" && echo "\
+cd $DLDIR"`
 `$do_transfer && echo "\
 lcd $TMPDIR
 image
@@ -304,7 +329,7 @@ HOME=$TMPDIR $FTP "$TARGET" $PORT -4 -v -p -t >$TMPDIR/ftp.stdout 2>&1
 test_report $? "$TMPDIR/ftp.stdout" "PASV/$TARGET"
 
 $do_transfer && \
-    if cmp -s "$TMPDIR/$GETME" "$FTPHOME/$PUTME"; then
+    if cmp -s "$TMPDIR/$GETME" "$FTPHOME$DLDIR/$PUTME"; then
 	test "${VERBOSE+yes}" && echo >&2 'Binary transfer succeeded.'
 	date "+%s" >> "$TMPDIR/$GETME"
     else
@@ -318,6 +343,8 @@ echo "PORT to $TARGET (IPv4) using inetd."
 cat <<STOP |
 rstatus
 dir
+`$do_transfer && test -n "$DLDIR" && echo "\
+cd $DLDIR"`
 `$do_transfer && echo "\
 lcd $TMPDIR
 image
@@ -328,7 +355,7 @@ HOME=$TMPDIR $FTP "$TARGET" $PORT -4 -v -t >$TMPDIR/ftp.stdout 2>&1
 test_report $? "$TMPDIR/ftp.stdout" "PORT/$TARGET"
 
 $do_transfer && \
-    if cmp -s "$TMPDIR/$GETME" "$FTPHOME/$PUTME"; then
+    if cmp -s "$TMPDIR/$GETME" "$FTPHOME$DLDIR/$PUTME"; then
 	test "${VERBOSE+yes}" && echo >&2 'Binary transfer succeeded.'
 	date "+%s" >> "$TMPDIR/$GETME"
     else
@@ -355,6 +382,8 @@ cat <<STOP |
 rstatus
 epsv4
 dir
+`$do_transfer && test -n "$DLDIR" && echo "\
+cd $DLDIR"`
 `$do_transfer && echo "\
 lcd $TMPDIR
 image
@@ -365,7 +394,7 @@ HOME=$TMPDIR $FTP "$TARGET" $PORT -4 -v -t >$TMPDIR/ftp.stdout 2>&1
 test_report $? "$TMPDIR/ftp.stdout" "EPRT/$TARGET"
 
 $do_transfer && \
-    if cmp -s "$TMPDIR/$GETME" "$FTPHOME/$PUTME"; then
+    if cmp -s "$TMPDIR/$GETME" "$FTPHOME$DLDIR/$PUTME"; then
 	test "${VERBOSE+yes}" && echo >&2 'Binary transfer succeeded.'
 	date "+%s" >> "$TMPDIR/$GETME"
     else
@@ -390,6 +419,8 @@ echo "EPRT to $TARGET6 (IPv6) using inetd."
 cat <<STOP |
 rstatus
 dir
+`$do_transfer && test -n "$DLDIR" && echo "\
+cd $DLDIR"`
 `$do_transfer && echo "\
 lcd $TMPDIR
 image
@@ -400,7 +431,7 @@ HOME=$TMPDIR $FTP "$TARGET6" $PORT -6 -v -t >$TMPDIR/ftp.stdout 2>&1
 test_report $? "$TMPDIR/ftp.stdout" "EPRT/$TARGET6"
 
 $do_transfer && \
-    if cmp -s "$TMPDIR/$GETME" "$FTPHOME/$PUTME"; then
+    if cmp -s "$TMPDIR/$GETME" "$FTPHOME$DLDIR/$PUTME"; then
 	test "${VERBOSE+yes}" && echo >&2 'Binary transfer succeeded.'
 	date "+%s" >> "$TMPDIR/$GETME"
     else
@@ -468,6 +499,8 @@ if $have_address_mapping && test -n "$TARGET46" ; then
     cat <<-STOP |
 	rstatus
 	dir
+	`$do_transfer && test -n "$DLDIR" && echo "\
+cd $DLDIR"`
 	`$do_transfer && echo "\
 lcd $TMPDIR
 image
@@ -478,7 +511,7 @@ put $GETME $PUTME"`
     test_report $? "$TMPDIR/ftp.stdout" "EPSV/$TARGET46"
 
     $do_transfer && \
-	if cmp -s "$TMPDIR/$GETME" "$FTPHOME/$PUTME"; then
+	if cmp -s "$TMPDIR/$GETME" "$FTPHOME$DLDIR/$PUTME"; then
 	    test "${VERBOSE+yes}" && echo >&2 'Binary transfer succeeded.'
 	    date "+%s" >> "$TMPDIR/$GETME"
 	else
@@ -492,6 +525,8 @@ put $GETME $PUTME"`
     cat <<-STOP |
 	rstatus
 	dir
+	`$do_transfer && test -n "$DLDIR" && echo "\
+cd $DLDIR"`
 	`$do_transfer && echo "\
 lcd $TMPDIR
 image
@@ -502,7 +537,7 @@ put $GETME $PUTME"`
     test_report $? "$TMPDIR/ftp.stdout" "EPRT/$TARGET46"
 
     $do_transfer && \
-	if cmp -s "$TMPDIR/$GETME" "$FTPHOME/$PUTME"; then
+	if cmp -s "$TMPDIR/$GETME" "$FTPHOME$DLDIR/$PUTME"; then
 	    test "${VERBOSE+yes}" && echo >&2 'Binary transfer succeeded.'
 	else
 	    echo >&2 'Binary transfer failed.'
@@ -513,4 +548,44 @@ else
     echo 'Skipping two tests of IPv4 mapped as IPv6.'
 fi
 
+# Test name mapping with PASV and IPv4.
+# Needs a writable destination!
+#
+if $do_transfer; then
+    echo "Name mapping test at $TARGET (IPv4) using inetd."
+
+    cat <<-STOP |
+	`test -z "$DLDIR" || echo "cd $DLDIR"`
+	lcd $TMPDIR
+	image
+	nmap \$1.\$2 \$2.\$1
+	put $GETME
+	nmap \$1.\$2.\$3 [\$3,copy].\$1.\$2
+	put $GETME
+	STOP
+    HOME=$TMPDIR $FTP "$TARGET" $PORT -4 -v -p -t >$TMPDIR/ftp.stdout 2>&1
+
+    sIFS=$IFS
+    IFS=.
+    set -- $GETME
+    IFS=$sIFS
+
+    # Are the expected file copies present?
+
+    if test -s $FTPHOME$DLDIR/$2.$1 && \
+	test -s $FTPHOME$DLDIR/copy.$GETME
+    then
+	test "${VERBOSE+yes}" && echo >&2 'Name mapping succeeded.'
+	rm -f $FTPHOME$DLDIR/$2.$1 $FTPHOME$DLDIR/copy.$GETME
+    else
+	echo >&2 'Binary transfer failed.'
+	test -s $FTPHOME$DLDIR/$2.$1 || \
+	    echo >&2 'Mapping "nmap $1.$2 $2.$1" failed.'
+	test -s $FTPHOME$DLDIR/copy.$GETME || \
+	    echo >&2 'Mapping "nmap $1.$2.$3 [$3,copy].$1.$2" failed.'
+	rm -f $FTPHOME$DLDIR/$2.$1 $FTPHOME$DLDIR/copy.$GETME
+	exit 1
+    fi
+fi
+
 exit 0

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

Summary of changes:
 ChangeLog              |   10 +++++
 doc/inetutils.texi     |   35 ++++++++++-------
 tests/ftp-localhost.sh |   97 ++++++++++++++++++++++++++++++++++++++++++-----
 3 files changed, 117 insertions(+), 25 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Thu Dec 27 14:02:30 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ToIis-0007yz-Tq
	for mharc-commit-inetutils@gnu.org; Thu, 27 Dec 2012 14:02:30 -0500
Received: from eggs.gnu.org ([208.118.235.92]:37816)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1ToIil-0007xw-0D
	for commit-inetutils@gnu.org; Thu, 27 Dec 2012 14:02:29 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1ToIii-00061n-Oe
	for commit-inetutils@gnu.org; Thu, 27 Dec 2012 14:02:22 -0500
Received: from vcs.savannah.gnu.org ([140.186.70.72]:53604)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1ToIii-00061j-L4
	for commit-inetutils@gnu.org; Thu, 27 Dec 2012 14:02:20 -0500
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1ToIig-0000Nb-4v
	for commit-inetutils@gnu.org; Thu, 27 Dec 2012 19:02:19 +0000
Date: Thu, 27 Dec 2012 19:02:18 +0000
Message-Id: <E1ToIig-0000Nb-4v@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_1-229-gfb9dcf4
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 160598f05ba99a6abc4852314679548c209f5831
X-Git-Newrev: fb9dcf487b3cac5bf6d32923241193bb967a9cb4
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 27 Dec 2012 19:02:29 -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  fb9dcf487b3cac5bf6d32923241193bb967a9cb4 (commit)
      from  160598f05ba99a6abc4852314679548c209f5831 (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=fb9dcf487b3cac5bf6d32923241193bb967a9cb4


commit fb9dcf487b3cac5bf6d32923241193bb967a9cb4
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Thu Dec 27 17:35:29 2012 +0100

    traceroute: Common behaviour.

diff --git a/ChangeLog b/ChangeLog
index 9e5a1cb..9131746 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2012-12-27  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	traceroute: Conform to standard application set-up.
+
+	* src/traceroute.c (opt_type): Default to TRACE_UDP.
+	(opt_port): Set to TRACE_UDP_PORT.
+	(opt_ttl, opt_wait): New variables.
+	(argp_options): New options `-f/--first-hop', `-I/--icmp',
+	and `-w/--wait'.
+	(parse_opt) <`p', `t'> : Use strtol() for better sanitation.
+	<`f', `I', `w'>: New cases.
+	(main): Free RHOST after use.
+	[HAVE_IDN]: Free `hostname'.
+	(do_try): Set timer from `opt_wait'.
+	(trace_init): Set `t->ttl' from `opt_ttl'.
+
+	* doc/inetutils.texi <traceroute invocation>: Update
+	with new options.  Add a section on diagnostics.
+
 2012-12-19  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	Detect a writable directory for better coverage.
diff --git a/doc/inetutils.texi b/doc/inetutils.texi
index 47573fa..663744a 100644
--- a/doc/inetutils.texi
+++ b/doc/inetutils.texi
@@ -879,12 +879,29 @@ traceroute [@var{option}@dots{}] @var{host}
 @anchor{traceroute options}
 
 @table @option
+@item -f @var{num}
+@itemx --first-hop=@var{num}
+@opindex -f
+@opindex --first-hop
+Set the initial hop distance to @var{num}, instead of the default 1.
+This immediately allows probing packets to sense routing
+properties closer to the target host, skipping routers close
+to the local host.  Quicker analysis of problems known to lie
+at some routing distance is the outcome.
+
+@item -I
+@itemx --icmp
+@opindex -I
+@opindex --icmp
+Use ICMP ECHO datagrams for probing the remote host.
+
 @item -M @var{method}
 @itemx --type=@var{method}
 @opindex -M
 @opindex --type
 Use @var{method} as carrier packets for traceroute operations.
-Supported choices are @samp{icmp} and @samp{udp}.
+Supported choices are @samp{icmp} and @samp{udp}, where @samp{udp}
+is the default type.
 
 @item -p @var{port}
 @itemx --port=@var{port}
@@ -909,6 +926,60 @@ Attempt to resolve all addresses as hostnames.
 @opindex --tos
 Set type-of-service, TOS field, to @var{num} on
 transmitted packets.
+
+@item -w @var{num}
+@itemx --wait=@var{num}
+@opindex -w
+@opindex --wait
+Set timeout in seconds, within which a returning response
+packet is accepted as such.
+Default waiting time is three seconds.
+@end table
+
+@section Diagnostic tokens
+@anchor{traceroute printing}
+
+During execution, @command{traceroute} sends three datagrams
+for each value for the TTL field, printing a diagnostic line
+of output for these.  The TTL field is then steadily increased
+until the intended host responds, or some intermediary gateway
+returns a datagram to the effect that the target cannot be
+reached due to one reason or another.
+
+Each line of output displays a sequence number, followed by
+diagnostic annotation.  Any responding host has its address
+printed without repetition, together with a measured timing.
+In case there is no response within a time period of three seconds,
+an asterisque @samp{*} is printed.
+
+When an intermediate router responds with an exceptional state,
+the time elapsed since emitting the original datagram is printed,
+followed by an additional short hand hint of the reason:
+
+@table @samp
+@item !F
+Fragmentation needed by gateway.
+
+@item !H
+Host not reachable from gateway.
+
+@item !N
+Network not reachable from gateway.
+
+@item !P
+Protocol not usable at host, or within network.
+
+@item !S
+Source routing failed at gateway.
+
+@item !T
+Host or network not reachable for stated type of service, TOS.
+
+@item !U
+Isolated host, not reachable.
+
+@item !X
+Forbidden by remote administration.
 @end table
 
 @node whois invocation
diff --git a/src/traceroute.c b/src/traceroute.c
index 8819336..d6f75f0 100644
--- a/src/traceroute.c
+++ b/src/traceroute.c
@@ -106,12 +106,14 @@ struct sockaddr_in dest;
  */
 const char unreach_sign[NR_ICMP_UNREACH + 2] = "NHPPFS**U**TTXXX";
 
-static enum trace_type opt_type = TRACE_ICMP;
-int opt_port = 33434;
+static enum trace_type opt_type = TRACE_UDP;
+int opt_port = TRACE_UDP_PORT;
 int opt_max_hops = 64;
 static int opt_max_tries = 3;
 int opt_resolve_hostnames = 0;
 int opt_tos = -1;	/* Triggers with non-negative values.  */
+int opt_ttl = TRACE_TTL;
+int opt_wait = TIME_INTERVAL;
 
 const char args_doc[] = "HOST";
 const char doc[] = "Print the route packets trace to network host.";
@@ -127,6 +129,9 @@ enum {
 
 static struct argp_option argp_options[] = {
 #define GRP 0
+  {"first-hop", 'f', "NUM", 0, "set initial hop distance, i.e., time-to-live",
+   GRP+1},
+  {"icmp", 'I', NULL, 0, "use ICMP ECHO as probe", GRP+1},
   {"port", 'p', "PORT", 0, "use destination PORT port (default: 33434)",
    GRP+1},
   {"resolve-hostnames", OPT_RESOLVE, NULL, 0, "resolve hostnames", GRP+1},
@@ -134,7 +139,9 @@ static struct argp_option argp_options[] = {
   {"tries", 'q', "NUM", 0, "send NUM probe packets per hop (default: 3)",
    GRP+1},
   {"type", 'M', "METHOD", 0, "use METHOD (`icmp' or `udp') for traceroute "
-   "operations", GRP+1},
+   "operations, defaulting to `udp'", GRP+1},
+  {"wait", 'w', "NUM", 0, "wait NUM seconds for response (default: 3)",
+   GRP+1},
 #undef GRP
   {NULL, 0, NULL, 0, NULL, 0}
 };
@@ -147,9 +154,19 @@ parse_opt (int key, char *arg, struct argp_state *state)
 
   switch (key)
     {
+    case 'f':
+      opt_ttl = strtol (arg, &p, 0);
+      if (*p || opt_ttl <= 0 || opt_ttl > 255)
+        error (EXIT_FAILURE, 0, "impossible distance `%s'", arg);
+      break;
+
+    case 'I':
+      opt_type = TRACE_ICMP;
+      break;
+
     case 'p':
-      opt_port = strtoul (arg, &p, 0);
-      if (*p || opt_port == 0 || opt_port > 65536)
+      opt_port = strtol (arg, &p, 0);
+      if (*p || opt_port <= 0 || opt_port > 65536)
         error (EXIT_FAILURE, 0, "invalid port number `%s'", arg);
       break;
 
@@ -162,7 +179,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
       break;
 
     case 't':
-      opt_tos = strtoul (arg, &p, 0);
+      opt_tos = strtol (arg, &p, 0);
       if (*p || opt_tos < 0 || opt_tos > 255)
 	error (EXIT_FAILURE, 0, "invalid TOS value `%s'", arg);
       break;
@@ -176,6 +193,12 @@ parse_opt (int key, char *arg, struct argp_state *state)
         argp_error (state, "invalid method");
       break;
 
+    case 'w':
+      opt_wait = strtol (arg, &p, 0);
+      if (*p || opt_wait < 0 || opt_wait > 60)
+	error (EXIT_FAILURE, 0, "ridiculous waiting time `%s'", arg);
+      break;
+
     case OPT_RESOLVE:
       opt_resolve_hostnames = 1;
       break;
@@ -236,6 +259,8 @@ main (int argc, char **argv)
 
 #ifdef HAVE_IDN
   rc = idna_to_ascii_lz (hostname, &rhost, 0);
+  free (hostname);
+
   if (rc)
     error (EXIT_FAILURE, 0, "unknown host");
 #else /* !HAVE_IDN */
@@ -243,6 +268,8 @@ main (int argc, char **argv)
 #endif
 
   rc = getaddrinfo (rhost, NULL, &hints, &res);
+  free (rhost);
+
   if (rc)
     error (EXIT_FAILURE, 0, "unknown host");
 
@@ -297,7 +324,7 @@ do_try (trace_t * trace, const int hop,
       FD_SET (fd, &readset);
 
       memset (&time, 0, sizeof (time));		/* 64-bit issue.  */
-      time.tv_sec = TIME_INTERVAL;
+      time.tv_sec = opt_wait;
       time.tv_usec = 0;
 
       if (!readonly)
@@ -401,7 +428,7 @@ trace_init (trace_t * t, const struct sockaddr_in to,
 
   t->type = type;
   t->to = to;
-  t->ttl = TRACE_TTL;
+  t->ttl = opt_ttl;
 
   if (t->type == TRACE_UDP)
     {

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

Summary of changes:
 ChangeLog          |   19 +++++++++++++
 doc/inetutils.texi |   73 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 src/traceroute.c   |   43 +++++++++++++++++++++++++-----
 3 files changed, 126 insertions(+), 9 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


