using System V 'cu'

James Logan III logan at vsedev.VSE.COM
Sat Nov 19 09:26:07 AEST 1988


In article <6808 at venera.isi.edu> cracraft at venera.isi.edu (Stuart Cracraft) writes:
>How do you slow down cu's file transfer capability (e.g. the tilde-put
>command) ??

There are two thing I can think of to try.  The first idea is to
give the yourself a nice value of 39.  Just type 

	nice -39 $SHELL

and as soon as you get a prompt, "take" the file.

The second idea is to rewrite the "cat" command that cu invokes
on the machine that has the original file and put it in a
personal bin directory that is listed before /bin and /usr/bin in
your $PATH.  

The following program reads X number of characters, sleeps for
several seconds and then writes them to stdout.  Put it in a
file called "cat.c", then type this at a shell prompt:

	mkdir $HOME/bin
	PATH=$HOME/bin:$PATH
	export PATH
	make cat
	cp cat $HOME/bin

and you're ready to roll.  Let me know how it goes.

			-Jim

------------- CUT HERE ------------ 8< -------------------------
#include <stdio.h>

#define	BLOCKSIZ	256
#define SLEEPVAL	2

main(argc, argv)
int argc;
char **argv;
{
	char	buf[BLOCKSIZ];
	int	numread;
	FILE	*infd;

	if ((infd = fopen(argv[1], "r")) == NULL) {
		fprintf(stderr, "%s: Can't open ", *argv);
		perror(argv[1]);
		exit(1);
	}

	while (numread = fread(buf, 1, sizeof(buf), infd)) {
		if (fwrite(buf, 1, numread, stderr) != numread) {
			fprintf(stderr, "%s: ", *argv);
			perror("Write error");
			break;
		}
		sleep(SLEEPVAL);
	}
	fclose(infd);
	exit(0);
}
------------- CUT HERE ------------ 8< -------------------------

-- 
Jim Logan		logan at vsedev.vse.com
(703) 892-0002		uucp:	..!uunet!vsedev!logan
			inet:	logan%vsedev.vse.com at uunet.uu.net



More information about the Comp.unix.wizards mailing list