Skip to content

Commit f509c30

Browse files
committed
Fix import/export
1 parent 0a8acfd commit f509c30

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

Sources/defaults.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#import <Foundation/Foundation.h>
2727

2828
int defaultsWrite(NSArray*, NSString*, CFStringRef, CFStringRef);
29-
void usage();
29+
void usage(void);
3030
CFPropertyListRef parseTypedArg(NSString*, NSString*, bool);
3131
NSObject* parsePropertyList(NSString*);
3232
bool isType(NSString*);

Sources/defaults.m

+10-2
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,11 @@ int main(int argc, char *argv[], char *envp[])
241241
}
242242

243243
if ([args[1] isEqualToString:@"export"]) {
244-
if (args.count == 3) {
244+
if (args.count < 3) {
245+
usage();
246+
return 255;
247+
}
248+
if (args.count < 4) {
245249
NSLog(@"\nNeed a path to write to");
246250
return 1;
247251
}
@@ -278,7 +282,11 @@ int main(int argc, char *argv[], char *envp[])
278282
}
279283

280284
if ([args[1] isEqualToString:@"import"]) {
281-
if (args.count == 3) {
285+
if (args.count < 3) {
286+
usage();
287+
return 255;
288+
}
289+
if (args.count < 4) {
282290
NSLog(@"\nNeed a path to read from");
283291
return 1;
284292
}

0 commit comments

Comments
 (0)