Compare commits

..

1 Commits

58
otp.c
View File

@@ -132,41 +132,41 @@ int main(int argc, char* argv[]) {
} }
int interactive_mode(void) { int interactive_mode(void) {
// printf("\n\n\n\n=== OTP Cipher %s ===\n\n", get_version()); char input[10];
while (1) { while (1) {
show_main_menu(); show_main_menu();
char input[10];
if (fgets(input, sizeof(input), stdin)) {
char choice = toupper(input[0]);
switch (choice) { if (!fgets(input, sizeof(input), stdin)) {
case 'T': printf("Goodbye!\n");
handle_text_encrypt(); break;
break; }
case 'F':
handle_file_encrypt(); char choice = toupper(input[0]);
break;
case 'D': switch (choice) {
handle_decrypt_menu(); case 'T':
break; handle_text_encrypt();
case 'P': break;
handle_pads_menu(); case 'F':
break; handle_file_encrypt();
case 'X': break;
case 'Q': case 'D':
printf("Goodbye!\n"); handle_decrypt_menu();
return 0; break;
default: case 'P':
printf("Invalid option. Please select T, F, D, P, or X.\n"); handle_pads_menu();
continue; break;
} case 'X':
} else { printf("Goodbye!\n");
printf("Error reading input. Please try again.\n"); return 0;
continue; default:
printf("Invalid choice. Please try again.\n");
break;
} }
printf("\n");
} }
return 0;
} }
int command_line_mode(int argc, char* argv[]) { int command_line_mode(int argc, char* argv[]) {