mirror of
https://github.com/eosswedenorg/antelope-keygen
synced 2026-07-02 11:43:40 +02:00
src/main.cpp: in main() reduce indentation by handling no argument case first and return.
This commit is contained in:
parent
152015d959
commit
368f93a26c
1 changed files with 53 additions and 53 deletions
18
src/main.cpp
18
src/main.cpp
|
|
@ -111,10 +111,15 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
// current position in argv
|
// current position in argv
|
||||||
// when parsing command line.
|
// when parsing command line.
|
||||||
int p = 0;
|
int p = 1;
|
||||||
|
|
||||||
if (argc > 1) {
|
// No args, just print a key.
|
||||||
p = 1;
|
if (argc <= 1) {
|
||||||
|
struct ec_keypair pair;
|
||||||
|
ec_generate_key(&pair);
|
||||||
|
wif_print_key(&pair);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!strcmp(argv[p], "-h") || !strcmp(argv[p], "--help")) {
|
if (!strcmp(argv[p], "-h") || !strcmp(argv[p], "--help")) {
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
|
|
@ -125,9 +130,9 @@ int main(int argc, char **argv) {
|
||||||
bool parse_opt;
|
bool parse_opt;
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
parse_opt = false;
|
parse_opt = false;
|
||||||
|
|
||||||
if (p < argc && !strcmp(argv[p], "--l33t")) {
|
if (p < argc && !strcmp(argv[p], "--l33t")) {
|
||||||
option_l33t = true;
|
option_l33t = true;
|
||||||
parse_opt = true;
|
parse_opt = true;
|
||||||
|
|
@ -164,11 +169,6 @@ int main(int argc, char **argv) {
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
struct ec_keypair pair;
|
|
||||||
ec_generate_key(&pair);
|
|
||||||
wif_print_key(&pair);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue