[hackers] [sbase][PATCH] dirname: support --

From: Mattias Andrée <maandree_AT_kth.se>
Date: Fri, 6 Jul 2018 23:19:30 +0200

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>
---
 dirname.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/dirname.c b/dirname.c
index 8392bc0..45e1a7e 100644
--- a/dirname.c
+++ b/dirname.c
_AT_@ -13,7 +13,10 @@ usage(void)
 int
 main(int argc, char *argv[])
 {
-	argv0 = *argv, argv0 ? (argc--, argv++) : (void *)0;
+	ARGBEGIN {
+	default:
+		usage();
+	} ARGEND
 
 	if (argc != 1)
 		usage();
-- 
2.11.1
Received on Fri Jul 06 2018 - 23:19:30 CEST

This archive was generated by hypermail 2.3.0 : Fri Jul 06 2018 - 23:24:25 CEST