xref: /aosp_15_r20/external/toybox/toys/posix/dirname.c (revision cf5a6c84e2b8763fc1a7db14496fd4742913b199)
1 /* dirname.c - show directory portion of path
2  *
3  * Copyright 2011 Rob Landley <[email protected]>
4  *
5  * See http://opengroup.org/onlinepubs/9699919799/utilities/dirname.html
6 
7 USE_DIRNAME(NEWTOY(dirname, "<1", TOYFLAG_USR|TOYFLAG_BIN))
8 
9 config DIRNAME
10   bool "dirname"
11   default y
12   help
13     usage: dirname PATH...
14 
15     Show directory portion of path.
16 */
17 
18 #include "toys.h"
19 
dirname_main(void)20 void dirname_main(void)
21 {
22   char **arg;
23 
24   for (arg = toys.optargs; *arg; ++arg) puts(dirname(*arg));
25 }
26