summaryrefslogtreecommitdiff
path: root/redis-check-aof.c
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2010-05-05 14:02:04 +0200
committerPieter Noordhuis <pcnoordhuis@gmail.com>2010-05-05 14:02:04 +0200
commit57ca68acc16cedb39409ce5e513f9c2dd6f29182 (patch)
tree05c8dfdd167afef5e44457612ff3383f9d43826b /redis-check-aof.c
parente795c7588875c47908c06a5fac0f869e23854218 (diff)
downloadredis-57ca68acc16cedb39409ce5e513f9c2dd6f29182.tar.gz
moved argument parsing around
Diffstat (limited to 'redis-check-aof.c')
-rw-r--r--redis-check-aof.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/redis-check-aof.c b/redis-check-aof.c
index 31abe1be9..534720321 100644
--- a/redis-check-aof.c
+++ b/redis-check-aof.c
@@ -125,25 +125,23 @@ long process(FILE *fp) {
}
int main(int argc, char **argv) {
- /* expect the first argument to be the dump file */
- if (argc <= 1) {
- printf("Usage: %s [--fix] <file.aof>\n", argv[0]);
- exit(0);
- }
-
char *filename;
int fix = 0;
- if (argc == 3) {
+
+ if (argc < 2) {
+ printf("Usage: %s [--fix] <file.aof>\n", argv[0]);
+ exit(1);
+ } else if (argc == 2) {
+ filename = argv[1];
+ } else if (argc == 3) {
if (strcmp(argv[1],"--fix") != 0) {
printf("Invalid argument: %s\n", argv[1]);
exit(1);
}
- fix = 1;
filename = argv[2];
- } else if (argc == 2) {
- filename = argv[1];
+ fix = 1;
} else {
- printf("Invalid argument");
+ printf("Invalid arguments\n");
exit(1);
}