summaryrefslogtreecommitdiffstats
path: root/osdep-darwin.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-01-26 22:57:20 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-01-26 22:57:20 +0000
commit9cde0c24779e8f43b6d122bc62fa22b6022d9ef0 (patch)
tree833af8a6751da50421ae9db66ae10e2e6a05823c /osdep-darwin.c
parent4d7e555a48a6fb0732565b24482d24e968f49eae (diff)
Be more clever about picking window name.
Diffstat (limited to 'osdep-darwin.c')
-rw-r--r--osdep-darwin.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/osdep-darwin.c b/osdep-darwin.c
index 653b52fe..5f768cbb 100644
--- a/osdep-darwin.c
+++ b/osdep-darwin.c
@@ -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')