From root@arnold.neland.dk  Thu Sep 15 09:07:56 2005
Return-Path: <root@arnold.neland.dk>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id DC5FE16A41F
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 15 Sep 2005 09:07:56 +0000 (GMT)
	(envelope-from root@arnold.neland.dk)
Received: from swip.net (mailfe07.swip.net [212.247.154.193])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 3D12243D48
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 15 Sep 2005 09:07:55 +0000 (GMT)
	(envelope-from root@arnold.neland.dk)
Received: from arnold.neland.dk ([83.72.129.7] verified)
  by mailfe07.swip.net (CommuniGate Pro SMTP 4.3.4)
  with ESMTP id 259177077 for FreeBSD-gnats-submit@freebsd.org; Thu, 15 Sep 2005 11:07:54 +0200
Received: from arnold.neland.dk (localhost [127.0.0.1])
	by arnold.neland.dk (8.13.4/8.13.1) with ESMTP id j8F97QSF097579
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO)
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 15 Sep 2005 11:07:27 +0200 (CEST)
	(envelope-from root@arnold.neland.dk)
Received: (from root@localhost)
	by arnold.neland.dk (8.13.4/8.13.1/Submit) id j8F97Q1e097573;
	Thu, 15 Sep 2005 11:07:26 +0200 (CEST)
	(envelope-from root)
Message-Id: <200509150907.j8F97Q1e097573@arnold.neland.dk>
Date: Thu, 15 Sep 2005 11:07:26 +0200 (CEST)
From: Leif Neland <leif@neland.dk>
Reply-To: Leif Neland <leif@neland.dk>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Dirname doesn't take multiple arguments as basename does
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         86148
>Category:       bin
>Synopsis:       [patch] dirname(1) doesn't take multiple arguments as basename does
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    rwatson
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 15 09:10:11 GMT 2005
>Closed-Date:    Sat Feb 07 11:38:35 UTC 2009
>Last-Modified:  Sat Feb 07 11:39:39 UTC 2009
>Originator:     Leif Neland
>Release:        FreeBSD 7.0-CURRENT i386
>Organization:
no
>Environment:
System: FreeBSD arnold.neland.dk 7.0-CURRENT FreeBSD 7.0-CURRENT #5: Thu Aug 25 19:21:48 CEST 2005 root@arnold.neland.dk:/usr/obj/usr/src/sys/ARNOLD i386


	
>Description:
	The command 	/usr/bin/dirname only takes one filename as
parameter whereas /usr/bin/basename takes multiple.

This is un-orthogonal (?)
>How-To-Repeat:
	

	# dirname `locate bsd`
	Usage: ...
>Fix:
	This patch

	
*** dirname.c.org	Sun May 22 04:15:26 2005
--- dirname.c	Thu Sep 15 10:55:58 2005
***************
*** 66,77 ****
  	argc -= optind;
  	argv += optind;
  
! 	if (argc != 1)
  		usage();
  
! 	if ((p = dirname(*argv)) == NULL)
! 		err(1, "%s", *argv);
! 	(void)printf("%s\n", p);
  	exit(0);
  }
  
--- 66,80 ----
  	argc -= optind;
  	argv += optind;
  
! 	if (argc < 1)
  		usage();
  
! 	while (argc--) {
! 		if ((p = dirname(*argv)) == NULL)
! 			err(1, "%s", *argv);
! 		argv++;
! 		(void)printf("%s\n", p);
! 	}
  	exit(0);
  }
  
***************
*** 79,84 ****
  usage(void)
  {
  
! 	(void)fprintf(stderr, "usage: dirname string\n");
  	exit(1);
  }
--- 82,87 ----
  usage(void)
  {
  
! 	(void)fprintf(stderr, "usage: dirname string [...]\n");
  	exit(1);
  }



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.

