Skip to content
This repository was archived by the owner on Feb 4, 2024. It is now read-only.

Commit 902a761

Browse files
wsakernellarsks
authored andcommitted
add written hex strings to history as well
Signed-off-by: Wolfram Sang <[email protected]>
1 parent 084d055 commit 902a761

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

picocom.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -622,19 +622,19 @@ int
622622
read_hex (unsigned char *buff, int sz)
623623
{
624624
char *hexstr;
625-
int n;
625+
int n = 0;
626626

627627
do {
628628
fd_printf(STO, "\r\n");
629629
hexstr = linenoise("*** hex: ");
630630
fd_printf(STO, "\r");
631-
if ( hexstr == NULL ) {
632-
n = 0;
631+
if ( hexstr == NULL )
633632
break;
634-
}
635633
n = hex2bin(buff, sz, hexstr);
636634
if ( n < 0 )
637635
fd_printf(STO, "*** Invalid hex!");
636+
else if (n > 0)
637+
add_history(hexstr);
638638
free(hexstr);
639639
} while (n < 0);
640640

0 commit comments

Comments
 (0)