Add dirname

This commit is contained in:
call-cc 2020-06-01 18:02:04 -04:00
parent 83af9b4735
commit d2c5b8a805
1 changed files with 13 additions and 0 deletions

13
src/dirname.c Normal file
View File

@ -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;
}