cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
c	Include file for use with UBBS program.
c
c	Rev. 3.5  19-Jun-1986
c	Rev. 3.6  25-Jun-1986
c
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc

	include '($ssdef)'
	include '($iodef)'
C
C	Define I/O status blocks and some descriptors.
C
	integer*2 liosb(4), xiosb(4), ltypeahead_count(4)

	integer*4 local_status, local_char(3), noterm(2)

	data noterm  /0,0/		! Don't terminate on anything.

	common /status/ local_status, liosb, xiosb, local_char,
	1	noterm
C
C	Define counters, etc.
C
	integer*4 byte_count, record_count, rbyte_count,
	1	timeouts, parity_errors, naks_received, naks_xmitted,
	1	enqs_received, enqs_xmitted, timeout_count,
	1	flow, mode, dump_timeout, overrun_errors,
	1	error_count, error_record, retry_count,
	1	display_record, file_count, block_count, retry_limit,
	1	block_received, block_xmitted

	common /counts/ byte_count, record_count, rbyte_count,
	1	timeouts, parity_errors, naks_received, naks_xmitted,
	1	enqs_received, enqs_xmitted, timeout_count,
	1	ltypeahead_count, local_asts, lmax_typeahead,
	1	dump_timeout, overrun_errors, error_count,
	1	error_record, retry_count, display_record, file_count,
	1	block_count, retry_limit, block_received, block_xmitted
c
c	Define storage for channels and event flags.
c
	integer*4 lchan_in, lchan_out,
	1	local_asts, lefn_in, lefn_out

	common /channels/ lchan_in, lchan_out,
	1	lefn_in, lefn_out
c
c	Define integers to contains character sizes.
c
	integer*4 lmax_typeahead, vsize, protocol, bitmask, file_type

	common /sizes/ vsize, protocol, bitmask, file_type
c
c	Parameters.
c
	character*(*) null, bell, ss
	parameter (ss = char(13)//char(10))	! Single space.
	parameter (bell = char(7))	! Bell
	parameter (null = char(0))	! Null
	parameter soh = 1		! Start of header		CTRL/A
	parameter stx = 2		! Start of text			CTRL/B
	parameter etx = 3		! End of text			CTRL/C
	parameter eot = 4		! End of transmission		CTRL/D
	parameter enq = 5		! Enquire			CTRL/E
	parameter ack = 6		! Acknowlegment			CTRL/F
	parameter bel = 7		! Bell				CTRL/G
	parameter bs  = 8		! Backspace			CTRL/H
	parameter ht  = 9		! Horizontal tab		CTRL/I
	parameter lf  = 10		! Line feed			CTRL/J
	parameter vt  = 11		! Vertical tab			CTRL/K
	parameter ff  = 12		! Form feed			CTRL/L
	parameter cr  = 13		! Carriage return		CTRL/M
	parameter so  = 14		! Shift out			CTRL/N
	parameter si  = 15		! Shift in			CTRL/O
	parameter dle = 16		! Data link escape		CTRL/P
	parameter dc1 = 17		! Resume output to terminal	CTRL/Q
	parameter dc2 = 18		! Device control 2		CTRL/R
	parameter dc3 = 19		! Stop output to the terminal	CTRL/S
	parameter dc4 = 20		! Device control 4		CTRL/T
	parameter nak = 21		! Negative Acknowlegment	CTRL/U
	parameter syn = 22		! Synchronize byte		CTRL/V
	parameter etb = 23		! End of transmission block	CTRL/W
	parameter can = 24		! Cancel transmission		CTRL/X
	parameter em  = 25		! End of medium			CTRL/Y
	parameter sub = 26		! End of file			CTRL/Z
	parameter esc = 27		! Escape			CTRL/[
	parameter fs  = 28		! File separator		CTRL/\
	parameter gs  = 29		! Group separator		CTRL/]
	parameter rs  = 30		! Record Separator		CTRL/^
	parameter us  = 31		! Unit separator		CTRL/_
	parameter rub = 127		! Rubout
	parameter file_unit = 10	! Unit # for VAX file.
	parameter out_size = 512	! Size of SYS$OUTPUT records.
	parameter buffer_size = 1024	! Buffer size.
	parameter timer_efn = 10	! Event flag used with set timer.
	parameter sevenbit_mask = "177	! Seven bit mask.
	parameter eightbit_mask = "377	! Eight bit mask.
C
C	Flags for LIB$SPAWN:
C
	parameter nowait = 1		!(0) If set, don't wait for command.
	parameter noclisym = 2		!(1) If set, don't copy CLI symbols.
	parameter nolognam = 4		!(2) If set, don't copy logical names.
C
C	Buffer allocation:
C
	logical*1 rbuffer(buffer_size)	! Receive buffer.
	logical*1 xbuffer(buffer_size)	! Transmit buffer.
	logical*1 lbuffer(buffer_size)	! Local buffer.
C
C	Flags.
C
	logical	controlc_typed

	common /flags/ controlc_typed
c
c	Character strings for filenames, system type, baud rate, etc.
c
	character*80 local_device
	character*128 vax_file
	character*256 scratch

	common /buffers/ rbuffer, xbuffer, lbuffer, vax_file,
	1 	local_device, mode, flow, scratch
C
C	Direction for GET/SEND.
C
	parameter to_vax = 1		! Get a file from the remote.
	parameter to_remote = 2		! Send a file to the remote.
C
C	Type of protocol:
C
	parameter unknown = 0		! Unknown protocol.
	parameter xmodem = 1		! CPM XMODEM protocol (FTP 3).
	parameter kermit = 2		! Kermit protocol.
	parameter asciid = 3		! Ascii dump protocol
c
c	Type of file being transfered.
c
	parameter ascii = 0		! Type of file is ASCII.
	parameter binary = 1		! Type of file is BINARY.
	parameter block = 2		! Use 512 byte blocks.

	structure /userlog_structure/
	    character*40 user_key	!positions   1: 40   key 0
	    character*10 password	!positions  41: 50
	    character*20 city		!positions  51: 70
	    character*2  state		!positions  71: 72
	    character*20 computer	!positions  73: 92
	    character*9  last_log_date  !positions  93:101
	    character*8  last_log_time	!positions 102:109
	    logical*1    xpert          !positions 110:110
	    integer*4    num_logon      !positions 111:114
	    integer*4    last_message   !positions 115:118
	    integer*4    num_unread     !positions 119:122
	    byte         auth_sections  !positions 123:123
	    logical*1    approved	!positions 124:124
	    character*10 phone_number	!positions 125:134
	    character*4  user_crlf	!positions 135:138
	    character*4  user_ff	!positions 139:142
	    real*8       last_pass_chg	!positions 143:150
	    character*9  current_day	!positions 151:159
	    integer*2    seconds_today	!positions 160:163
	    integer*4    decus_number	!positions 164:167
	    character*20 company_name	!positions 168:187
	    byte         term_line_len  !positions 188:188
	    end structure

	structure/mail_header_structure/
	    character*30 mail_to	!positions   1:30
	    character*30 mail_from	!positions  31:60
	    character*30 mail_subject	!positions  61:80
	    character*9  mail_date	!positions  81:89
	    character*8  mail_time	!positions  90:97
	    byte         mail_section	!positions  98:98
	    integer*4    mail_first	!positions  99:102
	    integer*4    mail_last	!positions 103:106
	    integer*4    mail_messnum	!positions 107:110
	    logical*1    mail_private	!positions 111:111
	    logical*1    mail_read	!positions 112:112
	    logical*1    mail_deleted	!positions 113:113
	    logical*1    mail_person	!positions 114:114
	    integer*4    mail_reply_to	!postiions 115:118
	    integer*4    mail_replys(10)!positions 119:158
	    real*8       mail_expire	!positions 159:166
	    end structure

	structure/file_description/
	    character*18  file_name	!Positions 1:18    Primary key
	    integer*2     file_size	!Positions 19:20
	    real*8        upload_date	!Positions 21:28
	    integer*4     times_down	!Positions 29:32
	    character*1   file_type	!Positions 33:33
	    character*30  upload_name	!Positions 34:63
	    character*400 upload_text	!Positions 64:463
	    character*49  keywords	!Positions 464:512
	    end structure

	character*20 secnam(8)
	character mail_name*30,area*60
	character*80 message(20)
	logical*1 sysop,sysop2
	integer last_header,last_data,first_mnum,last_mnum
	integer user_number,ios

	record /userlog_structure/ ur

	common/for_mail/ur, last_header, last_data,
	1   first_mnum, last_mnum, mail_name, sysop, sysop2,
	2   area, user_number, secnam, ios, message
c
c	Local typeahead implementation
c
	logical*1 tbuffer(buffer_size)	! Local typeahead buffer
	character cbuffer*(buffer_size)	! Also local typeahead buffer
	integer tnext
	equivalence(tbuffer,cbuffer)

	common/typeah/tbuffer,tnext
c
c	screen formatting characters
c
	character*4 crlf,ffeed
	integer cl,fl

	common/screen_controls/crlf,ffeed,cl,fl

c	Timer pointers

	integer*4 file_timer,user_timer,initial_units,current_units,
	1   allowable_units

	common/timers/file_timer,user_timer,initial_units,current_units,
	1   allowable_units
c
c	End of BBS_INC.FOR.
c
