[comp.unix.i386] A Beter ScreenDump for ANSI terminals

root@conexch.UUCP (Larry Dighera) (08/10/89)

Here's an improved version of the screen saving routine found on the SCO
SOS BBS and originally posted by Bob Willey:

:----------------------------------------------------------------------------
# ANSI screen dump
#
# Complements of:
# Dighera Data Services Mon Aug  7 13:35:03 PDT 1989


DMP_FIL="screen.out"	# file to contain the output
DMP_DIR="./"		# could be $HOME/ or /usr/tmp/
export DMP_FIL DMP_DIR

# getopt
count="1"
for i
do
	count="`expr $count + 1`"
	case $i in
		-f) DMP_FIL=`eval "(echo $"$count")"` ;;
		-\?)echo "Usage: $0 [-f dumpfile]" 1>&2;
			exit 1;;
		*) ;;
	esac
done

# doit
savtty="`stty -g`"
stty -echo ixon ixoff -ixany
echo '\033[2i'
head -24 | sed 's/ $//' >> "$DMP_DIR$DMP_FIL"	# 80 characters per line
# One could add other options for the below forms of output
#head -24 >> "$DMP_DIR$DMP_FIL"			# 81 characters per line 
#head -24 | tr -d '\012'>> "$DMP_DIR$DMP_FIL"	# one line of 1920 characters
stty "$savtty"
:----------------------------------------------------------------------------

-- 
USPS: The Consultants' Exchange, PO Box 12100, Santa Ana, CA  92712
TELE: (714) 842-6348: BBS (N81); (714) 842-5851: Xenix guest account (E71)
UUCP: conexch Any ACU 2400 17148425851 ogin:-""-ogin:-""-ogin: nuucp
UUCP: ...!uunet!spsd!conexch!root || ...!ccicpg!conexch!root