Permalink
Browse files

As a convenience, the system operator concatenates its arguments

  • Loading branch information...
timburks committed Jun 10, 2012
1 parent 8226890 commit 806d8f6621d1a74af7eff541fea869eb0fda491a
Showing with 6 additions and 1 deletion.
  1. +6 −1 objc/Nu.m
View
@@ -8676,7 +8676,12 @@ @interface Nu_system_operator : NuOperator {}
@implementation Nu_system_operator
- (id) callWithArguments:(id)cdr context:(NSMutableDictionary *)context
{
- id command = [[cdr car] evalWithContext:context];
+ id cursor = cdr;
+ NSMutableString *command = [NSMutableString string];
+ while (cursor && (cursor != [NSNull null])) {
+ [command appendString:[[[cursor car] evalWithContext:context] stringValue]];
+ cursor = [cursor cdr];
+ }
const char *commandString = [[command stringValue] cStringUsingEncoding:NSUTF8StringEncoding];
int result = system(commandString) >> 8; // this needs an explanation
return [NSNumber numberWithInt:result];

0 comments on commit 806d8f6

Please sign in to comment.