NetBSD Problem Report #683

From gnats  Mon Jan  2 22:16:35 1995
Received: from pain.lcs.mit.edu (pain.lcs.mit.edu [128.52.46.239]) by sun-lamp.cs.berkeley.edu (8.6.9/8.6.9) with ESMTP id WAA19049 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Mon, 2 Jan 1995 22:16:34 -0800
Message-Id: <199501030623.RAA09850@dodo.melb.cpr.itg.telecom.com.au>
Date: Tue, 3 Jan 1995 17:23:07 +1100
From: Luke Mewburn <lukem@dodo.melb.cpr.itg.telecom.com.au>
Reply-To: lukem@dodo.melb.cpr.itg.telecom.com.au
To: gnats-bugs@NetBSD.ORG
Subject: adding `mark' option to ftp
X-Send-Pr-Version: 3.2

>Number:         683
>Category:       bin
>Synopsis:       adding `mark' command to change bytecount between hashmarks
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          change-request
>Submitter-Id:   lm
>Arrival-Date:   Mon Jan 02 22:20:02 +0000 1995
>Closed-Date:    Mon Nov 25 05:13:34 +0000 1996
>Last-Modified:  Mon Nov 25 05:13:49 +0000 1996
>Originator:     Luke Mewburn
>Release:        1.0
>Organization:
	Werj
>Environment:
System: NetBSD dodo 1.0 NetBSD 1.0 (DODO) #7: Fri Dec 16 17:01:27 EST 1994 simonb@dodo:/slab/0/src/sys/arch/i386/compile/DODO i386


>Description:
	Currently the ftp command prints a `#' for each 1K transferred.
	On fast (or slow) links, this is often unsuitable. The ability
	to user-define this setting would be useful.

	It's useful on fast links to set the mark to 10K or even 100K.  On
	slow slip links, maybe 256 or 500 bytes could be a useful setting.

	Also, a couple of minor cleanups to shut up gcc -Wall (before I
	gave up and turned off -Wall.)

>How-To-Repeat:
	run ftp. turn on hash mark printing. transfer a _big_ file (e.g,
	gcc-2.6.3.tar.gz, @ ~6.5MB) and watch your screen fill up with `#'s.

>Fix:
	Apply this patch.
	I've added the `mark' command which allows the user to specify at
	what interval the `#' is printed.  Checks for at least 1 byte/hask
	mark being requested, etc...


diff -cb /data/0/ftp/pub/NetBSD/NetBSD-current/src/usr.bin/ftp/cmds.c ./cmds.c
*** /data/0/ftp/pub/NetBSD/NetBSD-current/src/usr.bin/ftp/cmds.c	Thu Dec 15 22:23:00 1994
--- ./cmds.c	Tue Jan  3 17:02:25 1995
***************
*** 882,889 ****
  	else {
  		printf("Nmap: off\n");
  	}
! 	printf("Hash mark printing: %s; Use of PORT cmds: %s\n",
! 		onoff(hash), onoff(sendport));
  	if (macnum > 0) {
  		printf("Macros:\n");
  		for (i=0; i<macnum; i++) {
--- 882,889 ----
  	else {
  		printf("Nmap: off\n");
  	}
! 	printf("Hash mark printing: %s; Mark count: %d\n", onoff(hash), mark);
! 	printf("Use of PORT cmds: %s\n", onoff(sendport));
  	if (macnum > 0) {
  		printf("Macros:\n");
  		for (i=0; i<macnum; i++) {
***************
*** 937,944 ****
  	printf("Hash mark printing %s", onoff(hash));
  	code = hash;
  	if (hash)
! 		printf(" (%d bytes/hash mark)", 1024);
  	printf(".\n");
  }

  /*
--- 937,967 ----
  	printf("Hash mark printing %s", onoff(hash));
  	code = hash;
  	if (hash)
! 		printf(" (%d bytes/hash mark)", mark);
  	printf(".\n");
+ }
+ 
+ /*
+  * Set hash mark bytecount.
+  */
+ /*VARARGS*/
+ void
+ setmark(argc, argv)
+ 	int argc;
+ 	char *argv[];
+ {
+ 	if (argc != 2)
+ 		printf("mark: bytecount not specified\n");
+ 	else {
+ 		int nmark = atol(argv[1]);
+ 		if (nmark < 1)
+ 			printf("A hash mark bytecount of %d %s",
+ 				nmark, "is rather pointless...\n");
+ 		else {
+ 			mark = nmark;
+ 			printf("Hash mark set to %d bytes/hash mark\n", mark);
+ 		}
+ 	}
  }

  /*
diff -cb /data/0/ftp/pub/NetBSD/NetBSD-current/src/usr.bin/ftp/cmdtab.c ./cmdtab.c
*** /data/0/ftp/pub/NetBSD/NetBSD-current/src/usr.bin/ftp/cmdtab.c	Tue Aug 30 01:33:07 1994
--- ./cmdtab.c	Tue Jan  3 16:55:59 1995
***************
*** 67,72 ****
--- 67,73 ----
  char	lcdhelp[] =	"change local working directory";
  char	lshelp[] =	"list contents of remote directory";
  char	macdefhelp[] =  "define a macro";
+ char	markhelp[] =	"set hashmark spacing to bytecount";
  char	mdeletehelp[] =	"delete multiple files";
  char	mdirhelp[] =	"list contents of multiple remote directories";
  char	mgethelp[] =	"get multiple files";
***************
*** 139,144 ****
--- 140,146 ----
  	{ "lcd",	lcdhelp,	0,	0,	0,	lcd },
  	{ "ls",		lshelp,		1,	1,	1,	ls },
  	{ "macdef",	macdefhelp,	0,	0,	0,	macdef },
+ 	{ "mark",	markhelp,	0,	0,	0,	setmark },
  	{ "mdelete",	mdeletehelp,	1,	1,	1,	mdelete },
  	{ "mdir",	mdirhelp,	1,	1,	1,	mls },
  	{ "mget",	mgethelp,	1,	1,	1,	mget },
diff -cb /data/0/ftp/pub/NetBSD/NetBSD-current/src/usr.bin/ftp/extern.h ./extern.h
*** /data/0/ftp/pub/NetBSD/NetBSD-current/src/usr.bin/ftp/extern.h	Mon Aug 29 13:09:10 1994
--- ./extern.h	Tue Jan  3 16:47:23 1995
***************
*** 119,124 ****
--- 119,125 ----
  void	setftmode __P((int, char **));
  void	setglob __P((int, char **));
  void	sethash __P((int, char **));
+ void	setmark __P((int, char **));
  void	setnmap __P((int, char **));
  void	setntrans __P((int, char **));
  void	setpassive __P((int, char **));
diff -cb /data/0/ftp/pub/NetBSD/NetBSD-current/src/usr.bin/ftp/ftp.1 ./ftp.1
*** /data/0/ftp/pub/NetBSD/NetBSD-current/src/usr.bin/ftp/ftp.1	Tue Aug 30 01:33:13 1994
--- ./ftp.1	Tue Jan  3 17:13:37 1995
***************
*** 312,318 ****
  .It Ic hash
  Toggle hash-sign (``#'') printing for each data block
  transferred.
! The size of a data block is 1024 bytes.
  .It Ic help Op Ar command
  Print an informative message about the meaning of
  .Ar command  .
--- 312,321 ----
  .It Ic hash
  Toggle hash-sign (``#'') printing for each data block
  transferred.
! The size of a data block defaults to 1024 bytes.
! This can be changed with the
! .Ic mark
! command.
  .It Ic help Op Ar command
  Print an informative message about the meaning of
  .Ar command  .
***************
*** 383,388 ****
--- 386,395 ----
  on the second pass it is replaced by the second argument, and so on.
  A `\e' followed by any character is replaced by that character.
  Use the `\e' to prevent special treatment of the `$'.
+ .It Ic mark Ar bytecount
+ Set the byte count between hash mark printing to
+ .Ar bytecount .
+ This defaults to 1024 bytes/hash mark.
  .It Ic mdelete Op Ar remote-files
  Delete the
  .Ar remote-files
diff -cb /data/0/ftp/pub/NetBSD/NetBSD-current/src/usr.bin/ftp/ftp.c ./ftp.c
*** /data/0/ftp/pub/NetBSD/NetBSD-current/src/usr.bin/ftp/ftp.c	Tue Aug 30 01:33:14 1994
--- ./ftp.c	Tue Jan  3 16:37:03 1995
***************
*** 435,442 ****
  	longjmp(sendabort, 1);
  }

- #define HASHBYTES 1024
- 
  void
  sendrequest(cmd, local, remote, printnames)
  	char *cmd, *local, *remote;
--- 435,440 ----
***************
*** 448,454 ****
  	FILE *fin, *dout = 0, *popen();
  	int (*closefunc) __P((FILE *));
  	sig_t oldintr, oldintp;
! 	long bytes = 0, hashbytes = HASHBYTES;
  	char *lmode, buf[BUFSIZ], *bufp;

  	if (verbose && printnames) {
--- 446,452 ----
  	FILE *fin, *dout = 0, *popen();
  	int (*closefunc) __P((FILE *));
  	sig_t oldintr, oldintp;
! 	long bytes = 0, hashbytes = mark;
  	char *lmode, buf[BUFSIZ], *bufp;

  	if (verbose && printnames) {
***************
*** 592,604 ****
  			if (hash) {
  				while (bytes >= hashbytes) {
  					(void) putchar('#');
! 					hashbytes += HASHBYTES;
  				}
  				(void) fflush(stdout);
  			}
  		}
  		if (hash && bytes > 0) {
! 			if (bytes < HASHBYTES)
  				(void) putchar('#');
  			(void) putchar('\n');
  			(void) fflush(stdout);
--- 590,602 ----
  			if (hash) {
  				while (bytes >= hashbytes) {
  					(void) putchar('#');
! 					hashbytes += mark;
  				}
  				(void) fflush(stdout);
  			}
  		}
  		if (hash && bytes > 0) {
! 			if (bytes < mark)
  				(void) putchar('#');
  			(void) putchar('\n');
  			(void) fflush(stdout);
***************
*** 618,624 ****
  				while (hash && (bytes >= hashbytes)) {
  					(void) putchar('#');
  					(void) fflush(stdout);
! 					hashbytes += HASHBYTES;
  				}
  				if (ferror(dout))
  					break;
--- 616,622 ----
  				while (hash && (bytes >= hashbytes)) {
  					(void) putchar('#');
  					(void) fflush(stdout);
! 					hashbytes += mark;
  				}
  				if (ferror(dout))
  					break;
***************
*** 705,711 ****
  	int c, d, is_retr, tcrflag, bare_lfs = 0;
  	static int bufsize;
  	static char *buf;
! 	long bytes = 0, hashbytes = HASHBYTES;
  	struct timeval start, stop;
  	struct stat st;

--- 703,709 ----
  	int c, d, is_retr, tcrflag, bare_lfs = 0;
  	static int bufsize;
  	static char *buf;
! 	long bytes = 0, hashbytes = mark;
  	struct timeval start, stop;
  	struct stat st;

***************
*** 860,872 ****
  			if (hash) {
  				while (bytes >= hashbytes) {
  					(void) putchar('#');
! 					hashbytes += HASHBYTES;
  				}
  				(void) fflush(stdout);
  			}
  		}
  		if (hash && bytes > 0) {
! 			if (bytes < HASHBYTES)
  				(void) putchar('#');
  			(void) putchar('\n');
  			(void) fflush(stdout);
--- 858,870 ----
  			if (hash) {
  				while (bytes >= hashbytes) {
  					(void) putchar('#');
! 					hashbytes += mark;
  				}
  				(void) fflush(stdout);
  			}
  		}
  		if (hash && bytes > 0) {
! 			if (bytes < mark)
  				(void) putchar('#');
  			(void) putchar('\n');
  			(void) fflush(stdout);
***************
*** 912,918 ****
  				while (hash && (bytes >= hashbytes)) {
  					(void) putchar('#');
  					(void) fflush(stdout);
! 					hashbytes += HASHBYTES;
  				}
  				bytes++;
  				if ((c = getc(din)) != '\n' || tcrflag) {
--- 910,916 ----
  				while (hash && (bytes >= hashbytes)) {
  					(void) putchar('#');
  					(void) fflush(stdout);
! 					hashbytes += mark;
  				}
  				bytes++;
  				if ((c = getc(din)) != '\n' || tcrflag) {
diff -cb /data/0/ftp/pub/NetBSD/NetBSD-current/src/usr.bin/ftp/ftp_var.h ./ftp_var.h
*** /data/0/ftp/pub/NetBSD/NetBSD-current/src/usr.bin/ftp/ftp_var.h	Tue Aug 30 01:33:14 1994
--- ./ftp_var.h	Tue Jan  3 16:35:48 1995
***************
*** 43,53 ****
--- 43,57 ----

  #include "extern.h"

+ #define HASHBYTES 1024
+ 
+ 
  /*
   * Options and other state info.
   */
  int	trace;			/* trace packets exchanged */
  int	hash;			/* print # for each buffer transferred */
+ int	mark;			/* number of bytes between hashes */
  int	sendport;		/* use PORT cmd for each data connection */
  int	verbose;		/* print messages coming back from server */
  int	connected;		/* connected to server */
diff -cb /data/0/ftp/pub/NetBSD/NetBSD-current/src/usr.bin/ftp/main.c ./main.c
*** /data/0/ftp/pub/NetBSD/NetBSD-current/src/usr.bin/ftp/main.c	Sun Dec 25 22:27:00 1994
--- ./main.c	Tue Jan  3 16:36:27 1995
***************
*** 78,83 ****
--- 78,84 ----
  	doglob = 1;
  	interactive = 1;
  	autologin = 1;
+ 	mark = HASHBYTES;

  	while ((ch = getopt(argc, argv, "dgintv")) != -1) {
  		switch (ch) {
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: lukem 
State-Changed-When: Sun Nov 24 21:13:34 PST 1996 
State-Changed-Why:  
done now 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.