xref: /third_party/toybox/toys/posix/dirname.c (revision 0f66f451)
1/* dirname.c - show directory portion of path
2 *
3 * Copyright 2011 Rob Landley <rob@landley.net>
4 *
5 * See http://opengroup.org/onlinepubs/9699919799/utilities/dirname.html
6
7USE_DIRNAME(NEWTOY(dirname, "<1", TOYFLAG_USR|TOYFLAG_BIN))
8
9config 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
20void dirname_main(void)
21{
22  char **arg;
23
24  for (arg = toys.optargs; *arg; ++arg) puts(dirname(*arg));
25}
26