Hi!
It happens to me all the time that I want to spawn a new xterm in the
same directory that I am currently in, for example when I want to open a
file with vim but keep a shell in the same directory.

xterm actually has a nice builtin function for this:
spawn-new-terminal()

you can affect that function via the xterm*VT100.translations resource.

however the implementation of this is Linux-specific and it is not
activated in the OpenBSD build process.

Here's a exerpt from HandleSpawnTerminal() in xenocara/app/xterm/misc.c:

/*
* Determine the current working directory of the child so that we can
* spawn a new terminal in the same directory.
*
* If we cannot get the CWD of the child, just use our own.
*/
if (screen->pid) {
        char child_cwd_link[sizeof(PROCFS_ROOT) + 80];
        sprintf(child_cwd_link, PROCFS_ROOT "/%lu/cwd", (unsigned long) 
screen->pid);
        child_cwd = Readlink(child_cwd_link);
}

So it obviously tries to access procfs to get that value. Is there a way
to access the same value via the OpenBSD API?

Best regards,
Jona

-- 
Worse is better
    Richard P. Gabriel

Reply via email to