From d1b289ff8e2ef4612b84733a388ad94002b140cd Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Sun, 23 Jul 2023 21:01:43 -0700 Subject: [PATCH] Remove unused code --- src/input.c | 83 ----------------------------------------------------- src/input.h | 4 +-- 2 files changed, 1 insertion(+), 86 deletions(-) diff --git a/src/input.c b/src/input.c index e93a9fe..7a84d6b 100644 --- a/src/input.c +++ b/src/input.c @@ -81,86 +81,3 @@ int input_get(unsigned char** dest, char *prompt) return input_len; } -int input_get_str(char** dest, char *prompt) -{ - int r, i, input_len; - unsigned char *input; - - r = input_get(&input, prompt); - if (r < 0) - { - error_log("Could not get input."); - return -1; - } - - if (r > 0) - { - if (input[r - 1] == '\n') - { - --r; - if (r > 0 && input[r - 1] == '\r') - { - --r; - } - } - } - - if (r == 0) - { - error_log("No input provided."); - return -1; - } - - input_len = r; - - *dest = malloc(input_len + 1); - if (*dest == NULL) - { - error_log("Memory allocation error."); - return -1; - } - - memset(*dest, 0, input_len + 1); - - for (i = 0; i < input_len; ++i) - { - if (isascii(input[i])) - { - (*dest)[i] = input[i]; - } - else - { - error_log("Input contains non-ascii characters."); - return -1; - } - } - - free(input); - - return input_len; -} - -int input_get_from_pipe(unsigned char** dest) -{ - int r; - - if (isatty(STDIN_FILENO)) - { - error_log("Input data from a piped or redirected source is required."); - return -1; - } - - r = input_get(dest, NULL); - if (r < 0) - { - error_log("Could not get input."); - return -1; - } - if (r == 0) - { - error_log("No input provided."); - return -1; - } - - return r; -} \ No newline at end of file diff --git a/src/input.h b/src/input.h index c774ca5..ad6f528 100644 --- a/src/input.h +++ b/src/input.h @@ -9,7 +9,5 @@ #define INPUT_H 1 int input_get(unsigned char** dest, char *prompt); -int input_get_str(char** dest, char *prompt); -int input_get_from_pipe(unsigned char** dest); -#endif \ No newline at end of file +#endif