mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Print correct 'Done' timestamp for X- and Y-modem transfers
Closes: #268 Call tio_printf() after completing xymodem_send(). Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
This commit is contained in:
parent
0a95da00f1
commit
68a64ac554
2 changed files with 25 additions and 9 deletions
10
src/script.c
10
src/script.c
|
|
@ -149,6 +149,7 @@ static int modem_send(lua_State *L)
|
||||||
{
|
{
|
||||||
const char *file = lua_tostring(L, 1);
|
const char *file = lua_tostring(L, 1);
|
||||||
int protocol = lua_tointeger(L, 2);
|
int protocol = lua_tointeger(L, 2);
|
||||||
|
int ret;
|
||||||
|
|
||||||
if (file == NULL)
|
if (file == NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -159,17 +160,20 @@ static int modem_send(lua_State *L)
|
||||||
{
|
{
|
||||||
case XMODEM_1K:
|
case XMODEM_1K:
|
||||||
tio_printf("Sending file '%s' using XMODEM-1K", file);
|
tio_printf("Sending file '%s' using XMODEM-1K", file);
|
||||||
tio_printf("%s", xymodem_send(device_fd, file, XMODEM_1K) < 0 ? "Aborted" : "Done");
|
ret = xymodem_send(device_fd, file, XMODEM_1K);
|
||||||
|
tio_printf("%s", ret < 0 ? "Aborted" : "Done");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XMODEM_CRC:
|
case XMODEM_CRC:
|
||||||
tio_printf("Sending file '%s' using XMODEM-CRC", file);
|
tio_printf("Sending file '%s' using XMODEM-CRC", file);
|
||||||
tio_printf("%s", xymodem_send(device_fd, file, XMODEM_CRC) < 0 ? "Aborted" : "Done");
|
ret = xymodem_send(device_fd, file, XMODEM_CRC);
|
||||||
|
tio_printf("%s", ret < 0 ? "Aborted" : "Done");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case YMODEM:
|
case YMODEM:
|
||||||
tio_printf("Sending file '%s' using YMODEM", file);
|
tio_printf("Sending file '%s' using YMODEM", file);
|
||||||
tio_printf("%s", xymodem_send(device_fd, file, YMODEM) < 0 ? "Aborted" : "Done");
|
ret = xymodem_send(device_fd, file, YMODEM);
|
||||||
|
tio_printf("%s", ret < 0 ? "Aborted" : "Done");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
20
src/tty.c
20
src/tty.c
|
|
@ -712,9 +712,12 @@ void handle_command_sequence(char input_char, char *output_char, bool *forward)
|
||||||
tio_printf_raw("Enter file name: ");
|
tio_printf_raw("Enter file name: ");
|
||||||
if (tio_readln())
|
if (tio_readln())
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
tio_printf("Sending file '%s' ", line);
|
tio_printf("Sending file '%s' ", line);
|
||||||
tio_printf("Press any key to abort transfer");
|
tio_printf("Press any key to abort transfer");
|
||||||
tio_printf("%s", xymodem_send(device_fd, line, XMODEM_1K) < 0 ? "Aborted" : "Done");
|
ret = xymodem_send(device_fd, line, XMODEM_1K);
|
||||||
|
tio_printf("%s", ret < 0 ? "Aborted" : "Done");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -723,9 +726,12 @@ void handle_command_sequence(char input_char, char *output_char, bool *forward)
|
||||||
tio_printf_raw("Enter file name: ");
|
tio_printf_raw("Enter file name: ");
|
||||||
if (tio_readln())
|
if (tio_readln())
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
tio_printf("Sending file '%s' ", line);
|
tio_printf("Sending file '%s' ", line);
|
||||||
tio_printf("Press any key to abort transfer");
|
tio_printf("Press any key to abort transfer");
|
||||||
tio_printf("%s", xymodem_send(device_fd, line, XMODEM_CRC) < 0 ? "Aborted" : "Done");
|
ret = xymodem_send(device_fd, line, XMODEM_CRC);
|
||||||
|
tio_printf("%s", ret < 0 ? "Aborted" : "Done");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -734,9 +740,12 @@ void handle_command_sequence(char input_char, char *output_char, bool *forward)
|
||||||
tio_printf_raw("Enter file name: ");
|
tio_printf_raw("Enter file name: ");
|
||||||
if (tio_readln())
|
if (tio_readln())
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
tio_printf("Ready to receiving file '%s' ", line);
|
tio_printf("Ready to receiving file '%s' ", line);
|
||||||
tio_printf("Press any key to abort transfer");
|
tio_printf("Press any key to abort transfer");
|
||||||
tio_printf("%s", xymodem_receive(device_fd, line, XMODEM_CRC) < 0 ? "Aborted" : "Done");
|
ret = xymodem_send(device_fd, line, XMODEM_CRC);
|
||||||
|
tio_printf("%s", ret < 0 ? "Aborted" : "Done");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -1094,9 +1103,12 @@ void handle_command_sequence(char input_char, char *output_char, bool *forward)
|
||||||
tio_printf("Send file with YMODEM");
|
tio_printf("Send file with YMODEM");
|
||||||
tio_printf_raw("Enter file name: ");
|
tio_printf_raw("Enter file name: ");
|
||||||
if (tio_readln()) {
|
if (tio_readln()) {
|
||||||
|
int ret;
|
||||||
|
|
||||||
tio_printf("Sending file '%s' ", line);
|
tio_printf("Sending file '%s' ", line);
|
||||||
tio_printf("Press any key to abort transfer");
|
tio_printf("Press any key to abort transfer");
|
||||||
tio_printf("%s", xymodem_send(device_fd, line, YMODEM) < 0 ? "Aborted" : "Done");
|
ret = xymodem_send(device_fd, line, YMODEM);
|
||||||
|
tio_printf("%s", ret < 0 ? "Aborted" : "Done");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue