Increase line buffer size

Just to make sure we accept very long filenames.
This commit is contained in:
Martin Lund 2023-09-16 12:25:35 +02:00
parent c9c5f03c10
commit 07864a0e78

View file

@ -157,6 +157,7 @@ static char *tty_buffer_write_ptr = tty_buffer;
static pthread_t thread; static pthread_t thread;
static int pipefd[2]; static int pipefd[2];
static pthread_mutex_t mutex_input_ready = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t mutex_input_ready = PTHREAD_MUTEX_INITIALIZER;
static char line[BUFSIZ];
static void optional_local_echo(char c) static void optional_local_echo(char c)
{ {
@ -484,18 +485,19 @@ static void toggle_line(const char *line_name, int mask, enum line_mode_t line_m
} }
} }
#define MAX_LINE 100
static char line[MAX_LINE];
static int tio_readln(void) static int tio_readln(void)
{ {
char *p = line; char *p = line;
/* Read line, accept BS and DEL as rubout characters */ /* Read line, accept BS and DEL as rubout characters */
for (p = line ; p < &line[MAX_LINE-1]; ) { for (p = line ; p < &line[BUFSIZ-1]; )
if (read(pipefd[0], p, 1) > 0) { {
if (*p == 0x08 || *p == 0x7f) { if (read(pipefd[0], p, 1) > 0)
if (p > line ) { {
if (*p == 0x08 || *p == 0x7f)
{
if (p > line )
{
write(STDOUT_FILENO, "\b \b", 3); write(STDOUT_FILENO, "\b \b", 3);
p--; p--;
} }