From sa@gw2.svzserv.kemerovo.su  Tue Dec  3 00:45:10 2002
Return-Path: <sa@gw2.svzserv.kemerovo.su>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 9654B37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  3 Dec 2002 00:45:10 -0800 (PST)
Received: from gw2.svzserv.kemerovo.su (gw2.svzserv.kemerovo.su [213.184.65.69])
	by mx1.FreeBSD.org (Postfix) with ESMTP id CEBC943E9C
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  3 Dec 2002 00:45:06 -0800 (PST)
	(envelope-from sa@gw2.svzserv.kemerovo.su)
Received: from gw2.svzserv.kemerovo.su (localhost [127.0.0.1])
	by gw2.svzserv.kemerovo.su (8.12.6/8.12.6) with ESMTP id gB38j00C051333
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 3 Dec 2002 15:45:01 +0700 (KRAT)
	(envelope-from sa@gw2.svzserv.kemerovo.su)
Received: (from root@localhost)
	by gw2.svzserv.kemerovo.su (8.12.6/8.12.6/Submit) id gB38isrO051312;
	Tue, 3 Dec 2002 15:44:54 +0700 (KRAT)
Message-Id: <200212030844.gB38isrO051312@gw2.svzserv.kemerovo.su>
Date: Tue, 3 Dec 2002 15:44:54 +0700 (KRAT)
From: System Administrator <sa@gw2.svzserv.kemerovo.su>
Reply-To: System Administrator <sa@gw2.svzserv.kemerovo.su>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] extend arp -f syntax
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         45958
>Category:       bin
>Synopsis:       [PATCH] extend arp -f syntax
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    ru
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 03 00:50:01 PST 2002
>Closed-Date:    Fri Jan 17 00:13:16 PST 2003
>Last-Modified:  Sun Feb 23 11:40:03 PST 2003
>Originator:     Eugene Grosbein <eugen@grosbein.pp.ru>
>Release:        FreeBSD 4.7-STABLE i386
>Organization:
Svyaz Service JSC
>Environment:
System: FreeBSD gw2.svzserv.kemerovo.su 4.7-STABLE FreeBSD 4.7-STABLE #6: Thu Nov 21 10:54:09 KRAT 2002 sa@gw2.svzserv.kemerovo.su:/usr/obj/usr/src/sys/GW2 i386


>Description:
		arp(8) has option -f to load data from file
		but it doesn't support comments in file.
		This makes it impossible to keep $Id: $ in a file
		when configuration files are kept in CVS Repository.

>How-To-Repeat:
		N/A
>Fix:

		This patch allows use of comments starting with #
		and extending to the end of the line; it allows use
		of empty lines and lines containing whitespace only,
		those are skipped.


diff -ur src/usr.sbin/arp.orig/arp.8 src/usr.sbin/arp/arp.8
--- src/usr.sbin/arp.orig/arp.8	Tue Dec  3 15:43:07 2002
+++ src/usr.sbin/arp/arp.8	Tue Dec  3 15:39:20 2002
@@ -163,6 +163,9 @@
 .Ed
 .Pp
 with argument meanings as given above.
+.Pp
+Comments start with hash symbol (#) and extend to the end of the line.
+Empty lines and lines containing white spaces only are ignored.
 .El
 .Sh SEE ALSO
 .Xr inet 3 ,
diff -ur src/usr.sbin/arp.orig/arp.c src/usr.sbin/arp/arp.c
--- src/usr.sbin/arp.orig/arp.c	Tue Dec  3 15:43:07 2002
+++ src/usr.sbin/arp/arp.c	Tue Dec  3 15:28:08 2002
@@ -81,6 +81,7 @@
 #include <stdlib.h>
 #include <strings.h>
 #include <unistd.h>
+#include <ctype.h>
 
 void search(u_long addr, void (*action)(struct sockaddr_dl *sdl,
 	struct sockaddr_inarp *sin, struct rt_msghdr *rtm));
@@ -218,7 +219,7 @@
 {
 	FILE *fp;
 	int i, retval;
-	char line[100], arg[5][50], *args[5];
+	char line[100], arg[5][50], *args[5], *c;
 
 	if ((fp = fopen(name, "r")) == NULL)
 		errx(1, "cannot open %s", name);
@@ -229,6 +230,17 @@
 	args[4] = &arg[4][0];
 	retval = 0;
 	while(fgets(line, 100, fp) != NULL) {
+		for (i = 1, c = line; *c; c++) {
+			if (*c == '#') {
+				*c = '\0';
+				break;
+			}
+			else {
+			    if (!isspace(*c))
+				i=0;
+			}
+		}
+		if (i) continue;
 		i = sscanf(line, "%49s %49s %49s %49s %49s", arg[0], arg[1],
 		    arg[2], arg[3], arg[4]);
 		if (i < 2) {
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->ru 
Responsible-Changed-By: ru 
Responsible-Changed-When: Thu Dec 26 11:32:28 PST 2002 
Responsible-Changed-Why:  
I was going to add this feature anyway. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=45958 
State-Changed-From-To: open->patched 
State-Changed-By: ru 
State-Changed-When: Fri Dec 27 02:09:30 PST 2002 
State-Changed-Why:  
Fixed in 5.0-CURRENT. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=45958 
State-Changed-From-To: patched->closed 
State-Changed-By: ru 
State-Changed-When: Fri Jan 17 00:12:51 PST 2003 
State-Changed-Why:  
Fixed in 4.7-STABLE. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=45958 

From: Eugene Grosbein <eugen@grosbein.pp.ru>
To: bug-followup@freebsd.org
Cc: ru@freebsd.org
Subject: Re: bin/45958: [PATCH] extend arp -f syntax
Date: Sun, 23 Feb 2003 17:08:21 +0700

 Hi!
 
 This PR should be closed now as requested feature is
 in CURRENT and STABLE. Thanks!
 
 Eugene Grosbein

From: Ruslan Ermilov <ru@freebsd.org>
To: Eugene Grosbein <eugen@grosbein.pp.ru>
Cc: bug-followup@freebsd.org
Subject: Re: bin/45958: [PATCH] extend arp -f syntax
Date: Sun, 23 Feb 2003 21:33:33 +0200

 --rqzD5py0kzyFAOWN
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 On Sun, Feb 23, 2003 at 05:08:21PM +0700, Eugene Grosbein wrote:
 > Hi!
 >=20
 > This PR should be closed now as requested feature is
 > in CURRENT and STABLE. Thanks!
 >=20
 Need to catch up to your email?  :-)
 
 State-Changed-From-To: patched->closed
 State-Changed-By: ru
 State-Changed-When: Fri Jan 17 00:12:51 PST 2003
 State-Changed-Why:
 Fixed in 4.7-STABLE.
 
 
 Cheers,
 --=20
 Ruslan Ermilov		Sysadmin and DBA,
 ru@sunbay.com		Sunbay Software AG,
 ru@FreeBSD.org		FreeBSD committer,
 +380.652.512.251	Simferopol, Ukraine
 
 http://www.FreeBSD.org	The Power To Serve
 http://www.oracle.com	Enabling The Information Age
 
 --rqzD5py0kzyFAOWN
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.2.1 (FreeBSD)
 
 iD8DBQE+WSINUkv4P6juNwoRAqNUAJ0QuhcqHpbebJ6JVQ6sBuompqLOzgCeMWNn
 WBUcVaVOFXgfxmxpk0gjALw=
 =W7ic
 -----END PGP SIGNATURE-----
 
 --rqzD5py0kzyFAOWN--
>Unformatted:
