improved help and reading user input

This commit is contained in:
bePrivate
2023-10-31 11:24:08 +01:00
parent 48c3f7d08c
commit 036e192604
2 changed files with 3 additions and 7 deletions
BIN
View File
Binary file not shown.
+3 -7
View File
@@ -69,7 +69,7 @@ int file_exists(char path[]) {
*/ */
void print_help_and_usage() { void print_help_and_usage() {
fprintf(stdout, fprintf(stdout,
"Help and usage for Wordle:\n" "Help and usage for wordlec:\n"
"\n" "\n"
"Help:\n" "Help:\n"
"--wordlist <path_to_wordlist_file> ........... specify a custom wordlist\n" "--wordlist <path_to_wordlist_file> ........... specify a custom wordlist\n"
@@ -77,12 +77,6 @@ void print_help_and_usage() {
" each new line is separated by '\\n' (Enter/Return)\n" " each new line is separated by '\\n' (Enter/Return)\n"
"--verbose .................................... be verbose (show what the program is doing aka debug info)\n" "--verbose .................................... be verbose (show what the program is doing aka debug info)\n"
"--help ....................................... show this help screen\n" "--help ....................................... show this help screen\n"
"\n"
"Usage:\n"
"\n"
"wordlec ...................................... starts Wordle with the default wordlist\n"
"\n"
"wordlec --wordlist <path_to_wordlist_file> ... starts Wordle with a specified wordlist\n"
); );
} }
@@ -156,8 +150,10 @@ void show() {
prompt the user for their input prompt the user for their input
*/ */
void prompt(char user_input[]) { void prompt(char user_input[]) {
int c;
printf(">> "); printf(">> ");
scanf("%5s", user_input); scanf("%5s", user_input);
while ((c = getchar()) != '\n' && c != EOF);
} }
/* /*