diff options
author | 2006-02-15 05:56:36 +1000 | |
---|---|---|
committer | 2006-02-15 05:56:36 +1000 | |
commit | 3e165297ce4a2f29117ff957c0e8946e0dd8b3ef (patch) | |
tree | d7b3e7ed6470880d093781702c3321b5ae23f8af /exec.c | |
parent | 7ac922def63ec365973a447d0b5a40b942e5a502 (diff) |
Add support for sending arguments whenusing the source builtin
darcs-hash:20060214195636-ac50b-511c211368103df6923d63cef99ce20a88d31be3.gz
Diffstat (limited to 'exec.c')
-rw-r--r-- | exec.c | 27 |
1 files changed, 4 insertions, 23 deletions
@@ -39,6 +39,7 @@ #include "translate.h" #include "halloc.h" #include "halloc_util.h" +#include "parse_util.h" /** Prototype for the getpgid library function. The prototype for this @@ -789,9 +790,6 @@ void exec( job_t *j ) { case INTERNAL_FUNCTION: { - wchar_t **arg; - int i; - string_buffer_t sb; wchar_t * def = halloc_register( j, wcsdup( function_get_definition( p->argv[0] ))); //fwprintf( stderr, L"run function %ls\n", argv[0] ); @@ -805,26 +803,9 @@ void exec( job_t *j ) current_block->param2.function_call_process = p; current_block->param1.function_name = halloc_register( current_block, wcsdup( p->argv[0] ) ); - - if( builtin_count_args(p->argv)>1 ) - { - sb_init( &sb ); - - for( i=1, arg=p->argv+1; *arg; i++, arg++ ) - { - if( i != 1 ) - sb_append( &sb, ARRAY_SEP_STR ); - sb_append( &sb, *arg ); - } - - env_set( L"argv", (wchar_t *)sb.buff, ENV_LOCAL ); - sb_destroy( &sb ); - } - else - { - env_set( L"argv", 0, ENV_LOCAL ); - } - + + parse_util_set_argv( p->argv+1 ); + parser_forbid_function( p->argv[0] ); if( p->next ) |