Provide #h for short hostname (no domain) from Michal Mazurek.

This commit is contained in:
Nicholas Marriott
2011-04-24 21:32:07 +00:00
parent dc8fb9fb23
commit eb288aae32
2 changed files with 8 additions and 0 deletions

View File

@@ -410,6 +410,13 @@ status_replace1(struct client *c, struct session *s, struct winlink *wl,
fatal("gethostname failed");
ptr = tmp;
goto do_replace;
case 'h':
if (gethostname(tmp, sizeof tmp) != 0)
fatal("gethostname failed");
if ((ptr = strchr(tmp, '.')) != NULL)
*ptr = '\0';
ptr = tmp;
goto do_replace;
case 'I':
xsnprintf(tmp, sizeof tmp, "%d", wl->idx);
ptr = tmp;