[comp.sources.amiga] v89i148: printfx - print on your epson fx

page%swap@Sun.COM (Bob Page) (05/19/89)

Submitted-by: neabbs!amichel@nluug.nl
Posting-number: Volume 89, Issue 148
Archive-name: printers/printfx.1

[uuencoded executable included.  I had to mung the 'execute.me' file
to get the lines less than 80 characters long.  You'll have to re-join
them.  ("blinkers on"?)  ..bob]

# This is a shell archive.
# Remove anything above and including the cut line.
# Then run the rest of the file through 'sh'.
# Unpacked files will be owned by you and have default permissions.
#----cut here-----cut here-----cut here-----cut here----#
#!/bin/sh
# shar: SHell ARchive
# Run the following text through 'sh' to create:
#	Notice
#	_main.a
#	an
#	cst.a
#	execute.me
#	explain.a
#	offswitch.a
#	printfx.c
#	printfx.doc
#	printfx.n
#	printfx.uu
#	stoi.c
# This is archive 1 of a 1-part kit.
# This archive created: Thu May 18 11:43:17 1989
echo "extracting Notice"
sed 's/^X//' << \SHAR_EOF > Notice
XOn your own risk you may do what you like with this code.  It's PD.  D.Reisig.
SHAR_EOF
echo "extracting _main.a"
sed 's/^X//' << \SHAR_EOF > _main.a
X
X
XEOL	equ	$0a		CLI command activator
X
X	xdef	__main
X
X	csect	text,0,0,1,2	any xref's after this are 16-bit reloc
X
X	xref	_main		Name of C program to start with.
X
X__main:	movem.l	d2/d3/a2,-(a7)
X
X*** insert terminators, get pointers, find argc
X	move.l	a7,a2		keep stackpointer
X	move.l	16(a7),a0	get begin
X	lea.l	0(a7),a1	remember first argv for reverse action
X	moveq.l	#0,d3		argc (program name)
X
XSrcNSp	move.b	(a0),d0		search *argv
X	cmp.b	#' ',d0		spaces are delimiters
X	bhi.s	Found		any printable but SP causes an *argv
X	bcs.s	FinalT		any control causes a leave loop
XKillSp	clr.b	(a0)+		no spaces allowed
X	bra.s	SrcNSp
XFound	cmp.b	#'"',d0		entry embedded spaces?
X	beq.s	SplFnd		yes, special search action
X	move.l	a0,-(a7)	no, normal, push a *argv
X	addq.l	#1,d3		++argc
XSrcSp	cmp.b	#' ',(a0)	now search for end
X	beq.s	KillSp		end found, search next *argv
X	bcs.s	FinalT		very end found; leave
X	addq.l	#1,a0		still inside argument,
X	bra.s	SrcSp		so keep searching for delimiter
XSplFnd	addq.l	#1,a0		skip special entry code char
X	move.l	a0,-(a7)	push a *argv
X	addq.l	#1,d3		++argc
XSrcSpl	move.b	(a0),d0		only '"' and '\0' are delimiters (EOL?)
X	beq.s	FinalT		very end found; leave
X	cmp.b	#'"',d0		special delimiter?
X	beq.s	KillSp		yes, act like space found
X	cmp.b	#EOL,d0		@ we look for EOL too
X	beq.s	FinalT		@ and leave on meeting it
X	addq.l	#1,a0		no, still inside argument,
X	bra.s	SrcSpl		so keep searching for delimiter
XFinalT	clr.b	(a0)		now, here is my story:
X
X* If the command line does not contain any embedded space arguments,
X* FinalTerm deletes the closing control, normally a LF. However, you are
X* allowed to embed all controls but '\0' in embedded space arguments. If
X* you do not close this argument with '"', but instead gives an EOL, this
X* EOL takes part of this argument. In this version, we leave the loop on
X* finding it. (@)
X
X*** The argv-array is in reversed order, so do something about it
X	move.l	a7,a0		get begin, end is already in a1
X	move.l	d3,d2		get number of pointers
X	lsr.l	#1,d2		argc/2 we exchange two at a time
X	bra.s	XPtrs1
XXPtrs0	move.l	-(a1),d0
X	move.l	(a0),d1
X	move.l	d0,(a0)+
X	move.l	d1,(a1)
XXPtrs1	dbra	d2,XPtrs0		
X
X*** For some reasons its nice to have a long aligned stackpointer.	
X	move.l	a7,d1		argv
X	move.l	a7,d0		prepare for long line up
X	lsr.l	#2,d0		we look for a carry 
X	bcc.s	LongAl		already long
X	subq.l	#2,a7		make a7 long aligned
XLongAl	move.l	d1,-(a7)	push *argv[]
X	move.l	d3,-(a7)	push argc
X	jsr	_main(pc)	Our main is NOT void!
X	move.l	a2,a7		restore stackpointer
X	movem.l	(a7)+,d2/d3/a2
X	rts
X	
X	end
X
SHAR_EOF
echo "extracting an"
sed 's/^X//' << \SHAR_EOF > an
X.*
X.*	Macro package for NRO in KosmoSoft version
X.*
X.nr h 5 	 @" header indent
X.nr i 10	 @" normal text indent
X.nr s @ni-@nh	 @" section heading indent (to the LEFT)
X.*
X.de TH
X.in @nh;.rm 80-@nh;.he |$0($1)|$2|$0($1)|
X.fo |$3|-#-|$4|
X.in @ni;.rm 80-@ni
X.ta +0 +5
X.en
X.*  Paragraph
X.de PP
X.sp 1;.ne 2;.ti +5
X.en
X.*  Bulleted Paragraph. Needs .RE after last para.
X.*  Must be last on line. Relies on first tab stop.
X.de BP
X.br;.in @ni+5;.ti -3;o@t@@
X.en
X.*  Section Heading
X.de SH
X.sp 1;.ne 3;.ti -@@ns;.bo "$0 $1 $2 $3 $4 $6 $6 $7 $8 $9
X.br
X.en
X.*  SubSection
X.de SS
X.br;.ne 2;.ti -@@ns+1/2;$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
X.br
X.en
X.*  Relative indent Start
X.de RS
X.in +0$0
X.en
X.*  Relative indent End
X.de RE
X.in @ni
X.en
X.*  Italics
X.de I
X.it 1
X$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
X.en
X.*  Bold
X.de B
X.bo 1
X$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
X.en
X.*  Underline
X.de U
X.ul 1
X$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
X.en
X.*  UC
X.de UC
X.*  Empty
X.en
X.*  Italics and Roman
X.de IR
X.if !''$0' .it "$0
X.if !''$1' $1
X.if !''$2' .it "$2
X.if !''$3' $3
X.if !''$4' .it "$4
X.if !''$5' $5
X.if !''$6' .it "$6
X.if !''$7' $7
X.if !''$8' .it "$8
X.if !''$9' $9
X.en
X.*  Roman and Italic
X.de RI
X.if !''$0' $0
X.if !''$1' .it "$1
X.if !''$2' $2
X.if !''$3' .it "$3
X.if !''$4' $4
X.if !''$5' .it "$5
X.if !''$6' $6
X.if !''$7' .it "$7
X.if !''$8' $8
X.if !''$9' .it "$9
X.en
X.*  Bold and Roman
X.de BR
X.if !''$0' .bo "$0
X.if !''$1' $1
X.if !''$2' .bo "$2
X.if !''$3' $3
X.if !''$4' .bo "$4
X.if !''$5' $5
X.if !''$6' .bo "$6
X.if !''$7' $7
X.if !''$8' .bo "$8
X.if !''$9' $9
X.en
X.*  Bold and Italic
X.de BI
X.if !''$0' .bo "$0
X.if !''$1' .it "$1
X.if !''$2' .bo "$2
X.if !''$3' .it "$3
X.if !''$4' .bo "$4
X.if !''$5' .it "$5
X.if !''$6' .bo "$6
X.if !''$7' .it "$7
X.if !''$8' .bo "$8
X.if !''$9' .it "$9
X.en
X.*  Italic and Bold
X.de IB
X.if !''$0' .it "$0
X.if !''$1' .bo "$1
X.if !''$2' .it "$2
X.if !''$3' .bo "$3
X.if !''$4' .it "$4
X.if !''$5' .bo "$5
X.if !''$6' .it "$6
X.if !''$7' .bo "$7
X.if !''$8' .it "$8
X.if !''$9' .bo "$9
X.en
X.*  Italic and Roman
X.de IR
X.if !''$0' .it "$0
X.if !''$1' $1
X.if !''$2' .it "$2
X.if !''$3' $3
X.if !''$4' .it "$4
X.if !''$5' $5
X.if !''$6' .it "$6
X.if !''$7' $7
X.if !''$8' .it "$8
X.if !''$9' $9
X.en
X.*  SMall, do nothing
X.de SM
X$0 $1 $2 $3 $4 $5 $6 $7 $8 $9
X.en
SHAR_EOF
echo "extracting cst.a"
sed 's/^X//' << \SHAR_EOF > cst.a
X*
X* C initial startup procedure under AmigaDOS
X* Special stripped version !!
X* 
X
X	INCLUDE	"exec/types.i"
X	INCLUDE	"exec/libraries.i"
X	INCLUDE	"libraries/dos.i"
X	INCLUDE	"libraries/dosextens.i"
X	INCLUDE	"exec/funcdef.i"
X	INCLUDE	"exec/exec_lib.i"
X	INCLUDE	"libraries/dos_lib.i"
X
XAbsExecBase	EQU	4
X
X	xdef	_XCEXIT		exit(code) is standard way to leave C.
X
X	xref	_LinkerDB	linker defined base value
X	xref	__BSSBAS	linker defined base of BSS
X	xref	__BSSLEN	linker defined length of BSS
X
X	csect	text,0,0,1,2	any xref's after this are 16-bit reloc
X
X	xref	__main		Name of C program to start with.
X
Xstart:
X	movem.l d1-d6/a0-a6,-(a7)
XREGSIZE	EQU	(6+7)*4
X	lea	REGSIZE(a7),A5		determine old stack pointer
X	move.l	a0,a2			save command pointer
X	move.l	d0,d2			and command length
X	lea	_LinkerDB,a4		load base register
X
X	lea	__BSSBAS,a0		get base of BSS
X	moveq	#0,d1
X	move.l	#__BSSLEN,d0		get length of BSS in longwords
X	bra.s	clr_lp			and clear for length given
Xclr_bss move.l	d1,(a0)+
Xclr_lp	dbf	d0,clr_bss
X
X	move.l	AbsExecBase.W,a6
X	move.l	a6,_SysBase(A4)
X	move.l	a7,__StackPtr(A4)	Save stack ptr
X
X*------ get the address of our task
X	suba.l	a1,a1
X	jsr	_LVOFindTask(a6)
X	move.l	d0,a3
X
X*------ are we running as a son of Workbench?
X	move.l	pr_CurrentDir(A3),_curdir(A4)
X	tst.l	pr_CLI(A3)
X	beq	exit4			Not supported
X
X	move.l	a5,D0			Get top of stack
X	sub.l	4(a5),D0		compute bottom 
X	move.l	D0,__base(A4)		save for stack checking
X
X*------ attempt to open DOS library:
X	lea	DOSName(pc),A1
X	moveq.l	#0,D0
X	jsr	_LVOOpenLibrary(a6)
X	move.l	D0,_DOSBase(A4)
X	bne.s	DOSok
X	moveq.l	#100,d0
X	bra.s	exit2
XDOSok
X*------ find command name:
X	move.l	pr_CLI(a3),a0
X	add.l	a0,a0			bcpl pointer conversion
X	add.l	a0,a0
X	move.l	cli_CommandName(a0),a1
X	add.l	a1,a1			bcpl pointer conversion
X	add.l	a1,a1
X
X*------ collect parameters:
X	move.l	d2,d0			get command line length
X	moveq.l	#0,d1
X	move.b	(a1)+,d1
X	move.l	a1,__ProgramName(A4)
X	add.l	d1,d0			add length of command name
X	addq.l	#1,d0			allow for space after command 
X
X	clr.w	-(A7)			set null terminator for command line
X	addq.l	#1,D0			force to even number of bytes
X	andi.w	#$fffe,D0		*(round up)
X	sub.l	D0,A7			make room on stack for command line
X	subq.l	#2,D0
X	clr.w	0(A7,D0)
X
X*------ copy command line onto stack
X	move.l	d2,d0			get command line length
X	subq.l	#1,d0
X	add.l	d1,d2
X
Xcopy_line:
X	move.b	0(A2,D0.W),0(A7,D2.W)	copy command line to stack
X	subq.l	#1,d2
X	dbf	d0,copy_line
X	move.b	#' ',0(a7,d2.w)		add space between command and parms
X	subq.l	#1,d2
X
Xcopy_cmd:
X	move.b	0(a1,d2.w),0(a7,d2.w)	copy command name to stack
X	dbf	d2,copy_cmd
X	move.l	A7,A1
X	move.l	A1,-(A7)		push command line address
X
X	lea.l	Asterix(pc),a0
X	move.l	a0,d1
X	move.l	#MODE_OLDFILE,d2
X	move.l	_DOSBase(A4),a6
X	jsr	_LVOOpen(a6)
X	move.l	d0,_ConOut(a4)
X	beq.s	exit4
X
Xmain	jsr	__main(PC)		call C entrypoint
X*	moveq.l #0,d0			set successful status
X	bra.s	exit2
X
X
X_XCEXIT:
X	move.l	4(SP),d0		extract return code
Xexit2:
X	move.l	d0,-(a7)
X	move.l	__ONEXIT(A4),d0		exit trap function?
X	beq.s	exit3
X	move.l	d0,a0
X	jsr	(a0)
X
Xexit3	move.l	_ConOut(a4),d1
X	move.l	_DOSBase(A4),a6
X	jsr	_LVOClose(a6)
X
Xexit4	move.l	AbsExecBase.W,a6
X	move.l	_DOSBase(A4),a1
X	jsr	_LVOCloseLibrary(a6)	close Dos library
X
XexitToDOS:
X	move.l	(a7)+,d0
X	movea.l	__StackPtr(a4),SP	restore stack ptr
X	movem.l	(a7)+,d1-d6/a0-a6
X	rts
X
XDOSName	dc.b	'dos.library',0
XAsterix	dc.b	'*',0
X
X*-----------------------------------------------------------------------
X
X	csect	__MERGED,1,,2,2
X
X	xref	_DOSBase
X
X	xdef	_SysBase,_LoadAddress
X	xdef	_curdir,__mbase,__mnext,__msize,__tsize
X	xdef	__oserr,__OSERR,__FPERR,__SIGFPE,__ONERR,__ONEXIT,__ONBREAK
X	xdef	__SIGINT,__ECS
X	xdef	__ProgramName,__StackPtr,__base
X	xdef	_ConOut
X
X_ConOut		ds.l	1
X__base		ds.l	1		base of stack
X__mbase		ds.l	1		base of memory pool
X__mnext		ds.l	1		next available memory location
X__msize		ds.l	1		size of memory pool
X__tsize		ds.l	1		total size?
X__oserr		equ	*
X__OSERR		ds.l	1
X__FPERR		ds.l	1
X__SIGFPE	ds.l	1
X__SIGINT	ds.l	1
X__ONERR		ds.l	1
X__ONEXIT	ds.l	1
X__ONBREAK	ds.l	1
X__ECS		ds.l	1		extended character set flag
X_curdir		ds.l	1
X_console_dev	ds.l	1
X_SysBase	ds.l	1
X_LoadAddress	ds.l	1		program load address
X__StackPtr	ds.l	1
X__ProgramName	ds.l	1
X
X	END
X	
SHAR_EOF
echo "extracting execute.me"
sed 's/^X//' << \SHAR_EOF > execute.me
; These two lines were added for USENET/mail transmission.  You must remove
; them, then join the lines that end in "0" with the text on their next line.
remove this line and
Xprintfx execute.me -l0p7
X;                                              89012345678901234567890
X123456789012345678901234
X; This should use one sheet of paper.          89012345678901234567890
X1234567890123456789012345
X; If not, you have to throw this program away  89012345678901234567890
X12345678901234567890123456
X; Or to adapt the source. I'm sorry.           89012345678901234567890
X123456789012345678901234567
X;                                              89012345678901234567890
X1234567890123456789012345678
X; 34567890123456789012345678901234567890123456789012345678901234567890
X12345678901234567890123456789
SHAR_EOF
echo "extracting explain.a"
sed 's/^X//' << \SHAR_EOF > explain.a
X	INCLUDE	"exec/types.i"
X	INCLUDE	"libraries/dos.i"
X	INCLUDE	"libraries/dos_lib.i"
X
XNEWLINE	equ	$0a
X
X	xdef	_Explain,_ConMsg,_ErrMsg,StrLen,_strlen
X
X	CSECT	text,0,0,1,2
X
X_Explain
X	tst.b	_Er(a4)
X	beq.s	Rtn
X	lea.l	ExplMsg1(pc),a0
X	bsr.s	WrtCon
X	move.l	_Pr(a4),a0
X	bsr.s	WrtCon
X	lea.l	ExplMsg2(pc),a0
X	bra.s	WrtCon
X_ConMsg
X	move.l	4(a7),a0
X	bra.s	WrtCon
X_ErrMsg
X	tst.b	_Er(a4)
X	beq.s	Rtn
X	move.l	_Pr(a4),a0
X	bsr.s	WrtCon
X	lea.l	Colon(pc),a0
X	bsr.s	WrtCon
X	move.l	4(a7),a0
X	bsr.s	WrtCon
X	move.l	8(a7),a0
X	bsr.s	WrtCon
X	lea.l	NewLine(pc),a0
X
XWrtCon	movem.l	d2/d3,-(a7)
X	move.l	a0,d2
X	bsr.s	StrLen
X	move.l	d0,d3
X	move.l	_ConOut(a4),d1
X	move.l	_DOSBase(a4),d6
X	jsr	_LVOWrite(a6)
X	movem.l	(a7)+,d2/d3
XRtn	rts
X
X_strlen	move.l	4(a7),a0
XStrLen	moveq.l	#-1,d0
XCount	addq.l	#1,d0
X	tst.b	(a0)+
X	bne.s	Count
X	rts
X
XExplMsg1
X  dc.b 'Syntax:   ',0
XExplMsg2
X  dc.b ' [<source>]',NEWLINE
X  dc.b 'Function: initiate FX-80+ printer and print file ',NEWLINE
X  dc.b 'Options:',NEWLINE
X  dc.b '	-s	no output via stderr',NEWLINE
X  dc.b '	-l<i>	left margin (5)',NEWLINE
X  dc.b '	-r<i>	right margin (max)',NEWLINE
X  dc.b '	-x	donot truncate',NEWLINE
X  dc.b '	-p<i>	lines per page (auto)',NEWLINE
X  dc.b '	-n<i>	linespace in dots/3 (29)',NEWLINE
X  dc.b '	-m<i>	printer mode, overruling other settings (see manual)',NEWLINE
X  dc.b '	-q	low height, superscript',NEWLINE
X  dc.b '	-el	elite (default)',NEWLINE
X  dc.b '	-p	pica',NEWLINE
X  dc.b '	-c	condensed',NEWLINE
X  dc.b '	-en	enlarged',NEWLINE
X  dc.b '	-em	emphasized',NEWLINE
X  dc.b '	-d	double strike',NEWLINE
X  dc.b '	-v	variable pitch (proportional)',NEWLINE
X  dc.b '	-i<i>	paperlength in inches (11)',NEWLINE
X  dc.b '	-ed	paper end detection off',NEWLINE
X  dc.b '	-y	donot adjust paper',NEWLINE
X  dc.b '	-t[<your special title>]  print title',NEWLINE
X  dc.b '	-o	output is standard',NEWLINE
X  dc.b 0
X
XColon	dc.b	': ',0
XNewLine dc.b	NEWLINE,0
X
X	xref	_Er,_ConOut,_DOSBase,_Pr
X
X
X	END
X
SHAR_EOF
echo "extracting offswitch.a"
sed 's/^X//' << \SHAR_EOF > offswitch.a
X*  Here three routines are defined: MakeOffswitch, TestOffSwitch and
X*  RemOffSwitch. They exist to replace the keyboard abort ^C by a kind of
X*  push button, labeled with the programname. So programs running in the
X*  background are easy reachable and you can/must use your own closing
X*  down. Must perhaps, because you MUST call RemOffSwitch before
X*  termination, otherwise the window exits forever and every push on the
X*  offswitch withdraws 56 bytes of the pool.
X*  MakeOffSwitch() may be used to make one window. Subsequent calls just
X*  return the (already existing) window pointer.
X*  
X
X*	nolist		
X	ifnd	ifiles
Xifiles	set	1
X	include	"exec/types.i"
X	include	"intuition/intuition.i"
X	endc
X*	list
X
XLEFT	equ	640/2			Middle of the screen
XTOP	equ	0
XWIDTH	equ	640/2			Half a screen
XHEIGHT	equ	10			Normal dragbar height
X
X	xdef	_MakeOffSwitch,MakeOffSwitch
X	xdef	_TestOffSwitch,TestOffSwitch
X	xdef	_RemOffSwitch,RemOffSwitch
X
X	xref	_LVOOpenLibrary
X	xref	_LVOOpenWindow
X	xref	_LVOGetMsg
X	xref	_LVOReplyMsg
X	xref	_LVOCloseWindow
X	xref	_LVOCloseLibrary
X
X_AbsExecBase	equ	4
X
X	csect	OffSwitch,0,0,1,2
X
X*
X*  From C:
X*  if (MakeOffSwitch(Title)!=NULL)  /* then there is a window! */
X*  else  /* there is no window, but further no problem */
X*  Title is a pointer to a '\0' terminated string.
X*  MakeOffSwitch returns a pointer to the Window structure. Ignore it
X*  or use it, perhaps to change the window. However you may not remove it.
X*
X*  Intuition is opened, but when the OpenWindow fails, intuition is closed
X*  immediate. So if this routine returns NULL, it is not necesary to call
X*  RemOffSwitch, although this would cause no problem.
X*
X
X_MakeOffSwitch:
X	move.l	4(a7),a0
XMakeOffSwitch:
X	move.l	a0,Title(a4)		Text in bar into NewWindow-$
X	move.l	a6,-(a7)		Keep callers a6
X	move.l	Wind(a4),d0		See if there is already a window
X	bne.s	QMOS			Yes, return its pointer
X	move.l	IBase(a4),d0		See if Intuition is already open
X	bne.s	GotI
X	move.l	_AbsExecBase,a6		Get Exec-function pointer
X	lea.l	IntuName(pc),a1		"intuition.library"
X	moveq.l	#0,d0			Any version is OK
X	jsr	_LVOOpenLibrary(a6)	Get Intuition library
X	move.l	d0,IBase(a4)		Keep for later
X	beq.s	QMOS			No intu; no window
XGotI	move.l	d0,a6			Get intu pointer
X	lea.l	NewWind(a4),a0		Get NewWindow structure
X	jsr	_LVOOpenWindow(a6)	Open a window
X	move.l	d0,Wind(a4)		Keep pointer, so we can close it
X	beq.s	CloseI			No window, Intu of no use
XQMOS	move.l	(a7)+,a6		Restore callers a6
X	rts
X
X*
X*  From C:
X*  if (TestOffSwitch()!=0)  /* then close gadget was stirred */
X*  else  /* close gadged was passed */
X*  This may be done more then once, the message is just passed.
X*
X*  Even if there is no window,  it is allowed to call this routine. 
X*  Then it just returns zero.
X*
X
X_TestOffSwitch:
XTestOffSwitch:
X	move.l	a6,-(a7)		Keep callers a6
X	move.l	_AbsExecBase,a6		Get Exec-function pointer
X	move.l	Wind(a4),d0		Get Window-$
X	beq.s	QTOS			If none quit
X	move.l	d0,a1			We need a member so use a-reg
X	move.l	wd_UserPort(a1),a0	Get connection to our window
X	jsr	_LVOGetMsg(a6)		See if ther's a message
X	tst.l	d0			non-zero is truly a message
X	beq.s	QTOS			zero means no message
X	move.l	d0,a1			a1 is used to reply
X	move.l	im_Class(a1),-(a7)	Keep interesting part of mess
X	jsr	_LVOReplyMsg(a6)	Return message ownership
X	move.l	(a7)+,d0		Get interesting part
X	cmp.l	#CLOSEWINDOW,d0		We look only for closewindow
X	bne.s	QZero			If not we return zero
XQTOS	move.l	(a7)+,a6		If true we return CLOSEWINDOW
X	rts
X
X*
X*  From C:
X*  RemOffSwitch();   /* removes the window */
X*
X*  Even if there was no window, it is allowed to call this routine.
X*
X	
X_RemOffSwitch:
XRemOffSwitch:
X	move.l	a6,-(a7)		Save callers a6
X	move.l	IBase(a4),d0		Get key to intuition
X	beq.s	QROS			If none asume ready
X	move.l	d0,a6			a6 is used to enter intuition
X	move.l	Wind(a4),d0		Get window structure
X	beq.s	CloseI			If none close intuition
X	move.l	d0,a0			A0 is parameter port
X	jsr	_LVOCloseWindow(a6)	Close our window
X	clr.l	Wind(a4)		Aint that nice?
XCloseI	move.l	a6,a1			A1 is parameter port
X	move.l	_AbsExecBase,a6		Get key to Exec
X	jsr	_LVOCloseLibrary(a6)	Close intuition
X	clr.l	IBase(a4)		There is NO intuition anymore..
XQZero	moveq.l	#0,d0			This routine always returns 0
XQROS	move.l	(a7)+,a6		Callers a6
X	rts
X	
XIntuName dc.b 'intuition.library',0
X
X	csect	__MERGED,1,,2,2
X
X***  The NewWindow structure
X
XNewWind dc.w	LEFT,TOP,WIDTH,HEIGHT
X	dc.b	-1,-1
X	dc.l	CLOSEWINDOW
X	dc.l	WINDOWDRAG!WINDOWCLOSE!WINDOWDEPTH
X	dc.l	0,0
XTitle	dc.l	0
X	dc.l	0,0
X	dc.w	0,0,0,0
X	dc.w	WBENCHSCREEN
X	
XWind	ds.l	1
XIBase	ds.l	1
X
X	end
SHAR_EOF
echo "extracting printfx.c"
sed 's/^X//' << \SHAR_EOF > printfx.c
Xchar *Cr="PrintFx 2.7  09-MAY-89 by D.W.Reisig, NL 1151AV10\n";
Xchar *WTTl=" PrintFx 2.7 ";
X
X/*
X
XThis code is a good example how NOT to write a program. Then why
Xdid I include the source?
XThis is a utility that I made when I had the Amiga one month or so.
XAnd I could not get my files to my printer without printing over
Xthe perforation, or it stopped halfway the sheet when the printing
Xwas done. Annyway I got irritated.
XI have an Epson FX80+. I thought that made this program useless
Xfor other printers. Suddenly the hole world can use it on their
Xprinters as well. This is why I included the source. Perhaps it
Xdoes not work on your printer. Now you can change it (if you can
Xdecipher the code).
XI used Lattice 5.02 and Asm 5.02 as compilers but 4.00 does it also
Xfine.
X
X*/
X
X
X#include <libraries/dos.h>
X#include <setjmp.h>>
X#include <exec/types.h>
X#include <intuition/intuition.h>
X
X#define CMDNAMES 1	/* one inputfile 				*/
X#define ISM 64		/* init string max				*/
X#define IOBUFFER 512	/* twice allocated from the stack		*/
X#define RMARGINIT 255	/* means: not used				*/
X#define UNIT_INCH 216	/* there are 216 1/3 units in a inch		*/
X#define EOF -1		/*						*/
X#define ESC 0x1b	/*						*/
X#define SKIPOVERA 198	/* skip-over space in 1/3 dots if back shift	*/
X#define SKIPOVERB 264   /* skip-over space if not shifted back		*/
X#define PERFSHIFT 54	/* paper shift back at start in 1/3 dots	*/
X#define ERROR -1	/* Used with longjump in an error situation	*/
X#define	STOP 1		/* Used with longjump in a non error situation	*/
X
Xjmp_buf Mains;		/* easy does it					*/
Xchar DeinitPaper[]={ ESC,'J',PERFSHIFT,ESC,'C',0,0 } ;
X#define DEINITLEN 7	/* size of DeinitPaper[]			*/
Xchar *Path[CMDNAMES+1];
Xchar *Title=NULL;	/* title available				*/
Xint  Infile;		/* DOS file handler				*/
Xint  Prt;		/* DOS file handler				*/
Xint  Page=0;		/* printer determines pagelength		*/
Xint  Lmarg=5;		/* left margin					*/
Xint  Rmarg=RMARGINIT;	/* right margin not given			*/
Xint  Cpline;		/* will contain number of possible chars/line	*/
Xint  Mode=64;		/* 64=unused					*/
Xint  Lsp=29;		/* Linespace .13456" 3.41mm 82 l/p		*/
Xint  Type=1;		/* type is elite				*/
Xint  Plen=11;		/* paper length	in inches			*/
Xint  SpPTab=8;		/* Spaces per Tab (make an option of it iyl	*/
Xchar *Pr;		/* Name of this utility from cmdline		*/
Xchar Cond=0;		/* not condensed				*/
Xchar Empha=0;		/* not emphasized				*/
Xchar Double=0;		/* not double strike				*/
Xchar Prop=0;		/* not proportional				*/
Xchar Super=0;		/* super script is off				*/
Xchar Trunc=1;		/* truncation line overflow			*/
Xchar PlBack=1;		/* paper is pulled back at start		*/
Xchar EndDet=1;		/* paper end detection on			*/
Xchar OutStd=0;		/* Output not standard; PAR:			*/
Xchar Let='\f';		/* last character send to printer, if it is FF,	*/
X			/* no extra FF must be sent, and no FF if	*/
X			/* nothing has been printed			*/
Xchar Er=1;		/* stderr may be used				*/
X
Xvoid ps(),ErrMsg(),Explain();
Xchar gc();
Xextern int ConOut;
X
X
Xmain(argc,argv)
Xregister int argc;
Xregister char *argv[];
X{
X  register int argcnt, namecnt, ret, err=0;
X
X  Pr=argv[0];  /* adapt name the user uses */
X  if (argc>1){
X    if (*argv[1]=='?'){
X      Explain();
X      return(0);
X    }
X  }
X  for (argcnt=1,namecnt=0;argcnt<argc;++argcnt) if (*(argv[argcnt])!='-'){
X    Path[namecnt++]=argv[argcnt];
X    if (namecnt>CMDNAMES) break;
X  }
X  procopts(argc,argv);
X  if (namecnt>CMDNAMES){
X    ErrMsg("Donot know what to do with: ",Path[CMDNAMES]);
X    return(0);
X  }
X  if (calc()) return(0); /* some things must be calculated */
X
X  if (Path[0]){
X    if ((Infile=Open(Path[0],MODE_OLDFILE))==0){
X      ErrMsg("Cannot open: ",Path[0]);
X      return(0);
X    }
X  } else Infile=Input();
X  if (!OutStd){
X    if ((Prt=Open("PAR:",MODE_OLDFILE))==0){
X      ErrMsg("No printer (PAR:)","");
X      goto CleanUp;
X    }
X  } else Prt=Output();
X  ret=setjmp(Mains);    /* return point from deep level errors */
X  if (ret) goto CleanUp;
X  MakeOffSwitch(WTTl);  /* nice to stop when you did RUN pr.. */
X
X  initprinter();
X  filetoprinter();
X  deinitprinter();
X  goto CleanUp1;
X
XCleanUp:
X  if (ret==ERROR)  err=IoErr();
X
XCleanUp1:
X  RemOffSwitch();
X  if (!OutStd)  Close(Prt);
X  if (Path[0])  Close(Infile);
X  return(err);
X}   /* main */
X
X
Xprocopts(argc,argv)
Xregister int argc;
Xregister char *argv[];
X{
X  register int argcnt;
X  register char *option, *error, avail;
X  int temp;
X  for (argcnt=1;argcnt<argc;++argcnt){
X    if (*(option=argv[argcnt])=='-'){
X      avail=1;
X      while (avail) switch(*(error=option++)){
X
Xcase '-'  : break;
Xcase '\0' : avail=0; break;
Xcase '?'  : if (*option=='?') ConMsg(Cr); else Explain();  XCEXIT(0);
Xcase 't'  : Title  =(*option=='=')?option+1:option; avail=0; break;
Xcase 'i'  : option+=stoi(option,&Plen);   break;
Xcase 'l'  : option+=stoi(option,&Lmarg);  break;
Xcase 'r'  : option+=stoi(option,&Rmarg);  break;
Xcase 'p'  : option+=stoi(option,&temp);
X            if (temp==0) Type&=0xfe;
X            else Page=temp;
X            break;
Xcase 'm'  : option+=stoi(option,&Mode);   break;
Xcase 'n'  : option+=stoi(option,&Lsp);    break;
Xcase 'c'  : Type|=0x04;  break;
Xcase 'e'  : switch(*(option++)){
X              case 'd' : EndDet=0;    break;
X              case 'l' : Type|=0x01;  break;
X              case 'm' : Type|=0x08;  break;
X              case 'n' : Type|=0x20;  break;
X              default  : goto opterr;
X            }
Xcase 'd'  : Type|=0x10;  break;
Xcase 'v'  : Prop=1;      break;
Xcase 'x'  : Trunc=0;     break;
Xcase 'y'  : PlBack=0;     break;
Xcase 'o'  : OutStd=1;    break;
Xcase 's'  : Er=0;	 break;
Xcase 'q'  : Super=1;     break;
Xdefault   : goto opterr;
X
X  } } } return(0);
Xopterr:
X  Explain();
X  ErrMsg("Unknown option: -",error);
X  XCEXIT(0);
X}   /* procopts */
X
X
Xcalc()
X{
X  register int choose, avail;
X  register unsigned char *data;
X  if (Mode==64)   Mode=Type;
X  data="\x50\x60\x28\x30\x89\xA0\x44\x50";
X  choose=(int)Mode&0x05;	/* b0 on is elite, b2 on is condensed */
X  if (Mode&0x20) choose+=0x02;	/* b1 on is enlarged */ 
X  Cpline=(int)*(data+choose);
X  if (Rmarg!=RMARGINIT){
X    if (Rmarg>Cpline){
X      ErrMsg("Right margin too large","");
X      return(-1);
X    }
X  } else Rmarg=Cpline;
X  Cpline=Rmarg-Lmarg;
X  avail=((Plen*UNIT_INCH)-((PlBack)?SKIPOVERA:SKIPOVERB))/Lsp;
X  if (Page){
X    if (Page>avail){
X      ErrMsg("You ask too much lines per page","");
X      return(-1);
X    }
X  } else Page=avail;
X  return(0);
X}
X
X
Xinitprinter()
X{
X  char initstring[ISM];
X  register char *is=initstring;
X  register int len;
X
X  if (PlBack){
X    *(is++)=ESC;   *(is++)='j';   *(is++)=PERFSHIFT;
X  }
X  *(is++)=ESC;   *(is++)='@';
X  *(is++)=ESC;   *(is++)='C';   *(is++)=0;     *(is++)=Plen;
X  *(is++)=ESC;   *(is++)='!';   *(is++)=Mode;
X  if (Prop)    { *(is++)=ESC;   *(is++)='p';   *(is++)='1';    }
X  *(is++)=ESC;   *(is++)=EndDet?'9':'8';  
X  *(is++)=ESC;   *(is++)='3';   *(is++)=Lsp;
X  if (Lmarg)   { *(is++)=ESC;   *(is++)='l';   *(is++)=Lmarg;  }
X  *(is++)=ESC;   *(is++)='Q';   *(is++)=Rmarg;
X  if (Super)   { *(is++)=ESC;   *(is++)='S';   *(is++)='0';    }
X  
X  len=is-initstring;
X  if (Write(Prt,initstring,len)!=len) longjmp(Mains,ERROR);
X  return(0);
X}
X
X
Xdeinitprinter()
X{
X  if (Let!='\f') if (Write(Prt,"\f",1)!=1) longjmp(Mains,ERROR);
X  if (PlBack){
X    DeinitPaper[DEINITLEN-1]=Plen;  /* FF button works ok now */
X    if (Write(Prt,DeinitPaper,DEINITLEN)!=DEINITLEN) longjmp(Mains,ERROR);
X  }
X  return(0);
X}
X
X
X
Xchar *Inb, *Outb;  /* two buffer pointer global from here on */
X
X
Xfiletoprinter()
X{
X  char inbuffer[IOBUFFER], outbuffer[IOBUFFER];  /* from the stack */
X  register int line, i;
X  register char c;
X  
X  Inb=inbuffer; Outb=outbuffer;
X
X  i=Lmarg;  
X  line=newpage();
X  while (1){
X    c=gc();
Xcheck:
X    if (c=='\t') i+=(SpPTab-((i-Lmarg)%SpPTab));  /* expand tabs */
X    else ++i;
X    if (c=='\n'){                   /* newline */
X      i=Lmarg;
X      line=newline(line);
X    } else if (c=='\f'){            /* formfeed, newline inherent */
X      i=Lmarg;
X      line=newpage(line);
X    } else if (i>Rmarg){            /* R-marge reached: newline */
X      i=Lmarg;
X      line=newline(line);
X      if (Trunc) trunc();           /* skip rest of line  */
X      else goto check;              /* no, print rest on next line */
X    } else pc(c);
X    if (c==EOF) break;
X  }
X  return(0);  
X}
X
X
Xnewline(line)
Xregister int line;
X{
X  ++line;
X  if (line>=Page)  line=newpage();
X  else  pc('\n');
X  return(line);
X}
X
X
Xtrunc()
X{
X  char t;
X  while ((t=gc())>=0) if (t=='\n') break;
X  return(0);
X}
X
X
Xnewpage()
X{
X  static pagenr=0;
X  register out, factor, tpagenr, nr;
X  char ptd;
X  if ((pagenr)&&(Let!='\f')) ps("\r\f");
X  ++pagenr;
X  if (Title){
X    out=0;
X    ps("page "); out+=5;
X    for (tpagenr=pagenr,factor=1000,ptd=0;factor;factor/=10){
X      if (nr=(tpagenr/factor)) ptd=1;
X      if (ptd){
X        pc(nr+0x30);
X        ++out;
X	tpagenr-=(nr*factor);
X      }
X    }
X    for (;out<10;++out) pc(' ');
X    ps(Title); out+=strlen(Title);
X    factor=Cpline-strlen(Path[0])-Lmarg;
X    while (out++<factor) pc(' ');
X    ps(Path[0]);
X    ps("\n\n");
X    return(2); /* now two lines used */
X  }
X  return(0); /* no title; no lines used */
X}
X	
X  
X
Xchar gc()  /* return a char, if buffer empty ask dos for more */
X{
X  static avail=0, pos=0;
X  
X  if (avail==0){
X    if ((avail=Read(Infile,Inb,IOBUFFER))<1){
X      if (avail<0) longjmp(Mains,ERROR);
X      return(EOF);
X    }
X    pos=0;
X  }
X  --avail;
X  return(*(Inb+pos++));
X} /* gc */
X
X
Xvoid ps(string)
Xregister char *string;
X{
X  while (*string) pc(*(string++));
X}
X
X
Xpc(c)  /* store a char, if buffer full, flush it */
Xchar c;
X{
X  static pos=0;
X
X  if (c!=EOF){
X    Let=*(Outb+pos++)=c;
X    if (pos<IOBUFFER) return(0);
X  }
X  if ((TestOffSwitch())||(SetSignal(0,0x3000)&0x3000)){
X    deinitprinter();
X    longjmp(Mains,STOP);
X  }
X  if (Write(Prt,Outb,pos)!=pos) longjmp(Mains,ERROR);
X  pos=0;
X  return(0);
X} /* pc */
X
SHAR_EOF
echo "extracting printfx.doc"
sed 's/^X//' << \SHAR_EOF > printfx.doc
XPrintfx is written to control an Epson FX-80+. Back in 1986, I could not
Xget my files printed in an easy way, so blinkers on and jam the code
Xtogether.  Recently my friends discovered the piece and suggessed that
Xit might work on other printers as well. They reported positive. So here
Xit is. Maybe it does not work properly on your printer. Don't blame me.
XWell, I included the source, so perhaps...  Use it a you like.
X
XNow I will descibe the switches.
X	
X	-?	Give explanation how to use it. If this option is met
X		anywhere on the commandline, the only thing the program
X		does, is to give that explanation.
X
X	-s	no output via stderr
X		No error messages if you dont want them.
X		Is overuled by -? and -??
X
X	-l<i>	left margin (5)
X		Default left margin is 5. Tabs are expanded without
X		including this value. A tab on colum 1 expands to
X		position 13 on the printer.
X
X	-r<i>	right margin (max)
X		Default is the last char that the FX-80+ can print
X		with the present pitch.
X		
X	-x	donot truncate
X		Default is that lines longer than the right margin minus
X		the left margin are truncated.
X		
X	-p<i>	lines per page (auto)
X		Default the maximum number of lines are printed on a
X		page, using the linespace as source. But you can select
X		to formfeed every pth line.
X		
X	-n<i>	linespace in dots/3 (29)
X		This number is in 1/216th inch. Three of this units is
X		the vertical size of a dot.
X
X	-m<i>	printer mode, overruling other settings (see manual)
X		This is the value behind ESC!. Precede by '%' if you
X		give it in bynary, '$' if hex and '@' if octal. Donot
X		use it.
X
X	-q	low height, superscript
X		Now you can print a lot on a page! (27040 chars) Use it
X		together with -n=15 or 14 and -c.
X
X	-el	elite (default)
X		I do not know why printers use this this as default. I
X		never use pica.
X		
X	-p	pica
X		If you are in a hurry use this ugly pitch.
X		
X	-c	condensed
X		Narrows the characters.
X		
X	-en	enlarged
X		Stretches the characters
X		
X	-em	emphasized
X		I donot see difference with -d (And my profession is
X		printer!! (but perhaps a bad one))
X		
X	-d	double strike
X		Does something like emphasize.
X
X	-v	variable pitch (proportional)
X		Could be nice, but works only with that ugly pica.
X
X	-i<i>	paperlength in inches (11)
X	
X	-ed	paper end detection off
X		Use this when you want to print a single sheet more than
X		only the upper half
X		
X	-y	donot adjust paper
X		I like to start printing higher as normal, so the paper
X		is pulled back as much as possible. But this causes a jam
X		on a nonmodified FX-80+. You must fill the guide with those
X		two rolls with extra rolls. You can use 2 cm pieces of 8mm
X		high pressure tube.
X		
X	-t[<your special title>]  print title
X		The path and page number are printed as well as your title,
X		if given. Use "" for titles with spaces:
X		"-t=your special title" Leave a space behind this option
X		and others.
X
X	-o	output is standard
X		Use this to sent the file to standard output instead of PAR:
X
X
X
XIf the printing job is done, the printer is left in the last used mode.
XSo any text to PAR: is printed in the same pitch, same linespace, same
Xskip over perforation, same margins. But without control. No trucation and
Xno lines per page. (And no stop)
XThe program will not be beware of changing printer settings inside your text,
Xand may act strange if you do so.
X
XD.W.Reisig
XWoudweeren 10
X1151 AV  Broek in Waterland
XHolland
SHAR_EOF
echo "extracting printfx.n"
sed 's/^X//' << \SHAR_EOF > printfx.n
X.so an
X.TH PrintFX 1 "PrintFX manual"
X.de cmd
X!sp $1;!ne 2;!ti -5;!bo "$0
X.en
X.SH NAME
XPrintFX - EPSON compatible printer utility
X
X.SH HISTORY
X
XPrintfx is written to control an Epson FX-80+. Back in 1986, I could not
Xget my files printed in an easy way, so blinkers on and jam the code
Xtogether.  Recently my friends discovered the piece and suggested that
Xit might work on other printers as well. They reported positive. So here
Xit is. Maybe it does not work properly on your printer. Don't blame me.
XWell, I included the source, so perhaps...  Use it a you like.
X
X.SH COMMAND LINE OPTIONS
X
X.in +8;.ta +0;.cc !
X!*--------------------------*
X!cmd -?
X@tGive explanation how to use it. If this option is met
Xanywhere on the commandline, the only thing the program
Xdoes, is to give that explanation.
X!*--------------------------*
X!cmd -n
X@tno output via stderr
XNo error messages if you don't want them.
XIs overruled by -? and -??
X!*--------------------------*
X!cmd -l<i>
X@tleft margin (5)
XDefault left margin is 5. Tabs are expanded without
Xincluding this value. A tab on column 1 expands to
Xposition 13 on the printer.
X!*--------------------------*
X!cmd -r<i>
X@tright margin (max)
XDefault is the last char that the FX-80+ can print
Xwith the present pitch.
X!*--------------------------*
X!cmd -x
X@tdonot truncate
XDefault is that lines longer than the right margin minus
Xthe left margin are truncated.
X!*--------------------------*
X!cmd -p<i>
X@tlines per page (auto)
XDefault the maximum number of lines are printed on a
Xpage, using the linespace as source. But you can select
Xto formfeed every pth line.
X!*--------------------------*
X!cmd -n<i>
X@tlinespace in dots/3 (29)
XThis number is in 1/216th inch. Three of this units is
Xthe vertical size of a dot.
X!*--------------------------*
X!cmd -m<i>
X@tprinter mode, overruling other settings (see manual)
XThis is the value behind ESC!. Precede by '%' if you
Xgive it in binary, '$' if hex and '@' if octal. Donot
Xuse it.
X!*--------------------------*
X!cmd -q
X@tlow height, superscript
XNow you can print a lot on a page! (27040 chars) Use it
Xtogether with -n=15 or 14 and -c.
X!*--------------------------*
X!cmd -el
X@telite (default)
XI do not know why printers use this as default. I
Xnever use pica.
X!*--------------------------*
X!cmd -p
X@tpica
XIf you are in a hurry use this ugly pitch.
X!*--------------------------*
X!cmd -c
X@tcondensed
XNarrows the characters.
X!*--------------------------*
X!cmd -en
X@tenlarged
XStretches the characters
X!*--------------------------*
X!cmd -em
X@temphasized
XI don't see difference with -d (And my profession is
Xprinter!! (but perhaps I'm a bad one))
X!*--------------------------*
X!cmd -d
X@tdouble strike
XDoes something like emphasize.
X!*--------------------------*
X!cmd -v
X@tvariable pitch (proportional)
XCould be nice, but works only with that ugly pica.
X!*--------------------------*
X!cmd -i<i>
X@tpaperlength in inches (11)
X!*--------------------------*
X!cmd -ed
X@tpaper end detection off
XUse this when you want to print a single sheet more than
Xonly the upper half.
X!*--------------------------*
X!cmd -y
X@tdonot adjust paper
XI like to start printing higher as normal, so the paper
Xis pulled back as much as possible. But this causes a jam
Xon a nonmodified FX-80+. You must fill the guide with those
Xtwo rolls with extra rolls. You can use 2 cm pieces of 8mm
Xhigh pressure tube.
X!*--------------------------*
X!cmd -t
X@t-t[<your special title>] prints your special title.
XThe path and page number are printed as well as your title,
Xif given. Use "" for titles with spaces:
X"-t=your special title" Leave a space behind this option
Xand others.
X!*--------------------------*
X!cmd -o
X@toutput is standard
XUse this to sent the file to standard output instead of PAR:
X!*--------------------------*
X!cc
X.in -5;.PP
X
X.SH NOTES
X
XIf the printing job is done, the printer is left in the last used mode.
XSo any text to PAR: is printed in the same pitch, same linespace, same
Xskip over perforation, same margins. But without control. No trucation and
Xno lines per page (and no stop).
XThe program will not be beware of changing printer settings inside your text,
Xand may act strange if you do so.
X
X.SH AUTHOR
X
XD.W.Reisig,
XWoudweeren 10,
X1151AV  Broek in Waterland,
XHolland.
SHAR_EOF
echo "extracting printfx.uu"
sed 's/^X//' << \SHAR_EOF > printfx.uu
X
Xbegin 644 printfx
XM```#\P`````````#``````````(```0*````B@````````/I```$"DCG?OY+#
XM[P`T)$@D`$GY`````$'Y```!R'(`(#P````88`(@P5'(__PL>``$*4X`0"E/,
XM`$B3R4ZN_MHF0"EK`)@`.$JK`*QG``"R(`V0K0`$*4``!$/Z`+QP`$ZN_=@IZ
XM0`(D9@1P9&!Z(&L`K-'(T<@B:``0T\G3R2`"<@`2&2E)`$S0@5*`0F=2@`)`6
XM__Z?P%6`0G<(`"`"4X#4@1^R```@`%."4<C_]A^\`"`@`%."'[$@`"``4<K_J
XM^")/+PE!^@!>(@@D/````^TL;`(D3J[_XBE```!G(DZZ`$9@!"`O``0O`"`L!
XM`"QG!"!`3I`B+```+&P")$ZN_]PL>``$(FP")$ZN_F(@'RYL`$A,WW]^3G5D@
XM;W,N;&EB<F%R>0`J`$CG,"`D3R!O`!!#[P``=@`0$`P``"!B!F4T0AA@\@P`M
XM`")G$"\(4H,,$``@9^QE'E*(8/12B"\(4H,0$&<0#```(F?6#```"F<$4HA@(
XM[$(0($\D`^**8`@@(2(0(,`B@5'*__8B#R`/Y(AD`E6/+P$O`T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"E*+8+)^`!@3<#FXK
XM`&\,`@0`7W!!N`!M*%\$!`0`,&T@(`1(@$C`L(9L%B`'(@9.N@$.(@1(@4C!0
XMT($N`%*+8,9*A6<((`=$@"2`8`(DAR`+D*W_[DS?#/!.74YU```@;P`$*4@!+
XMJB\.("P!P&8J("P!Q&84+'@`!$/Z`()P`$ZN_=@I0`'$9Q`L0$'L`9!.KO\TU
XM*4`!P&=0+%].=2\.+'@`!"`L`<!G(B)`(&D`5DZN_HQ*@&<4(D`O*0`43J[^^
XMAB`?#(````(`9BPL7TYU+PX@+`'$9R(L0"`L`<!G"B!`3J[_N$*L`<`B3BQX*
XM``1.KOYB0JP!Q'``+%].=6EN='5I=&EO;BYL:6)R87)Y`"!O``1(Z/[^``0A[
XM;P````!P`$YU("\`"&8"4H`@;P`$3.C^_@`$+V@`````3G4``$CG,``D`"8!^
XM2$)(0\3!QL#`P=1#2$)"0M""3-\`#$YU2H!J```>1(!*@6H```Q$@6$``"!$S
XM@4YU80``&$2`1(%.=4J!:@``#$2!80``!D2`3G4O`DA!-`%F```B2$!(04A"/
XM-`!G```&A,$P`DA`-`"$P3`"2$(R`B0?3G4O`W80#$$`@&0```;AF5%##$$(A
XM`&0```;IF5E##$$@`&0```;EF55#2D%K```&XYE30S0`YJA(0D)"YJI(0X#!O
XM-@`P`C0#2$'$P9""9```"%-#T(%D_G(`,@-(0^>X2$#!028?)!].=4CG(`(L7
XM>0```B1,[P`&``Q.KO_B3-]`!$YU```O#BQY```")"(O``A.KO_<+%].=4CGP
XM,`(L>0```B1,[P`.`!!.KO_63-]`#$YU``!(YS`"+'D```(D3.\`#@`03J[_A
XMT$S?0`Q.=0``+PXL>0```B1.KO_*+%].=2\.+'D```(D3J[_Q"Q?3G4O#BQY<
XM```")$ZN_WPL7TYU+PXL>0```$!,[P`#``A.KO[.+%].=0`````#[`````H`B
XM```!```0%```$`0```_T```/Y```#\H```^N```/F```#WX````4````#@``;
XM``````/R```#Z@```'(`````````````````````````````````````````4
XM`````````````````````````````````````````````````````````````
XM`````%!R:6YT1G@@,BXW("`P.2U-05DM.#D@8GD@1"Y7+E)E:7-I9RP@3DP@8
XM,3$U,4%6,3`*``````!0(%!R:6YT1G@@,BXW(`````"(&THV&T,`````````=
XM``````````4```#_````0````!T````!````"P````@```````$!`0`,`0!$)
XM;VYO="!K;F]W('=H870@=&\@9&\@=VET:#H@``!#86YN;W0@;W!E;CH@`%!!_
XM4CH``$YO('!R:6YT97(@*%!!4CHI````56YK;F]W;B!O<'1I;VXZ("T`4&`H#
XM,(F@1%```%)I9VAT(&UA<F=I;B!T;V\@;&%R9V4`````66]U(&%S:R!T;V\@4
XM;75C:"!L:6YE<R!P97(@<&%G90````P```````T,``!P86=E(``*"@``````"
XM`````````````4````%```K__P```@`````.````````````````````````:
XM```````````````!``````````````/L`````@````$```"6````A```````-
X/``/R```#Z0````````/R6
X``
Xend
Xsize 4740
SHAR_EOF
echo "extracting stoi.c"
sed 's/^X//' << \SHAR_EOF > stoi.c
X/* 01-12-86 by D.Reisig 1151AV 10 */
X
Xstoi(cp,retval) /* convert bin, oct, dec or hex string */
Xregister char *cp;
Xint *retval;
X{
Xregister int value, base, neg=0;
Xregister char digit;
Xchar *hold;
X  hold=cp;
X  for (base=0;!base;++cp){
X    if (*cp=='$') base=16;
X    else if (*cp=='@') base=8;
X    else if (*cp=='%') base=2;
X    else if (*cp=='-') neg=1;
X    else if ((*cp!='+')&&(*cp!='=')&&(*cp!='\t')&&(*cp!=' ')){
X      --cp;
X      base=10;
X    }
X  }
X  for (value=0;;++cp){
X    digit=*cp;
X    if (digit>'9'){
X      digit&=0x5f;
X      if (digit<'A') break; 
X      digit-=('A'-':');
X    }
X    digit-='0';
X    if ((digit<0)||(digit>=base)) break;
X    value=value*base+digit;
X  }
X  if (neg) *retval=-value;
X  else *retval=value;
X  return(cp-hold);   /* return length of string involved  */
X}
X
SHAR_EOF
echo "End of archive 1 (of 1)"
# if you want to concatenate archives, remove anything after this line
exit