=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/format.c,v retrieving revision 1.75 retrieving revision 1.76 diff -u -r1.75 -r1.76 --- src/usr.bin/tmux/format.c 2015/07/13 15:37:26 1.75 +++ src/usr.bin/tmux/format.c 2015/08/28 10:06:52 1.76 @@ -1,4 +1,4 @@ -/* $OpenBSD: format.c,v 1.75 2015/07/13 15:37:26 nicm Exp $ */ +/* $OpenBSD: format.c,v 1.76 2015/08/28 10:06:52 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott @@ -322,6 +322,7 @@ { struct format_entry *fe, fe_find; struct options_entry *o; + struct environ_entry *envent; static char s[16]; o = options_find(&global_options, key); @@ -347,9 +348,18 @@ fe_find.key = (char *) key; fe = RB_FIND(format_entry_tree, &ft->tree, &fe_find); - if (fe == NULL) - return (NULL); - return (fe->value); + if (fe != NULL) + return (fe->value); + + envent = NULL; + if (ft->s != NULL) + envent = environ_find(&ft->s->environ, key); + if (envent == NULL) + envent = environ_find(&global_environ, key); + if (envent != NULL) + return (envent->value); + + return (NULL); } /* @@ -371,7 +381,7 @@ copy[keylen] = '\0'; /* Is there a length limit or whatnot? */ - if (!islower((u_char) *copy) && *copy != '@' && *copy != '?') { + if (!isalpha((u_char) *copy) && *copy != '@' && *copy != '?') { while (*copy != ':' && *copy != '\0') { switch (*copy) { case '=':