Sync OpenBSD patchset 898:

Provide #h for short hostname (no domain) from Michal Mazurek.
This commit is contained in:
Tiago Cunha
2011-04-25 20:35:22 +00:00
parent 38611d3207
commit 341f67e827
2 changed files with 11 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $Id: status.c,v 1.158 2011-04-18 21:07:58 nicm Exp $ */
/* $Id: status.c,v 1.159 2011-04-25 20:35:22 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -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;