add workingdir patch

This commit is contained in:
2026-02-11 07:30:17 -05:00
parent 81a12eca2a
commit 3838491c5d
9 changed files with 260 additions and 129 deletions

13
x.c
View File

@@ -255,6 +255,7 @@ static char *opt_io = NULL;
static char *opt_line = NULL;
static char *opt_name = NULL;
static char *opt_title = NULL;
static char *opt_dir = NULL;
static uint buttons; /* bit field of pressed buttons */
@@ -2159,12 +2160,12 @@ run(void)
void
usage(void)
{
die("usage: %s [-aiv] [-c class] [-f font] [-g geometry]"
" [-n name] [-o file]\n"
die("usage: %s [-aiv] [-c class] [-d path] [-f font]"
" [-g geometry] [-n name] [-o file]\n"
" [-T title] [-t title] [-w windowid]"
" [[-e] command [args ...]]\n"
" %s [-aiv] [-c class] [-f font] [-g geometry]"
" [-n name] [-o file]\n"
" %s [-aiv] [-c class] [-d path] [-f font]"
" [-g geometry] [-n name] [-o file]\n"
" [-T title] [-t title] [-w windowid] -l line"
" [stty_args ...]\n", argv0, argv0);
}
@@ -2216,6 +2217,9 @@ main(int argc, char *argv[])
case 'v':
die("%s " VERSION "\n", argv0);
break;
case 'd':
opt_dir = EARGF(usage());
break;
default:
usage();
} ARGEND;
@@ -2235,6 +2239,7 @@ run:
xinit(cols, rows);
xsetenv();
selinit();
chdir(opt_dir);
run();
return 0;