2021-11-26 06:41:56 +03:00
|
|
|
/**
|
|
|
|
* @brief dirname - print directory name from path string
|
|
|
|
*
|
|
|
|
* @copyright
|
2018-11-18 03:56:43 +03:00
|
|
|
* This file is part of ToaruOS and is released under the terms
|
|
|
|
* of the NCSA / University of Illinois License - see LICENSE.md
|
|
|
|
* Copyright (C) 2018 K. Lange
|
|
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <libgen.h>
|
|
|
|
|
|
|
|
int main(int argc, char * argv[]) {
|
|
|
|
if (argc < 2) {
|
|
|
|
fprintf(stderr, "%s: expected argument\n", argv[0]);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
char * c = dirname(argv[1]);
|
|
|
|
fprintf(stdout, "%s\n", c);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|