mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
client: -D,--working-directory: check path exists and is a directory
This commit is contained in:
parent
f896f12967
commit
5b0ebee290
1 changed files with 8 additions and 1 deletions
9
client.c
9
client.c
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#define LOG_MODULE "foot-client"
|
#define LOG_MODULE "foot-client"
|
||||||
#define LOG_ENABLE_DBG 0
|
#define LOG_ENABLE_DBG 0
|
||||||
|
|
@ -125,9 +126,15 @@ main(int argc, char *const *argv)
|
||||||
login_shell = true;
|
login_shell = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'D':
|
case 'D': {
|
||||||
|
struct stat st;
|
||||||
|
if (stat(optarg, &st) < 0 || !(st.st_mode & S_IFDIR)) {
|
||||||
|
fprintf(stderr, "error: %s: not a directory\n", optarg);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
custom_cwd = optarg;
|
custom_cwd = optarg;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 'w':
|
case 'w':
|
||||||
if (sscanf(optarg, "%ux%u", &width, &height) != 2 || width == 0 || height == 0) {
|
if (sscanf(optarg, "%ux%u", &width, &height) != 2 || width == 0 || height == 0) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue