aboutsummaryrefslogtreecommitdiffhomepage
path: root/env.c
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2005-10-14 21:40:33 +1000
committerGravatar axel <axel@liljencrantz.se>2005-10-14 21:40:33 +1000
commit0ebf6db4b972648ff5a2bed41120bff7b681ea37 (patch)
treef33c14837e2aa75056cf8e1dccb03b6432a43a1b /env.c
parentf321855c0293ec56c9f61c163bd1ac8927aabd1b (diff)
Increase fish robustness by improving signal handling when forking jobs and minor signal handling improvements
darcs-hash:20051014114033-ac50b-8d0f6274ac590f1b6dbe82c55366f44ed7debf20.gz
Diffstat (limited to 'env.c')
-rw-r--r--env.c38
1 files changed, 33 insertions, 5 deletions
diff --git a/env.c b/env.c
index 0971840f..8fda3a7d 100644
--- a/env.c
+++ b/env.c
@@ -251,7 +251,7 @@ void env_init()
hash_put( &env_read_only, L"LINES", L"" );
hash_put( &env_read_only, L"COLUMNS", L"" );
hash_put( &env_read_only, L"PWD", L"" );
-
+
/*
HOME should be writeable by root, since this is often a
convenient way to install software.
@@ -620,6 +620,24 @@ wchar_t *env_get( const wchar_t *key )
}
return (wchar_t *)dyn_var.buff;
}
+ else if( wcscmp( key, L"COLUMNS" )==0 )
+ {
+ sb_clear( &dyn_var );
+ sb_printf( &dyn_var, L"%d", common_get_width() );
+ return (wchar_t *)dyn_var.buff;
+ }
+ else if( wcscmp( key, L"LINES" )==0 )
+ {
+ sb_clear( &dyn_var );
+ sb_printf( &dyn_var, L"%d", common_get_height() );
+ return (wchar_t *)dyn_var.buff;
+ }
+ else if( wcscmp( key, L"status" )==0 )
+ {
+ sb_clear( &dyn_var );
+ sb_printf( &dyn_var, L"%d", proc_get_last_status() );
+ return (wchar_t *)dyn_var.buff;
+ }
while( env != 0 )
{
@@ -658,10 +676,10 @@ int env_exist( const wchar_t *key )
env_node_t *env = top;
wchar_t *item;
- if( wcscmp( key, L"history" ) == 0 )
- {
- return 1;
- }
+ if( hash_get( &env_read_only, key ) )
+ {
+ return 1;
+ }
while( env != 0 )
{
@@ -809,7 +827,17 @@ void env_get_names( array_list_t *l, int flags )
add_key_to_hash,
&names );
if( get_names_show_unexported )
+ {
al_push( l, L"history" );
+ al_push( l, L"status" );
+ }
+
+ if( get_names_show_exported )
+ {
+ al_push( l, L"COLUMNS" );
+ al_push( l, L"LINES" );
+ }
+
}
if( show_universal )