[net.sources] newwrite - better version of write

jeff@alberta.UUCP (C. J. Sampson) (10/01/84)

[]
This is a shell file that turns off cbreak before running /bin/write.
I have found it useful because it allows you to see what the other
guy is typing a character at a time, rather than waiting for him to
finish a line.  It also gives you an excuse to make snide comments
about his typing. :-)  Anyway, here it is...

------------------------Cut Here-------------------------------------
# This is a shell archive.  Remove anything before this line, then
# unpack it by saving it in a file and typing "sh file".  (Files
# unpacked will be owned by you and have default permissions.)
#
# This archive contains:
# write.sh newwrite.1

echo x - write.sh
cat > "write.sh" << '//E*O*F write.sh//'
#!/bin/sh
#  newwrite
#

trap 'stty -cbreak ; exit 0 ' 2

if test $1 
then
	case $1 in
		-c)	stty -cbreak ;
			shift ;;
		-*)	echo write: unknown option \`$1\' ;
			exit 1 ;;
		 *)	stty cbreak ;;
	esac
else
	echo 'usage: write [-c] user [ttyname]'
	exit 1
fi

if /bin/write $*
then
	stty -cbreak
	exit 0
else
	stty -cbreak
	exit 1
fi
//E*O*F write.sh//

echo x - newwrite.1
cat > "newwrite.1" << '//E*O*F newwrite.1//'
.TH NEWWRITE 1 "(c) 1984 by Curt Sampson"
.SH NAME
newwrite \- better version of write
.SH SYNOPSIS
.B write 
[
.B -c
] user [ttyname]
.SH DESCRIPTION
.I Write
is exactly the same as the original write, execpt that it
turns cbreak off on the terminal.  This enables the other
person to see what you are typing character by character rather
than line by line.  The -c option disables this feature, making
it like normal write.  Exit with an interrupt.
.SH CAVEATS
This program is copyright (c) 1984 by Curt Sampson.
Usage is granted under the condition that it is for
personal use only.  Usage by a buisness firm or usage
for profit is strictly forbiden unless done by prior
arrangement with the author.  No liability is assumed
by the author for any damages caused directly or 
indirectly by this program.  This program may be
distributed freely as long as this notice is left intact.
.SH AUTHOR
Curt Sampson
.br
inhp4!alberta!jeff
.SH FILES
/usr/bin/write        the "real" write program
.SH SEE ALSO
write(1), mesg(1), who(1) mail(1)
//E*O*F newwrite.1//

echo Possible errors detected by \'wc\' [hopefully none]:
temp=/tmp/shar$$
trap "rm -f $temp; exit" 0 1 2 3 15
cat > $temp <<\!!!
      28      64     334 write.sh
      32     176    1036 newwrite.1
      60     240    1370 total
!!!
wc  write.sh newwrite.1 | sed 's=[^ ]*/==' | diff -b $temp -
exit 0
-- 
------------------------------------------------------------------------
C. J. Sampson	Snail Canada: #712 11135-83rd ave.	***DISCLAIMER***
ihnp4!alberta!jeff		Edmonton, Alberta	+--------------+
ubc-vision!alberta!jeff		CANADA  T6G 2C8		| These may    |
sask!alberta!jeff					| be opinions. |
		 					+--------------+
"He who spends the storm beneath a tree, takes life with a grain of TNT."

ron@brl-tgr.ARPA (Ron Natalie <ron>) (10/06/84)

Yech.  The option of character by character write should be
on the recipient.  Watching chars dribble in one at a time complete
with spelling corrections is annoying.

-Ron