Add dirname
This commit is contained in:
parent
83af9b4735
commit
d2c5b8a805
|
@ -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;
|
||||||
|
}
|
Loading…
Reference in New Issue