mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-10 23:24:39 +00:00
Fix incorrect usage of the term subshell when command substitution was meant
darcs-hash:20060822143831-ac50b-cb5267a6434adcbd5bafb452d688bee06c23d4d6.gz
This commit is contained in:
parent
480a29594e
commit
303473f20c
6 changed files with 28 additions and 28 deletions
|
@ -1081,7 +1081,7 @@ static void copy_strings_with_prefix( array_list_t *comp_out,
|
|||
wchar_t *wc, *tmp;
|
||||
|
||||
tmp = expand_one( 0,
|
||||
wcsdup(wc_escaped), EXPAND_SKIP_SUBSHELL | EXPAND_SKIP_WILDCARDS);
|
||||
wcsdup(wc_escaped), EXPAND_SKIP_CMDSUBST | EXPAND_SKIP_WILDCARDS);
|
||||
if(!tmp)
|
||||
return;
|
||||
|
||||
|
@ -1786,14 +1786,14 @@ static void complete_param_expand( wchar_t *str,
|
|||
}
|
||||
/*
|
||||
debug( 3,
|
||||
L"expand_string( \"%ls\", comp_out, EXPAND_SKIP_SUBSHELL | ACCEPT_INCOMPLETE | %ls );",
|
||||
L"expand_string( \"%ls\", comp_out, EXPAND_SKIP_CMDSUBST | ACCEPT_INCOMPLETE | %ls );",
|
||||
comp_str,
|
||||
do_file?L"0":L"EXPAND_SKIP_WILDCARDS" );
|
||||
*/
|
||||
expand_string( 0,
|
||||
wcsdup(comp_str),
|
||||
comp_out,
|
||||
EXPAND_SKIP_SUBSHELL | ACCEPT_INCOMPLETE | (do_file?0:EXPAND_SKIP_WILDCARDS) );
|
||||
EXPAND_SKIP_CMDSUBST | ACCEPT_INCOMPLETE | (do_file?0:EXPAND_SKIP_WILDCARDS) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
16
expand.c
16
expand.c
|
@ -1184,9 +1184,9 @@ static int expand_brackets( wchar_t *in, int flags, array_list_t *out )
|
|||
}
|
||||
|
||||
/**
|
||||
Perform subshell expansion
|
||||
Perform cmdsubst expansion
|
||||
*/
|
||||
static int expand_subshell( wchar_t *in, array_list_t *out )
|
||||
static int expand_cmdsubst( wchar_t *in, array_list_t *out )
|
||||
{
|
||||
wchar_t *paran_begin=0, *paran_end=0;
|
||||
int len1, len2;
|
||||
|
@ -1241,7 +1241,7 @@ static int expand_subshell( wchar_t *in, array_list_t *out )
|
|||
}
|
||||
|
||||
al_init( &tail_expand );
|
||||
expand_subshell( wcsdup(paran_end+1), &tail_expand );
|
||||
expand_cmdsubst( wcsdup(paran_end+1), &tail_expand );
|
||||
|
||||
for( i=0; i<al_get_count( &sub_res ); i++ )
|
||||
{
|
||||
|
@ -1434,7 +1434,7 @@ int expand_string( void *context,
|
|||
array_list_t *in, *out;
|
||||
|
||||
int i;
|
||||
int subshell_ok = 1;
|
||||
int cmdsubst_ok = 1;
|
||||
int res = EXPAND_OK;
|
||||
int start_count = al_get_count( end_out );
|
||||
|
||||
|
@ -1451,7 +1451,7 @@ int expand_string( void *context,
|
|||
al_init( &list1 );
|
||||
al_init( &list2 );
|
||||
|
||||
if( EXPAND_SKIP_SUBSHELL & flags )
|
||||
if( EXPAND_SKIP_CMDSUBST & flags )
|
||||
{
|
||||
wchar_t *begin, *end;
|
||||
|
||||
|
@ -1460,7 +1460,7 @@ int expand_string( void *context,
|
|||
&end,
|
||||
1 ) != 0 )
|
||||
{
|
||||
error( SUBSHELL_ERROR, -1, L"Subshells not allowed" );
|
||||
error( CMDSUBST_ERROR, -1, L"Command substitutions not allowed" );
|
||||
free( str );
|
||||
al_destroy( &list1 );
|
||||
al_destroy( &list2 );
|
||||
|
@ -1470,10 +1470,10 @@ int expand_string( void *context,
|
|||
}
|
||||
else
|
||||
{
|
||||
subshell_ok = expand_subshell( str, &list1 );
|
||||
cmdsubst_ok = expand_cmdsubst( str, &list1 );
|
||||
}
|
||||
|
||||
if( !subshell_ok )
|
||||
if( !cmdsubst_ok )
|
||||
{
|
||||
al_destroy( &list1 );
|
||||
return EXPAND_ERROR;
|
||||
|
|
10
expand.h
10
expand.h
|
@ -20,9 +20,9 @@
|
|||
#include "util.h"
|
||||
|
||||
/**
|
||||
Flag specifying that subshell expansion should be skipped
|
||||
Flag specifying that cmdsubst expansion should be skipped
|
||||
*/
|
||||
#define EXPAND_SKIP_SUBSHELL 1
|
||||
#define EXPAND_SKIP_CMDSUBST 1
|
||||
|
||||
/**
|
||||
Flag specifying that variable expansion should be skipped
|
||||
|
@ -122,7 +122,7 @@ enum
|
|||
Perform various forms of expansion on in, such as tilde expansion
|
||||
(\~USER becomes the users home directory), variable expansion
|
||||
(\$VAR_NAME becomes the value of the environment variable VAR_NAME),
|
||||
subshell expansion and wildcard expansion. The results are inserted
|
||||
cmdsubst expansion and wildcard expansion. The results are inserted
|
||||
into the list out.
|
||||
|
||||
If the parameter does not need expansion, it is copied into the list
|
||||
|
@ -135,7 +135,7 @@ enum
|
|||
|
||||
\param context the halloc context to use for automatic deallocation
|
||||
\param in The parameter to expand
|
||||
\param flag Specifies if any expansion pass should be skipped. Legal values are any combination of EXPAND_SKIP_SUBSHELL EXPAND_SKIP_VARIABLES and EXPAND_SKIP_WILDCARDS
|
||||
\param flag Specifies if any expansion pass should be skipped. Legal values are any combination of EXPAND_SKIP_CMDSUBST EXPAND_SKIP_VARIABLES and EXPAND_SKIP_WILDCARDS
|
||||
\param out The list to which the result will be appended.
|
||||
\return One of EXPAND_OK, EXPAND_ERROR, EXPAND_WILDCARD_MATCH and EXPAND_WILDCARD_NO_MATCH. EXPAND_WILDCARD_NO_MATCH and EXPAND_WILDCARD_MATCH are normal exit conditions used only on strings containing wildcards to tell if the wildcard produced any matches.
|
||||
*/
|
||||
|
@ -151,7 +151,7 @@ int expand_string( void *context, wchar_t *in, array_list_t *out, int flag );
|
|||
|
||||
\param context the halloc context to use for automatic deallocation
|
||||
\param in The parameter to expand
|
||||
\param flag Specifies if any expansion pass should be skipped. Legal values are any combination of EXPAND_SKIP_SUBSHELL EXPAND_SKIP_VARIABLES and EXPAND_SKIP_WILDCARDS
|
||||
\param flag Specifies if any expansion pass should be skipped. Legal values are any combination of EXPAND_SKIP_CMDSUBST EXPAND_SKIP_VARIABLES and EXPAND_SKIP_WILDCARDS
|
||||
\return The expanded parameter, or 0 on failiure
|
||||
*/
|
||||
wchar_t *expand_one( void *context, wchar_t *in, int flag );
|
||||
|
|
10
highlight.c
10
highlight.c
|
@ -586,7 +586,7 @@ void highlight_shell( wchar_t * buff,
|
|||
{
|
||||
wchar_t *dir = expand_one( context,
|
||||
wcsdup(tok_last( &tok )),
|
||||
EXPAND_SKIP_SUBSHELL );
|
||||
EXPAND_SKIP_CMDSUBST );
|
||||
if( dir )
|
||||
{
|
||||
if( !parser_cdpath_get( context, dir ) )
|
||||
|
@ -612,7 +612,7 @@ void highlight_shell( wchar_t * buff,
|
|||
*/
|
||||
cmd = expand_one( context,
|
||||
wcsdup(tok_last( &tok )),
|
||||
EXPAND_SKIP_SUBSHELL | EXPAND_SKIP_VARIABLES);
|
||||
EXPAND_SKIP_CMDSUBST | EXPAND_SKIP_VARIABLES);
|
||||
|
||||
if( cmd == 0 )
|
||||
{
|
||||
|
@ -729,9 +729,9 @@ void highlight_shell( wchar_t * buff,
|
|||
{
|
||||
case TOK_STRING:
|
||||
{
|
||||
target = expand_one( context, wcsdup( tok_last( &tok ) ), EXPAND_SKIP_SUBSHELL);
|
||||
target = expand_one( context, wcsdup( tok_last( &tok ) ), EXPAND_SKIP_CMDSUBST);
|
||||
/*
|
||||
Redirect filename may contain a subshell.
|
||||
Redirect filename may contain a cmdsubst.
|
||||
If so, it will be ignored/not flagged.
|
||||
*/
|
||||
}
|
||||
|
@ -832,7 +832,7 @@ void highlight_shell( wchar_t * buff,
|
|||
tok_destroy( &tok );
|
||||
|
||||
/*
|
||||
Locate and syntax highlight subshells recursively
|
||||
Locate and syntax highlight cmdsubsts recursively
|
||||
*/
|
||||
|
||||
wchar_t *buffcpy = halloc_wcsdup( context, buff );
|
||||
|
|
8
parser.c
8
parser.c
|
@ -1863,7 +1863,7 @@ static int parse_job( process_t *p,
|
|||
{
|
||||
nxt = expand_one( j,
|
||||
wcsdup(tok_last( tok )),
|
||||
EXPAND_SKIP_SUBSHELL | EXPAND_SKIP_VARIABLES);
|
||||
EXPAND_SKIP_CMDSUBST | EXPAND_SKIP_VARIABLES);
|
||||
|
||||
if( nxt == 0 )
|
||||
{
|
||||
|
@ -2747,7 +2747,7 @@ static int parser_get_block_type( const wchar_t *cmd )
|
|||
}
|
||||
|
||||
/**
|
||||
\return the block type created by the specified builtin, or -1 on error.
|
||||
\return the block command that createa the specified block type, or null on error.
|
||||
*/
|
||||
static const wchar_t *parser_get_block_command( int type )
|
||||
{
|
||||
|
@ -2800,7 +2800,7 @@ static int parser_test_argument( const wchar_t *arg, string_buffer_t *out, const
|
|||
}
|
||||
free( arg_cpy );
|
||||
return 1;
|
||||
|
||||
|
||||
case 0:
|
||||
do_loop = 0;
|
||||
break;
|
||||
|
@ -3034,7 +3034,7 @@ int parser_test( const wchar_t * buff,
|
|||
|
||||
if( !(cmd = expand_one( context,
|
||||
wcsdup( tok_last( &tok ) ),
|
||||
EXPAND_SKIP_SUBSHELL | EXPAND_SKIP_VARIABLES ) ) )
|
||||
EXPAND_SKIP_CMDSUBST | EXPAND_SKIP_VARIABLES ) ) )
|
||||
{
|
||||
err=1;
|
||||
if( out )
|
||||
|
|
6
parser.h
6
parser.h
|
@ -179,9 +179,9 @@ enum parser_error
|
|||
*/
|
||||
EVAL_ERROR,
|
||||
/**
|
||||
Error while evaluating subshell
|
||||
Error while evaluating cmdsubst
|
||||
*/
|
||||
SUBSHELL_ERROR,
|
||||
CMDSUBST_ERROR,
|
||||
}
|
||||
;
|
||||
|
||||
|
@ -217,7 +217,7 @@ wchar_t *parser_get_filename( void *context, const wchar_t *cmd );
|
|||
int eval( const wchar_t *cmd, io_data_t *io, int block_type );
|
||||
|
||||
/**
|
||||
Evaluate line as a list of parameters, i.e. tokenize it and perform parameter expansion and subshell execution on the tokens.
|
||||
Evaluate line as a list of parameters, i.e. tokenize it and perform parameter expansion and cmdsubst execution on the tokens.
|
||||
The output is inserted into output, and should be freed by the caller.
|
||||
|
||||
\param line Line to evaluate
|
||||
|
|
Loading…
Reference in a new issue