=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cu/cu.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- src/usr.bin/cu/cu.c 2015/01/16 06:40:06 1.20 +++ src/usr.bin/cu/cu.c 2015/02/08 17:33:35 1.21 @@ -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 @@ -65,8 +65,9 @@ __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 @@ 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); + } } }