aboutsummaryrefslogtreecommitdiffhomepage
path: root/wutil.c
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2006-08-12 00:55:28 +1000
committerGravatar axel <axel@liljencrantz.se>2006-08-12 00:55:28 +1000
commit72ad4e0d3b7d8038a5a911d99bb2175f15c5fd57 (patch)
treeca770b5881b74ec7827e89d00e22f53d85071dff /wutil.c
parent21de293a448a1efdb529573d173b3d8375e618dc (diff)
Make fish pager use non-universal variables as well for getting it's colors
darcs-hash:20060811145528-ac50b-26be05f363f353d87ebceccf73385cd1af1c88f2.gz
Diffstat (limited to 'wutil.c')
-rw-r--r--wutil.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/wutil.c b/wutil.c
index 6dfeb21a..243a446f 100644
--- a/wutil.c
+++ b/wutil.c
@@ -53,12 +53,14 @@
the \c wutil_wcs2str() function.
*/
static char *tmp=0;
+
/**
Buffer for converting narrow results to wide ones, used by the \c
wutil_str2wcs() function. Avoid usign this without thinking about
- it, since sebseuent calls will overwrite previous values.
+ it, since subsequent calls will overwrite previous values.
*/
static wchar_t *tmp2;
+
/**
Length of the \c tmp buffer.
*/
@@ -518,3 +520,27 @@ const wchar_t *wgettext( const wchar_t *in )
return wres;
}
+wchar_t *wgetenv( const wchar_t *name )
+{
+ char *name_narrow =wutil_wcs2str(name);
+ char *res_narrow = getenv( name_narrow );
+ static string_buffer_t *out = 0;
+
+ if( !res_narrow )
+ return 0;
+
+ if( !out )
+ {
+ out = sb_halloc( global_context );
+ }
+ else
+ {
+ sb_clear( out );
+ }
+
+ sb_printf( out, L"%s", res_narrow );
+
+ return (wchar_t *)out->buff;
+
+}
+