Date: Thu, 15 Sep 2005 11:07:26 +0200 (CEST) From: Leif Neland <leif@neland.dk> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/86148: Dirname doesn't take multiple arguments as basename does Message-ID: <200509150907.j8F97Q1e097573@arnold.neland.dk> Resent-Message-ID: <200509150910.j8F9ABmL080118@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 86148
>Category: bin
>Synopsis: Dirname doesn't take multiple arguments as basename does
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Thu Sep 15 09:10:11 GMT 2005
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200509150907.j8F97Q1e097573>
