Be more clever about picking window name.

This commit is contained in:
Nicholas Marriott
2009-01-26 22:57:20 +00:00
parent 4d7e555a48
commit 9cde0c2477
8 changed files with 173 additions and 36 deletions

View File

@@ -1,4 +1,4 @@
/* $Id: osdep-linux.c,v 1.1 2009-01-20 19:35:03 nicm Exp $ */
/* $Id: osdep-linux.c,v 1.2 2009-01-26 22:57:19 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -27,16 +27,23 @@
#include "tmux.h"
char *
get_argv0(pid_t pgrp)
get_argv0(int fd, unused char *tty)
{
FILE *f;
char *path, *buf;
size_t len;
int ch;
pid_t pgrp;
if ((pgrp = tcgetpgrp(fd)) == -1)
return (NULL);
xasprintf(&path, "/proc/%lld/cmdline", (long long) pgrp);
if ((f = fopen(path, "r")) == NULL)
if ((f = fopen(path, "r")) == NULL) {
xfree(path);
return (NULL);
}
xfree(path);
len = 0;
buf = NULL;