mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2026-01-01 01:41:18 +01:00
Merge pull request #18390 from benpicco/ncget-enhance
sys/shell: improve 'ncget' command
This commit is contained in:
commit
d491898f3c
@ -121,7 +121,16 @@ static int _nanocoap_get_handler(int argc, char **argv)
|
||||
}
|
||||
dst = buffer;
|
||||
} else {
|
||||
char *filename = strrchr(url, '/');
|
||||
dst = argv[2];
|
||||
if (_is_dir(dst) && filename) {
|
||||
if (snprintf(buffer, sizeof(buffer), "%s%s",
|
||||
dst, filename + 1) >= (int)sizeof(buffer)) {
|
||||
printf("Output file path too long\n");
|
||||
return -ENOBUFS;
|
||||
}
|
||||
dst = buffer;
|
||||
}
|
||||
}
|
||||
|
||||
/* alternatively write the file to stdout */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user