From 65a9dacbfcbc3fb7f9941be158f96f1260436e75 Mon Sep 17 00:00:00 2001 From: John Zaitseff Date: Fri, 22 Jul 2011 12:20:58 +1000 Subject: [PATCH] Change the "--no-encrypt" command line option to "--dont-encrypt" Some versions of getopt_long() show ALL options if an ambiguous abbreviation was supplied (such as "--no"), and we don't really want players to discover this option by accident, do we? :-) --- src/fileio.c | 2 +- src/globals.c | 6 +++--- src/globals.h | 2 +- src/trader.c | 22 +++++++++++----------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/fileio.c b/src/fileio.c index 8226d28..5e13da5 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -320,7 +320,7 @@ bool save_game (int num) err_exit_nomem(); } - crypt_key = option_no_encrypt ? 0 : + crypt_key = option_dont_encrypt ? 0 : game_file_crypt_key[randi(GAME_FILE_CRYPT_KEY_SIZE)]; // Create the data directory, if needed diff --git a/src/globals.c b/src/globals.c index bcf88d9..1d452b7 100644 --- a/src/globals.c +++ b/src/globals.c @@ -85,9 +85,9 @@ int game_num = 0; // Game number (1-9) bool quit_selected = false; // Is a player trying to quit the game? bool abort_game = false; // Abort game without declaring winner? -bool option_no_color = false; // True if --no-color was specified -bool option_no_encrypt = false; // True if --no-encrypt was specified -int option_max_turn = 0; // Max. turns if --max-turn was specified +bool option_no_color = false; // True if --no-color was specified +bool option_dont_encrypt = false; // True if --dont-encrypt was specified +int option_max_turn = 0; // Max. turns if --max-turn was specified /***********************************************************************/ diff --git a/src/globals.h b/src/globals.h index 027ae73..db19be3 100644 --- a/src/globals.h +++ b/src/globals.h @@ -198,7 +198,7 @@ extern bool quit_selected; // Is a player trying to quit the game? extern bool abort_game; // Abort game without declaring winner? extern bool option_no_color; // True if --no-color was specified -extern bool option_no_encrypt; // True if --no-encrypt was specified +extern bool option_dont_encrypt; // True if --dont-encrypt was specified extern int option_max_turn; // Max. turns if --max-turn was specified diff --git a/src/trader.c b/src/trader.c index f318211..3ad3e04 100644 --- a/src/trader.c +++ b/src/trader.c @@ -43,7 +43,7 @@ enum options_char { OPTION_NO_COLOR = 1, - OPTION_NO_ENCRYPT, + OPTION_DONT_ENCRYPT, OPTION_MAX_TURN }; @@ -52,13 +52,13 @@ static const char options_short[] = "hV"; // -V, --version static struct option const options_long[] = { - { "help", no_argument, NULL, 'h' }, - { "version", no_argument, NULL, 'V' }, - { "no-color", no_argument, NULL, OPTION_NO_COLOR }, - { "no-colour", no_argument, NULL, OPTION_NO_COLOR }, - { "no-encrypt", no_argument, NULL, OPTION_NO_ENCRYPT }, - { "max-turn", required_argument, NULL, OPTION_MAX_TURN }, - { NULL, 0, NULL, 0 } + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'V' }, + { "no-color", no_argument, NULL, OPTION_NO_COLOR }, + { "no-colour", no_argument, NULL, OPTION_NO_COLOR }, + { "dont-encrypt", no_argument, NULL, OPTION_DONT_ENCRYPT }, + { "max-turn", required_argument, NULL, OPTION_MAX_TURN }, + { NULL, 0, NULL, 0 } }; @@ -215,9 +215,9 @@ void process_cmdline (int argc, char *argv[]) option_no_color = true; break; - case OPTION_NO_ENCRYPT: - // --no-encrypt: don't encrypt game files - option_no_encrypt = true; + case OPTION_DONT_ENCRYPT: + // --dont-encrypt: don't encrypt game files + option_dont_encrypt = true; break; case OPTION_MAX_TURN: