commit d2c5b8a805d1b5977503c5db8e55e6c716037ed0 parent 83af9b4735a32c16bf1373866b85a4ee87faae98 Author: call-cc <callcc@vxempire.xyz> Date: Mon, 1 Jun 2020 18:02:04 -0400 Add dirname Diffstat:
A | src/dirname.c | | | 13 | +++++++++++++ |
1 file changed, 13 insertions(+), 0 deletions(-)
diff --git a/src/dirname.c b/src/dirname.c @@ -0,0 +1,13 @@ +#include <stdio.h> +#include <libgen.h> + +int +main(int argc, char *argv[]) { + char *dir; + if((dir = dirname(argv[1])) == NULL) { + fprintf(stderr, "%s", argv[0]); + return 1; + } + puts(dir); + return 0; +}