mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
Comment updates, minor code cleanups and other janitorial jobs
darcs-hash:20071002100937-75c98-d4040e70a256e36a6334cca0a05d60500680132b.gz
This commit is contained in:
parent
dac2129048
commit
d34d05ca8b
7 changed files with 54 additions and 61 deletions
38
builtin.c
38
builtin.c
|
@ -186,22 +186,17 @@ static int count_char( const wchar_t *str, wchar_t c )
|
|||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
Print help for the specified builtin. If \c b is sb_err, also print
|
||||
the line information
|
||||
|
||||
If \c b is the buffer representing standard error, and the help
|
||||
message is about to be printed to an interactive screen, it may be
|
||||
shortened to fit the screen.
|
||||
|
||||
*/
|
||||
|
||||
wchar_t *builtin_help_get( const wchar_t *name )
|
||||
{
|
||||
array_list_t lst;
|
||||
string_buffer_t cmd;
|
||||
wchar_t *name_esc;
|
||||
|
||||
/*
|
||||
Because the contents of this buffer is returned by this
|
||||
function, it must not be free'd on exit, so we allocate it
|
||||
using halloc.
|
||||
*/
|
||||
static string_buffer_t *out = 0;
|
||||
int i;
|
||||
|
||||
|
@ -239,6 +234,16 @@ wchar_t *builtin_help_get( const wchar_t *name )
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
Print help for the specified builtin. If \c b is sb_err, also print
|
||||
the line information
|
||||
|
||||
If \c b is the buffer representing standard error, and the help
|
||||
message is about to be printed to an interactive screen, it may be
|
||||
shortened to fit the screen.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
static void builtin_print_help( const wchar_t *cmd, string_buffer_t *b )
|
||||
{
|
||||
|
@ -565,7 +570,6 @@ static int builtin_bind( wchar_t **argv )
|
|||
}
|
||||
;
|
||||
|
||||
int i;
|
||||
int argc=builtin_count_args( argv );
|
||||
int mode = BIND_INSERT;
|
||||
int res = STATUS_BUILTIN_OK;
|
||||
|
@ -3772,13 +3776,8 @@ int builtin_exists( wchar_t *cmd )
|
|||
static int internal_help( wchar_t *cmd )
|
||||
{
|
||||
CHECK( cmd, 0 );
|
||||
|
||||
return ( wcscmp( cmd, L"for" ) == 0 ||
|
||||
wcscmp( cmd, L"while" ) == 0 ||
|
||||
wcscmp( cmd, L"function" ) == 0 ||
|
||||
wcscmp( cmd, L"if" ) == 0 ||
|
||||
wcscmp( cmd, L"end" ) == 0 ||
|
||||
wcscmp( cmd, L"switch" ) == 0 );
|
||||
return contains( cmd, L"for", L"while", L"function",
|
||||
L"if", L"end", L"switch" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -3819,8 +3818,7 @@ int builtin_run( wchar_t **argv, io_data_t *io )
|
|||
|
||||
void builtin_get_names( array_list_t *list )
|
||||
{
|
||||
CHECK( list, );
|
||||
|
||||
CHECK( list, );
|
||||
hash_get_keys( &builtin, list );
|
||||
}
|
||||
|
||||
|
|
|
@ -165,10 +165,11 @@ const wchar_t *builtin_complete_get_temporary_buffer();
|
|||
|
||||
|
||||
/**
|
||||
Return the help text for the specified builtin command.
|
||||
|
||||
\param cmd The command for which to obtain help text
|
||||
Run the __fish_print_help function to obtain the help information
|
||||
for the specified command. The resulting string will be valid until
|
||||
the next time this function is called, and must never be free'd manually.
|
||||
*/
|
||||
|
||||
wchar_t *builtin_help_get( const wchar_t *cmd );
|
||||
|
||||
#endif
|
||||
|
|
6
common.c
6
common.c
|
@ -263,9 +263,9 @@ wchar_t *str2wcs_internal( const char *in, wchar_t *out )
|
|||
{
|
||||
res = mbrtowc( &out[out_pos], &in[in_pos], len-in_pos, &state );
|
||||
|
||||
if( ( out[out_pos] >= ENCODE_DIRECT_BASE) &&
|
||||
( out[out_pos] < ENCODE_DIRECT_BASE+256) ||
|
||||
out[out_pos] == INTERNAL_SEPARATOR )
|
||||
if( ( ( out[out_pos] >= ENCODE_DIRECT_BASE) &&
|
||||
( out[out_pos] < ENCODE_DIRECT_BASE+256)) ||
|
||||
( out[out_pos] == INTERNAL_SEPARATOR ) )
|
||||
{
|
||||
out[out_pos] = ENCODE_DIRECT_BASE + (unsigned char)in[in_pos];
|
||||
in_pos++;
|
||||
|
|
10
event.c
10
event.c
|
@ -78,11 +78,6 @@ static array_list_t *killme;
|
|||
*/
|
||||
static array_list_t *blocked;
|
||||
|
||||
/**
|
||||
String buffer used for formating event descriptions in event_get_desc()
|
||||
*/
|
||||
static string_buffer_t *get_desc_buff=0;
|
||||
|
||||
/**
|
||||
Tests if one event instance matches the definition of a event
|
||||
class. If both the class and the instance name a function,
|
||||
|
@ -207,6 +202,11 @@ static int event_is_blocked( event_t *e )
|
|||
const wchar_t *event_get_desc( event_t *e )
|
||||
{
|
||||
|
||||
/*
|
||||
String buffer used for formating event descriptions in event_get_desc()
|
||||
*/
|
||||
static string_buffer_t *get_desc_buff=0;
|
||||
|
||||
CHECK( e, 0 );
|
||||
|
||||
if( !get_desc_buff )
|
||||
|
|
20
event.h
20
event.h
|
@ -2,6 +2,12 @@
|
|||
|
||||
Functions for handling event triggers
|
||||
|
||||
Because most of these functions can be called by signal
|
||||
handler, it is important to make it well defined when these
|
||||
functions produce output or perform memory allocations, since
|
||||
such functions may not be safely called by signal handlers.
|
||||
|
||||
|
||||
*/
|
||||
#ifndef FISH_EVENT_H
|
||||
#define FISH_EVENT_H
|
||||
|
@ -91,11 +97,15 @@ typedef struct
|
|||
|
||||
/**
|
||||
Add an event handler
|
||||
|
||||
May not be called by a signal handler, since it may allocate new memory.
|
||||
*/
|
||||
void event_add_handler( event_t *event );
|
||||
|
||||
/**
|
||||
Remove all events matching the specified criterion.
|
||||
|
||||
May not be called by a signal handler, since it may free allocated memory.
|
||||
*/
|
||||
void event_remove( event_t *event );
|
||||
|
||||
|
@ -120,9 +130,13 @@ int event_get( event_t *criterion, array_list_t *out );
|
|||
dispatched.
|
||||
|
||||
This function is safe to call from a signal handler _ONLY_ if the
|
||||
event parameter is for a signal.
|
||||
event parameter is for a signal. Signal events not be fired, by the
|
||||
call to event_fire, instead they will be fired the next time
|
||||
event_fire is called with anull argument. This is needed to make
|
||||
sure that no code evaluation is ever performed by a signal handler.
|
||||
|
||||
\param event the specific event whose handlers should fire
|
||||
\param event the specific event whose handlers should fire. If
|
||||
null, then all delayed events will be fired.
|
||||
*/
|
||||
void event_fire( event_t *event );
|
||||
|
||||
|
@ -137,7 +151,7 @@ void event_init();
|
|||
void event_destroy();
|
||||
|
||||
/**
|
||||
Free all memory used by event
|
||||
Free all memory used by the specified event
|
||||
*/
|
||||
void event_free( event_t *e );
|
||||
|
||||
|
|
32
input.c
32
input.c
|
@ -243,27 +243,6 @@ static int is_init = 0;
|
|||
static void input_terminfo_init();
|
||||
static void input_terminfo_destroy();
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Returns the function name for the given function code.
|
||||
*/
|
||||
/*
|
||||
static const wchar_t *input_get_name( wchar_t c )
|
||||
{
|
||||
|
||||
int i;
|
||||
for( i = 0; i<(sizeof( code_arr )/sizeof(wchar_t)) ; i++ )
|
||||
{
|
||||
if( c == code_arr[i] )
|
||||
{
|
||||
return name_arr[i];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
/**
|
||||
Returns the function description for the given function code.
|
||||
*/
|
||||
|
@ -427,7 +406,7 @@ static wint_t input_exec_binding( input_mapping_t *m, const wchar_t *seq )
|
|||
|
||||
Bindings that produce output should emit a R_REPAINT
|
||||
function by calling 'commandline -f repaint' to tell
|
||||
fish that a repaint is in order.
|
||||
fish that a repaint is in order.
|
||||
*/
|
||||
|
||||
return R_NULL;
|
||||
|
@ -534,7 +513,7 @@ wint_t input_readch()
|
|||
;
|
||||
arr[0] = input_common_readch(0);
|
||||
|
||||
return input_exec_binding( m, arr );
|
||||
return input_exec_binding( generic, arr );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -660,9 +639,10 @@ static void input_terminfo_init()
|
|||
TERMINFO_ADD(key_f19);
|
||||
TERMINFO_ADD(key_f20);
|
||||
/*
|
||||
I know of no key board with more than 20 function keys, so
|
||||
adding the rest here makes very little sense, since it will
|
||||
take up a lot of room in any listings, but with no benefit.
|
||||
I know of no keyboard with more than 20 function keys, so
|
||||
adding the rest here makes very little sense, since it will
|
||||
take up a lot of room in any listings (like tab completions),
|
||||
but with no benefit.
|
||||
*/
|
||||
/*
|
||||
TERMINFO_ADD(key_f21);
|
||||
|
|
2
signal.c
2
signal.c
|
@ -450,7 +450,7 @@ static void handle_winch( int sig, siginfo_t *info, void *context )
|
|||
}
|
||||
|
||||
/**
|
||||
Respond to a hup signal by exiting, unless it is vcaught by a
|
||||
Respond to a hup signal by exiting, unless it is caught by a
|
||||
shellscript function, in which case we do nothing.
|
||||
*/
|
||||
static void handle_hup( int sig, siginfo_t *info, void *context )
|
||||
|
|
Loading…
Reference in a new issue