Re: [hackers] [sbase][PATCH] basename: support --

From: Silvan Jegen <s.jegen_AT_gmail.com>
Date: Sat, 7 Jul 2018 09:42:27 +0200

On Fri, Jul 6, 2018 at 11:19 PM, Mattias Andrée <maandree_AT_kth.se> wrote:
> POSIX-2017 clarifies that -- and normal option parsing must be supported.
> See EXAMPLES in basename(1p).
>
> Signed-off-by: Mattias Andrée <maandree_AT_kth.se>
> ---
> basename.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)

Looks good!

I also tested it.


Cheers,

Silvan

> diff --git a/basename.c b/basename.c
> index d211799..94a2848 100644
> --- a/basename.c
> +++ b/basename.c
> _AT_@ -17,7 +17,10 @@ main(int argc, char *argv[])
> ssize_t off;
> char *p;
>
> - argv0 = *argv, argv0 ? (argc--, argv++) : (void *)0;
> + ARGBEGIN {
> + default:
> + usage();
> + } ARGEND
>
> if (argc != 1 && argc != 2)
> usage();
> --
> 2.11.1
>
>
Received on Sat Jul 07 2018 - 09:42:27 CEST

This archive was generated by hypermail 2.3.0 : Sat Jul 07 2018 - 09:48:26 CEST