bin/86148: Dirname doesn't take multiple arguments as basename does
Leif Neland
leif at neland.dk
Thu Sep 15 02:10:13 PDT 2005
>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 at 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:
More information about the freebsd-bugs
mailing list