aboutsummaryrefslogtreecommitdiffhomepage
path: root/builtin_commandline.c
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2006-10-10 00:16:08 +1000
committerGravatar axel <axel@liljencrantz.se>2006-10-10 00:16:08 +1000
commit80ac4ddc2b5a3c11ddd499aaeb5cebdb7c070483 (patch)
tree553ab3bac9bef35f520cf33aa801821438c30c79 /builtin_commandline.c
parent9a0f712e29f8412303da0b3249315d32ffacf304 (diff)
Allow more than one argument to the commandline builtin. The arguments will be joined together using newlines
darcs-hash:20061009141608-ac50b-546c0f5897670bb7e628d6e7c63d687eac261ee1.gz
Diffstat (limited to 'builtin_commandline.c')
-rw-r--r--builtin_commandline.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/builtin_commandline.c b/builtin_commandline.c
index b9e1fc07..4aaadb05 100644
--- a/builtin_commandline.c
+++ b/builtin_commandline.c
@@ -430,7 +430,7 @@ static int builtin_commandline( wchar_t **argv )
/*
Check for invalid switch combinations
*/
- if( argc-woptind > 1 )
+ if( cursor_mode && (argc-woptind > 1) )
{
sb_append2( sb_err,
@@ -570,7 +570,28 @@ static int builtin_commandline( wchar_t **argv )
case 1:
{
replace_part( begin, end, argv[woptind], append_mode );
- break;
+ break;
+ }
+
+ default:
+ {
+ string_buffer_t sb;
+ int i;
+
+ sb_init( &sb );
+
+ sb_append( &sb, argv[woptind] );
+
+ for( i=woptind+1; i<argc; i++ )
+ {
+ sb_append( &sb, L"\n" );
+ sb_append( &sb, argv[i] );
+ }
+
+ replace_part( begin, end, (wchar_t *)sb.buff, append_mode );
+ sb_destroy( &sb );
+
+ break;
}
}