aboutsummaryrefslogtreecommitdiffhomepage
path: root/exec.c
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2006-02-15 05:56:36 +1000
committerGravatar axel <axel@liljencrantz.se>2006-02-15 05:56:36 +1000
commit3e165297ce4a2f29117ff957c0e8946e0dd8b3ef (patch)
treed7b3e7ed6470880d093781702c3321b5ae23f8af /exec.c
parent7ac922def63ec365973a447d0b5a40b942e5a502 (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.c27
1 files changed, 4 insertions, 23 deletions
diff --git a/exec.c b/exec.c
index e004d17f..90d930bf 100644
--- a/exec.c
+++ b/exec.c
@@ -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 )