dirname: support multiple arguments.
This commit is contained in:
parent
2559f9dd6b
commit
d1d751e4be
@ -8,3 +8,4 @@ testing "/-only" "dirname ///////" "/\n" "" ""
|
||||
testing "trailing /" "dirname a//////" ".\n" "" ""
|
||||
testing "combined" "dirname /////a///b///c///d/////" "/////a///b///c\n" "" ""
|
||||
testing "/a/" "dirname /////a///" "/\n" "" ""
|
||||
testing "multiple" "dirname hello/a world/b" "hello\nworld\n" "" ""
|
||||
|
@ -10,7 +10,7 @@ config DIRNAME
|
||||
bool "dirname"
|
||||
default y
|
||||
help
|
||||
usage: dirname PATH
|
||||
usage: dirname PATH...
|
||||
|
||||
Show directory portion of path.
|
||||
*/
|
||||
@ -19,5 +19,7 @@ config DIRNAME
|
||||
|
||||
void dirname_main(void)
|
||||
{
|
||||
puts(dirname(*toys.optargs));
|
||||
char **arg;
|
||||
|
||||
for (arg = toys.optargs; *arg; ++arg) puts(dirname(*arg));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user