summaryrefslogtreecommitdiff
path: root/usr.bin/cu
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/cu')
-rw-r--r--usr.bin/cu/cu.15
-rw-r--r--usr.bin/cu/cu.c35
2 files changed, 23 insertions, 17 deletions
diff --git a/usr.bin/cu/cu.1 b/usr.bin/cu/cu.1
index 035e3793cf7..057490effea 100644
--- a/usr.bin/cu/cu.1
+++ b/usr.bin/cu/cu.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: cu.1,v 1.11 2014/03/31 09:09:19 nicm Exp $
+.\" $OpenBSD: cu.1,v 1.12 2015/02/08 17:33:35 nicm Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" @(#)tip.1 8.4 (Berkeley) 4/18/94
.\"
-.Dd $Mdocdate: March 31 2014 $
+.Dd $Mdocdate: February 8 2015 $
.Dt CU 1
.Os
.Sh NAME
@@ -39,6 +39,7 @@
.Nm
.Op Fl l Ar line
.Op Fl s Ar speed \*(Ba Fl Ar speed
+.Nm
.Op Ar host
.Sh DESCRIPTION
.Nm
diff --git a/usr.bin/cu/cu.c b/usr.bin/cu/cu.c
index 99a9b057430..52e2f94f357 100644
--- a/usr.bin/cu/cu.c
+++ b/usr.bin/cu/cu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cu.c,v 1.20 2015/01/16 06:40:06 deraadt Exp $ */
+/* $OpenBSD: cu.c,v 1.21 2015/02/08 17:33:35 nicm Exp $ */
/*
* Copyright (c) 2012 Nicholas Marriott <nicm@openbsd.org>
@@ -65,8 +65,9 @@ void try_remote(const char *, const char *, const char *);
__dead void
usage(void)
{
- fprintf(stderr, "usage: %s [-l line] [-s speed | -speed] [host]\n",
+ fprintf(stderr, "usage: %s [-l line] [-s speed | -speed]\n",
__progname);
+ fprintf(stderr, " %s [host]\n", __progname);
exit(1);
}
@@ -113,20 +114,24 @@ main(int argc, char **argv)
if (argc != 0 && argc != 1)
usage();
- if (argc == 1)
- host = argv[0];
- else
- host = getenv("HOST");
- if (host != NULL && *host != '\0') {
- if (*host == '/') {
- if (line_path == NULL)
+ if (line_path != NULL || line_speed != -1) {
+ if (argc != 0)
+ usage();
+ } else {
+ if (argc == 1)
+ host = argv[0];
+ else
+ host = getenv("HOST");
+ if (host != NULL && *host != '\0') {
+ if (*host == '/')
line_path = host;
- } else {
- s = getenv("REMOTE");
- if (s != NULL && *s == '/')
- try_remote(host, s, NULL);
- else
- try_remote(host, NULL, s);
+ else {
+ s = getenv("REMOTE");
+ if (s != NULL && *s == '/')
+ try_remote(host, s, NULL);
+ else
+ try_remote(host, NULL, s);
+ }
}
}