Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider libreadline/libedit only in interactive mode #1207

Merged
merged 3 commits into from
Dec 14, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/term.c
Original file line number Diff line number Diff line change
Expand Up @@ -1357,7 +1357,7 @@ void term_gotline(char *cmdstr) {
}


int terminal_mode(PROGRAMMER *pgm, struct avrpart *p) {
int terminal_mode_interactive(PROGRAMMER *pgm, struct avrpart *p) {
term_pgm = pgm; // For callback routine
term_p = p;

Expand All @@ -1379,10 +1379,10 @@ int terminal_mode(PROGRAMMER *pgm, struct avrpart *p) {
return pgm->flush_cache(pgm, p);
}

#else
#endif


int terminal_mode(PROGRAMMER *pgm, struct avrpart *p) {
int terminal_mode_noninteractive(PROGRAMMER *pgm, struct avrpart *p) {
char *cmdbuf;
int rc = 0;

Expand All @@ -1398,7 +1398,13 @@ int terminal_mode(PROGRAMMER *pgm, struct avrpart *p) {
return pgm->flush_cache(pgm, p);
}

int terminal_mode(PROGRAMMER *pgm, struct avrpart *p) {
#if defined(HAVE_LIBREADLINE)
if (isatty(fileno(stdin)))
return terminal_mode_interactive(pgm, p);
#endif
return terminal_mode_noninteractive(pgm, p);
}

static void update_progress_tty(int percent, double etime, const char *hdr, int finish) {
static char *header;
Expand Down