Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
57ca68ac
Commit
57ca68ac
authored
May 05, 2010
by
Pieter Noordhuis
Browse files
moved argument parsing around
parent
e795c758
Changes
1
Hide whitespace changes
Inline
Side-by-side
redis-check-aof.c
View file @
57ca68ac
...
...
@@ -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 argument
s
\n
"
);
exit
(
1
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment