mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 13:37:12 +00:00
Be more clever about picking window name.
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
/* $Id: osdep-darwin.c,v 1.1 2009-01-20 22:17:53 nicm Exp $ */
|
||||
/* $Id: osdep-darwin.c,v 1.2 2009-01-26 22:57:19 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Joshua Elsasser <josh@elsasser.org>
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
char *get_argv0(pid_t);
|
||||
char *get_argv0(int, char *);
|
||||
|
||||
/*
|
||||
* XXX This actually returns the executable path, not the process's argv[0].
|
||||
@ -32,13 +32,15 @@ char *get_argv0(pid_t);
|
||||
*/
|
||||
|
||||
char *
|
||||
get_argv0(pid_t pgrp)
|
||||
get_argv0(int fd, __attribute__ ((unused)) char *tty)
|
||||
{
|
||||
int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, 0 };
|
||||
size_t size;
|
||||
struct kinfo_proc kp;
|
||||
|
||||
mib[3] = pgrp;
|
||||
if ((mib[3] = tcgetpgrp(fd)) == -1)
|
||||
return (NULL)
|
||||
|
||||
size = sizeof kp;
|
||||
if (sysctl(mib, 4, &kp, &size, NULL, 0) == -1 ||
|
||||
kp.kp_proc.p_comm[0] == '\0')
|
||||
|
Reference in New Issue
Block a user