diff options
author | Oskar <[email protected]> | 2024-04-19 23:32:15 +0200 |
---|---|---|
committer | Oskar <[email protected]> | 2024-04-19 23:32:15 +0200 |
commit | e0e28a119e7a0f83ef9382413dba603ae342a8fb (patch) | |
tree | 1a0a7a60cee9efbbd38ed0fc63cbd057592cf24c /functions.c | |
parent | 73b0414254e6b888656b4e5346292f27b67ac9d9 (diff) |
adding modes to choice
Diffstat (limited to 'functions.c')
-rw-r--r-- | functions.c | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/functions.c b/functions.c index 84cf0cb..5b434bc 100644 --- a/functions.c +++ b/functions.c @@ -6,28 +6,39 @@ #include <string.h> #include <stdint.h> -int choice() { +int choice(uint8_t mode) { + char choice; - do { + if (mode == MODE_NORMAL) { + do { + + fputs("[Y / N] ? ", stdout); - fputs("[Y / N] ? ", stdout); + choice = getchar(); + if (choice == '\n') { continue; } - choice = getchar(); - if (choice == '\n') { continue; } + while ('\n' != getchar()); - while ('\n' != getchar()); + } while ( (choice != 'Y') && (choice != 'y') && (choice != 'N') && (choice != 'n') ); - } while ( (choice != 'Y') && (choice != 'y') && (choice != 'N') && (choice != 'n') ); + if ( (choice == 'Y') || (choice == 'y') ) + { + return 0; + } - if ( (choice == 'Y') || (choice == 'y') ) - { - return 0; + if ((choice == 'N') || (choice == 'n') ) + { + return 1; + } } - if ((choice == 'N') || (choice == 'n') ) - { - return 1; + if (mode == MODE_YES) { + + } + + if (mode == MODE_NO) { + } return EXIT_FAILURE; |