>Release-Note:
>Audit-Trail:

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/86148: commit references a PR
Date: Mon,  2 Feb 2009 11:20:41 +0000 (UTC)

 Author: rwatson
 Date: Mon Feb  2 11:19:56 2009
 New Revision: 188006
 URL: http://svn.freebsd.org/changeset/base/188006
 
 Log:
   Alow dirname(1) to accept multiple arguments in the same way that
   basename(1) does.
   
   (Two different PRs contained identical patches, both cited below)
   
   PR:		121520, 86148
   Submitted by:	Ighighi <ighighi at gmail dot com>
   Submitted by:	Leif Neland <leif at neland dot dk>
   MFC after:	3 days
 
 Modified:
   head/usr.bin/basename/basename.1
   head/usr.bin/dirname/dirname.c
 
 Modified: head/usr.bin/basename/basename.1
 ==============================================================================
 --- head/usr.bin/basename/basename.1	Mon Feb  2 11:02:19 2009	(r188005)
 +++ head/usr.bin/basename/basename.1	Mon Feb  2 11:19:56 2009	(r188006)
 @@ -52,6 +52,7 @@
  .Op Ar ...
  .Nm dirname
  .Ar string
 +.Op Ar ...
  .Sh DESCRIPTION
  The
  .Nm
 
 Modified: head/usr.bin/dirname/dirname.c
 ==============================================================================
 --- head/usr.bin/dirname/dirname.c	Mon Feb  2 11:02:19 2009	(r188005)
 +++ head/usr.bin/dirname/dirname.c	Mon Feb  2 11:19:56 2009	(r188006)
 @@ -66,12 +66,15 @@ main(int argc, char **argv)
  	argc -= optind;
  	argv += optind;
  
 -	if (argc != 1)
 +	if (argc < 1)
  		usage();
  
 -	if ((p = dirname(*argv)) == NULL)
 -		err(1, "%s", *argv);
 -	(void)printf("%s\n", p);
 +	while (argc--) {
 +		if ((p = dirname(*argv)) == NULL)
 +			err(1, "%s", *argv);
 +		argv++;
 +		(void)printf("%s\n", p);
 +	}
  	exit(0);
  }
  
 @@ -79,6 +82,6 @@ void
  usage(void)
  {
  
 -	(void)fprintf(stderr, "usage: dirname string\n");
 +	(void)fprintf(stderr, "usage: dirname string [...]\n");
  	exit(1);
  }
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->patched 
State-Changed-By: rwatson 
State-Changed-When: Mon Feb 2 13:07:00 UTC 2009 
State-Changed-Why:  
Transition to patched state following commit to HEAD; will close after MFC. 


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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/86148: commit references a PR
Date: Sat,  7 Feb 2009 11:27:45 +0000 (UTC)

 Author: rwatson
 Date: Sat Feb  7 11:27:35 2009
 New Revision: 188279
 URL: http://svn.freebsd.org/changeset/base/188279
 
 Log:
   Merge r188006 from head to stable/7:
   
     Alow dirname(1) to accept multiple arguments in the same way that
     basename(1) does.
   
     (Two different PRs contained identical patches, both cited below)
   
     PR:           121520, 86148
     Submitted by: Ighighi <ighighi at gmail dot com>
     Submitted by: Leif Neland <leif at neland dot dk>
 
 Modified:
   stable/7/usr.bin/basename/   (props changed)
   stable/7/usr.bin/basename/basename.1
   stable/7/usr.bin/dirname/   (props changed)
   stable/7/usr.bin/dirname/dirname.c
 
 Modified: stable/7/usr.bin/basename/basename.1
 ==============================================================================
 --- stable/7/usr.bin/basename/basename.1	Sat Feb  7 11:15:53 2009	(r188278)
 +++ stable/7/usr.bin/basename/basename.1	Sat Feb  7 11:27:35 2009	(r188279)
 @@ -52,6 +52,7 @@
  .Op Ar ...
  .Nm dirname
  .Ar string
 +.Op Ar ...
  .Sh DESCRIPTION
  The
  .Nm
 
 Modified: stable/7/usr.bin/dirname/dirname.c
 ==============================================================================
 --- stable/7/usr.bin/dirname/dirname.c	Sat Feb  7 11:15:53 2009	(r188278)
 +++ stable/7/usr.bin/dirname/dirname.c	Sat Feb  7 11:27:35 2009	(r188279)
 @@ -66,12 +66,15 @@ main(int argc, char **argv)
  	argc -= optind;
  	argv += optind;
  
 -	if (argc != 1)
 +	if (argc < 1)
  		usage();
  
 -	if ((p = dirname(*argv)) == NULL)
 -		err(1, "%s", *argv);
 -	(void)printf("%s\n", p);
 +	while (argc--) {
 +		if ((p = dirname(*argv)) == NULL)
 +			err(1, "%s", *argv);
 +		argv++;
 +		(void)printf("%s\n", p);
 +	}
  	exit(0);
  }
  
 @@ -79,6 +82,6 @@ void
  usage(void)
  {
  
 -	(void)fprintf(stderr, "usage: dirname string\n");
 +	(void)fprintf(stderr, "usage: dirname string [...]\n");
  	exit(1);
  }
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: rwatson 
State-Changed-When: Sat Feb 7 11:38:09 UTC 2009 
State-Changed-Why:  
Close following MFC to 7.x; this change will first appear in FreeBSD 7.2. 
Thanks for the patch! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=86148 
Responsible-Changed-From-To: freebsd-bugs->rwatson 
Responsible-Changed-By: rwatson 
Responsible-Changed-When: Sat Feb 7 11:39:11 UTC 2009 
Responsible-Changed-Why:  
Grab ownership so I can catch any followups (unlikely). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=86148 
>Unformatted:
