Change readline hack logic for async dbg msg to be ready for readline 8.3

This commit is contained in:
Philippe Teuwen 2025-07-19 16:52:27 +02:00
commit 12e68d7a28
2 changed files with 6 additions and 11 deletions

View file

@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file.
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
## [unreleased][unreleased] ## [unreleased][unreleased]
- Changed readline hack logic for async dbg msg to be ready for readline 8.3 (@doegox)
- Improved To avoid conflicts with ModemManager on Linux, is recommended to masking the service (@grugnoymeme)
- Changed `data crypto` - now also handles AES-256 (@iceman1001) - Changed `data crypto` - now also handles AES-256 (@iceman1001)
- Changed `hf mfdes info` - add recognition of Swissbit iShield Key Mifare (@ah01) - Changed `hf mfdes info` - add recognition of Swissbit iShield Key Mifare (@ah01)
- Changed `hf mf info` - add detection for unknown backdoor keys and for some backdoor variants (@doegox) - Changed `hf mf info` - add detection for unknown backdoor keys and for some backdoor variants (@doegox)
@ -18,7 +20,6 @@ This project uses the changelog in accordance with [keepchangelog](http://keepac
- Changed `mem load` - now handles UL-C and UL-AES dictionary files (@iceman1001) - Changed `mem load` - now handles UL-C and UL-AES dictionary files (@iceman1001)
- Changed `hf mfu sim` - now support UL-C simulation (@iceman1001) - Changed `hf mfu sim` - now support UL-C simulation (@iceman1001)
- Added `!` - run system commands from inside the client. Potentially dangerous if running client as SUDO, SU, ROOT (@iceman1001) - Added `!` - run system commands from inside the client. Potentially dangerous if running client as SUDO, SU, ROOT (@iceman1001)
- Improved To avoid conflicts with ModemManager on Linux, is recommended to masking the service (@grugnoymeme)
## [Daddy Iceman.4.20469][2025-06-16] ## [Daddy Iceman.4.20469][2025-06-16]
- Fixed edge case in fm11rf08s key recovery tools (@doegox) - Fixed edge case in fm11rf08s key recovery tools (@doegox)

View file

@ -424,18 +424,13 @@ static void fPrintAndLog(FILE *stream, const char *fmt, ...) {
#ifdef RL_STATE_READCMD #ifdef RL_STATE_READCMD
// We are using GNU readline. libedit (OSX) doesn't support this flag. // We are using GNU readline. libedit (OSX) doesn't support this flag.
int need_hack = (rl_readline_state & RL_STATE_READCMD) > 0; int need_hack = (rl_readline_state & RL_STATE_READCMD) > 0;
char *saved_line; char *saved_line = NULL;
int saved_point;
if (need_hack) { if (need_hack) {
saved_point = rl_point;
saved_line = rl_copy_text(0, rl_end); saved_line = rl_copy_text(0, rl_end);
rl_save_prompt(); rl_clear_visible_line();
rl_replace_line("", 0);
rl_redisplay();
} }
#endif #endif
va_start(argptr, fmt); va_start(argptr, fmt);
vsnprintf(buffer, sizeof(buffer), fmt, argptr); vsnprintf(buffer, sizeof(buffer), fmt, argptr);
va_end(argptr); va_end(argptr);
@ -453,14 +448,13 @@ static void fPrintAndLog(FILE *stream, const char *fmt, ...) {
if (linefeed) { if (linefeed) {
fprintf(stream, "\n"); fprintf(stream, "\n");
} }
fflush(stream);
} }
#ifdef RL_STATE_READCMD #ifdef RL_STATE_READCMD
// We are using GNU readline. libedit (OSX) doesn't support this flag.
if (need_hack) { if (need_hack) {
rl_restore_prompt(); rl_on_new_line();
rl_replace_line(saved_line, 0); rl_replace_line(saved_line, 0);
rl_point = saved_point;
rl_redisplay(); rl_redisplay();
free(saved_line); free(saved_line);
} }