This function calls the line editing function linenoiseEdit() using * the STDIN file descriptor set in raw mode. */
| 3810 | /* This function calls the line editing function linenoiseEdit() using |
| 3811 | * the STDIN file descriptor set in raw mode. */ |
| 3812 | static int linenoiseRaw(char* buf, size_t buflen, const char* prompt, const char* continuePrompt, |
| 3813 | const char* selectedContinuePrompt) { |
| 3814 | int count; |
| 3815 | |
| 3816 | if (buflen == 0) { |
| 3817 | errno = EINVAL; |
| 3818 | return -1; |
| 3819 | } |
| 3820 | |
| 3821 | if (enableRawMode(STDIN_FILENO) == -1) |
| 3822 | return -1; |
| 3823 | count = linenoiseEdit(STDIN_FILENO, STDOUT_FILENO, buf, buflen, prompt, continuePrompt, |
| 3824 | selectedContinuePrompt); |
| 3825 | disableRawMode(STDIN_FILENO); |
| 3826 | printf("\n"); |
| 3827 | return count; |
| 3828 | } |
| 3829 | |
| 3830 | /* This function is called when linenoise() is called with the standard |
| 3831 | * input file descriptor not attached to a TTY. So for example when the |
no test coverage detected