Minor code edits - add a few braces, a few minor safety checks, etc.

darcs-hash:20060608235719-ac50b-bec405da5ae101ff50bb3390bb83ef8b0948e4e9.gz
This commit is contained in:
axel 2006-06-09 09:57:19 +10:00
parent 5855f78010
commit af8cb6fe87
2 changed files with 20 additions and 5 deletions

View file

@ -1902,7 +1902,10 @@ static int builtin_exit( wchar_t **argv )
switch( argc )
{
case 1:
{
break;
}
case 2:
{
wchar_t *end;
@ -1921,12 +1924,14 @@ static int builtin_exit( wchar_t **argv )
}
default:
{
sb_printf( sb_err,
BUILTIN_ERR_TOO_MANY_ARGUMENTS,
argv[0] );
builtin_print_help( argv[0], sb_err );
return 1;
}
}
reader_exit( 1, 0 );
@ -1983,9 +1988,11 @@ static int builtin_cd( wchar_t **argv )
argv[0],
dir_in );
if( !is_interactive )
{
sb_append2( sb_err,
parser_current_line(),
(void *)0 );
}
return 1;
}
@ -1997,9 +2004,11 @@ static int builtin_cd( wchar_t **argv )
argv[0],
dir );
if( !is_interactive )
{
sb_append2( sb_err,
parser_current_line(),
(void *)0 );
}
free( dir );
@ -2116,7 +2125,9 @@ static void make_first( job_t *j )
if( curr == j )
{
if( prev == 0 )
{
return;
}
else
{
prev->next = curr->next;
@ -2144,8 +2155,10 @@ static int builtin_fg( wchar_t **argv )
{
if( j->constructed && (!job_is_completed(j)) &&
( (job_is_stopped(j) || !j->fg) && (j->job_control) ) )
{
break;
}
}
if( !j )
{
sb_printf( sb_err,
@ -2307,8 +2320,10 @@ static int builtin_bg( wchar_t **argv )
for( j=first_job; j; j=j->next )
{
if( job_is_stopped(j) && j->job_control && (!job_is_completed(j)) )
{
break;
}
}
if( !j )
{

View file

@ -76,7 +76,7 @@ The fish parser. Contains functions for parsing code.
/**
Error message for short circuit command error.
*/
#define COND_ERR_MSG _( L"Pipe or short circuit command requires additional command")
#define COND_ERR_MSG _( L"An additional command is required" )
/**
Error message on reaching maximum recusrion depth
@ -1232,7 +1232,7 @@ static int printed_width( const wchar_t *str, int len )
{
int res=0;
int i;
for( i=0; i<len; i++ )
for( i=0; str[i] && i<len; i++ )
{
if( str[i] == L'\t' )
{