diff options
author | axel <axel@liljencrantz.se> | 2006-07-11 08:39:56 +1000 |
---|---|---|
committer | axel <axel@liljencrantz.se> | 2006-07-11 08:39:56 +1000 |
commit | bb04df2ac99465505264496d3ddae9e693267291 (patch) | |
tree | ca6073acd6b17212285afea3787a7c574094ff0f | |
parent | 746a602515360c2119a445d352d20ebf300efd7c (diff) |
Minor code tweaks: A few extra input validations, spelling corrections, etc
darcs-hash:20060710223956-ac50b-22d3b2adf570872564abf7ab68bb223d0c4a5308.gz
-rw-r--r-- | complete.c | 5 | ||||
-rw-r--r-- | main.c | 2 | ||||
-rw-r--r-- | output.c | 25 | ||||
-rw-r--r-- | share/fish.in | 2 |
4 files changed, 23 insertions, 11 deletions
@@ -1965,6 +1965,9 @@ void complete( const wchar_t *cmd, CHECK( cmd, ); CHECK( comp, ); + +// debug( 1, L"Complete '%ls'", cmd ); + /** If we are completing a variable name or a tilde expansion user @@ -2062,7 +2065,7 @@ void complete( const wchar_t *cmd, prev_token = prev_begin ? wcsndup( prev_begin, prev_end - prev_begin ): wcsdup(L""); -// fwprintf( stderr, L"on_command: %d, %ls %ls\n", on_command, current_compmand, current_token ); +// debug( 0, L"on_command: %d, %ls %ls\n", on_command, current_command, current_token ); if( !had_cmd ) { on_command=1; @@ -90,7 +90,7 @@ static int read_init() if( chdir( cwd ) == -1 ) { /* - If we can't change back to previos irectory, we'll stay in + If we can't change back to previos directory, we'll stay in ~. Should be a sane default behavior. */ } @@ -123,6 +123,7 @@ static void output_destroy() void output_set_writer( int (*writer)(char) ) { + CHECK( writer, ); out = writer; } @@ -145,8 +146,6 @@ void set_color( int c, int c2 ) is_underline |= (c&FISH_COLOR_UNDERLINE)!=0; is_underline |= (c2&FISH_COLOR_UNDERLINE)!=0; -// debug( 1, L"WOO %d %d %d", is_bold, c&FISH_COLOR_BOLD,c2&FISH_COLOR_BOLD); - c = c&(~(FISH_COLOR_BOLD|FISH_COLOR_UNDERLINE)); c2 = c2&(~(FISH_COLOR_BOLD|FISH_COLOR_UNDERLINE)); @@ -367,9 +366,8 @@ int writeb( tputs_arg_t b ) int writembs( char *str ) { - if( !str ) - return 1; - + CHECK( str, 1 ); + return tputs(str,1,&writeb)==ERR?1:0; } @@ -410,6 +408,8 @@ int writech( wint_t ch ) void writestr( const wchar_t *str ) { char *pos; + + CHECK( str, ); // while( *str ) // writech( *str++ ); @@ -465,7 +465,11 @@ void writestr( const wchar_t *str ) void writestr_ellipsis( const wchar_t *str, int max_width ) { int written=0; - int tot = my_wcswidth(str); + int tot; + + CHECK( str, ); + + tot = my_wcswidth(str); if( tot <= max_width ) { @@ -497,11 +501,16 @@ void writestr_ellipsis( const wchar_t *str, int max_width ) int write_escaped_str( const wchar_t *str, int max_len ) { - wchar_t *out = escape( str, 1 ); + wchar_t *out; int i; - int len = my_wcswidth( out ); + int len; int written=0; + CHECK( str, 0 ); + + out = escape( str, 1 ); + len = my_wcswidth( out ); + if( max_len && (max_len < len)) { for( i=0; (written+wcwidth(out[i]))<=(max_len-1); i++ ) diff --git a/share/fish.in b/share/fish.in index a4226237..a7e6e1dd 100644 --- a/share/fish.in +++ b/share/fish.in @@ -24,7 +24,7 @@ for idx in (seq (count $PATH)) end if count $erase_idx >/dev/null - set -e PATH[(echo $erase_idx)] + set -e PATH[(echo $erase_idx)] end # |