summaryrefslogtreecommitdiffstats
path: root/usr.bin/cu/command.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2012-07-10 11:42:02 +0000
committernicm <nicm@openbsd.org>2012-07-10 11:42:02 +0000
commit649fc061cc60aa878769690ea61e940a6fea0e01 (patch)
tree7b1e4e556b543c37ec64e5dacf3da42d28c69223 /usr.bin/cu/command.c
parentfull support for -static -shared -prefer-pic -prefer-non-pic -fpie* (diff)
downloadwireguard-openbsd-649fc061cc60aa878769690ea61e940a6fea0e01.tar.xz
wireguard-openbsd-649fc061cc60aa878769690ea61e940a6fea0e01.zip
Add builtin XMODEM send support with ~X, only tested with lrz -X so far.
Diffstat (limited to 'usr.bin/cu/command.c')
-rw-r--r--usr.bin/cu/command.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/usr.bin/cu/command.c b/usr.bin/cu/command.c
index a6e168dfce9..91d1c7cce00 100644
--- a/usr.bin/cu/command.c
+++ b/usr.bin/cu/command.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: command.c,v 1.7 2012/07/10 10:56:12 nicm Exp $ */
+/* $OpenBSD: command.c,v 1.8 2012/07/10 11:42:02 nicm Exp $ */
/*
* Copyright (c) 2012 Nicholas Marriott <nicm@openbsd.org>
@@ -35,6 +35,7 @@
void pipe_command(void);
void connect_command(void);
void send_file(void);
+void send_xmodem(void);
void
pipe_command(void)
@@ -159,6 +160,21 @@ send_file(void)
}
void
+send_xmodem(void)
+{
+ const char *file;
+ char *expanded;
+
+ file = get_input("Local file?");
+ if (file == NULL || *file == '\0')
+ return;
+
+ expanded = tilde_expand(file);
+ xmodem_send(expanded);
+ free(expanded);
+}
+
+void
set_speed(void)
{
const char *s, *errstr;
@@ -197,6 +213,9 @@ do_command(char c)
case 'S':
set_speed();
break;
+ case 'X':
+ send_xmodem();
+ break;
case '$':
pipe_command();
break;