summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorAaron Campbell <aaron@cvs.openbsd.org>1999-09-30 21:25:04 +0000
committerAaron Campbell <aaron@cvs.openbsd.org>1999-09-30 21:25:04 +0000
commit9c58cd37763b140cca05bdfd161ba15dcc9b63ec (patch)
tree9b188d1a0fecac190e76dcd6cbc65423f63915e1 /usr.bin
parent9f841e7714f8991e85f99e55257c9b7953e3bb4d (diff)
- Add -q option to shutup the progressmeter; markus friedl
- Describe -q in man page (needs conversion to mdoc still). - Cleanup usage string. - Correct a typo; espie@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/scp.17
-rw-r--r--usr.bin/ssh/scp.c24
2 files changed, 21 insertions, 10 deletions
diff --git a/usr.bin/ssh/scp.1 b/usr.bin/ssh/scp.1
index 16be9b9439f..e3b847b2584 100644
--- a/usr.bin/ssh/scp.1
+++ b/usr.bin/ssh/scp.1
@@ -9,7 +9,7 @@
.\"
.\" Created: Sun May 7 00:14:37 1995 ylo
.\"
-.\" $Id: scp.1,v 1.1 1999/09/26 20:53:37 deraadt Exp $
+.\" $Id: scp.1,v 1.2 1999/09/30 21:25:03 aaron Exp $
.\"
.TH SCP 1 "November 8, 1995" SSH SSH
@@ -20,7 +20,7 @@ scp \- secure copy (remote file copy program)
.LP
.B scp
[\c
-.B \-prvC\c
+.B \-pqrvC\c
]
[\c
.BI \-P "\ port\c
@@ -95,6 +95,9 @@ debugging connection, authentication, and configuration problems.
.B \-B
Selects batch mode (prevents asking for passwords or passphrases).
.TP
+.B \-q
+Disables the progress meter.
+.TP
.B \-C
Compression enable. Passes the -C flag to
.B ssh
diff --git a/usr.bin/ssh/scp.c b/usr.bin/ssh/scp.c
index 13995309e61..dc096fe6d0a 100644
--- a/usr.bin/ssh/scp.c
+++ b/usr.bin/ssh/scp.c
@@ -42,11 +42,11 @@ and ssh has the necessary privileges.)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: scp.c,v 1.5 1999/09/30 05:11:29 deraadt Exp $
+ * $Id: scp.c,v 1.6 1999/09/30 21:25:03 aaron Exp $
*/
#include "includes.h"
-RCSID("$Id: scp.c,v 1.5 1999/09/30 05:11:29 deraadt Exp $");
+RCSID("$Id: scp.c,v 1.6 1999/09/30 21:25:03 aaron Exp $");
#include "ssh.h"
#include "xmalloc.h"
@@ -68,6 +68,9 @@ int verbose = 0;
/* This is set to non-zero if compression is desired. */
int compress = 0;
+/* This is set to zero if the progressmeter is not desired. */
+int showprogress = 1;
+
/* This is set to non-zero if running in batch mode (that is, password
and passphrase queries are not allowed). */
int batchmode = 0;
@@ -226,7 +229,7 @@ main(argc, argv)
extern int optind;
fflag = tflag = 0;
- while ((ch = getopt(argc, argv, "dfprtvBCc:i:P:")) != EOF)
+ while ((ch = getopt(argc, argv, "dfprtvBCc:i:P:q")) != EOF)
switch(ch) { /* User-visible flags. */
case 'p':
pflag = 1;
@@ -264,6 +267,9 @@ main(argc, argv)
case 'C':
compress = 1;
break;
+ case 'q':
+ showprogress = 0;
+ break;
case '?':
default:
usage();
@@ -511,7 +517,8 @@ next: (void)close(fd);
totalbytes = stb.st_size;
/* kick-start the progress meter */
- progressmeter(-1);
+ if(showprogress)
+ progressmeter(-1);
/* Keep writing after an error so that we stay sync'd up. */
for (haderr = i = 0; i < stb.st_size; i += bp->cnt) {
@@ -532,7 +539,8 @@ next: (void)close(fd);
statbytes += result;
}
}
- progressmeter(1);
+ if(showprogress)
+ progressmeter(1);
if (close(fd) < 0 && !haderr)
haderr = errno;
@@ -878,7 +886,7 @@ void
usage()
{
(void)fprintf(stderr,
- "usage: scp [-p] f1 f2; or: scp [-pr] f1 ... fn directory\n");
+ "usage: scp [-pqrvC] [-P port] [-c cipher] [-i identity] f1 f2; or:\n scp [options] f1 ... fn directory\n");
exit(1);
}
@@ -941,7 +949,7 @@ run_err(const char *fmt, ...)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: scp.c,v 1.5 1999/09/30 05:11:29 deraadt Exp $
+ * $Id: scp.c,v 1.6 1999/09/30 21:25:03 aaron Exp $
*/
char *
@@ -1101,7 +1109,7 @@ void progressmeter(int flag)
}
timersub(&now, &start, &td);
- elapsed = td.tv_sec + (td.tv_sec / 1000000.0);
+ elapsed = td.tv_sec + (td.tv_usec / 1000000.0);
if (statbytes <= 0 || elapsed <= 0.0 || cursize > totalbytes) {
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),