remove leftover foreach loop

these are not supported by earlier versions of gnustep
While there, fixed var definitions
pull/8/head
Jean Raby 2013-01-16 15:10:21 -05:00
parent 113bae4638
commit 9897d003be
1 changed files with 12 additions and 10 deletions

View File

@ -77,9 +77,9 @@
- (void) setSanitizedArguments: (NSArray *) newArguments - (void) setSanitizedArguments: (NSArray *) newArguments
{ {
NSString *argsString = [newArguments componentsJoinedByString:@" "]; NSString *argPair, *argsString, *k, *v;
NSDictionary *cliArguments; NSDictionary *cliArguments;
NSArray *keys; NSArray *keys, *wordsWP;
int i; int i;
@ -91,23 +91,25 @@
keys = [cliArguments allKeys]; keys = [cliArguments allKeys];
for (i=0; i < [keys count]; i++) for (i=0; i < [keys count]; i++)
{ {
NSString *k = [keys objectAtIndex: i]; k = [keys objectAtIndex: i];
NSString *v = [cliArguments objectForKey:k]; v = [cliArguments objectForKey:k];
NSString *argPair = [NSString stringWithFormat:@"-%@ %@", k, v]; argPair = [NSString stringWithFormat:@"-%@ %@", k, v];
argsString = [argsString stringByReplacingOccurrencesOfString: argPair argsString = [argsString stringByReplacingOccurrencesOfString: argPair
withString: @""]; withString: @""];
} }
if ([argsString length]) if ([argsString length])
{ {
/* dance to compact whitespace */ /* dance to compact whitespace */
NSArray *wordsWP = [argsString componentsSeparatedByCharactersInSet:
[NSCharacterSet whitespaceCharacterSet]];
NSMutableArray *words = [NSMutableArray array]; NSMutableArray *words = [NSMutableArray array];
for (NSString *word in wordsWP) wordsWP = [argsString componentsSeparatedByCharactersInSet:
[NSCharacterSet whitespaceCharacterSet]];
for (i=0; i < [wordsWP count]; i++)
{ {
if([word length] > 1) v = [wordsWP objectAtIndex: i];
if([v length] > 1)
{ {
[words addObject:word]; [words addObject:v];
} }
} }
argsString = [words componentsJoinedByString:@" "]; argsString = [words componentsJoinedByString:@" "];