diff options
Diffstat (limited to 'util/sbase/dirname.c')
-rw-r--r-- | util/sbase/dirname.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/util/sbase/dirname.c b/util/sbase/dirname.c new file mode 100644 index 00000000..45e1a7e2 --- /dev/null +++ b/util/sbase/dirname.c @@ -0,0 +1,27 @@ +/* See LICENSE file for copyright and license details. */ +#include <libgen.h> +#include <stdio.h> + +#include "util.h" + +static void +usage(void) +{ + eprintf("usage: %s path\n", argv0); +} + +int +main(int argc, char *argv[]) +{ + ARGBEGIN { + default: + usage(); + } ARGEND + + if (argc != 1) + usage(); + + puts(dirname(argv[0])); + + return fshut(stdout, "<stdout>"); +} |