From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX"  7-DEC-1990 09:26:25.32
To:	MRGATE::"ARISIA::EVERHART"
CC:	
Subj:	Re: Accessing terminal speed from a C program

Received:  by crdgw1.ge.com (5.57/GE 1.80)
	 id AA13426; Fri, 7 Dec 90 04:15:28 EST
Received: From UCBVAX.BERKELEY.EDU by CRVAX.SRI.COM with TCP; Thu,  6 DEC 90 14:39:23 PST
Received: by ucbvax.Berkeley.EDU (5.63/1.42)
	id AA14705; Thu, 6 Dec 90 14:25:44 -0800
Received: from USENET by ucbvax.Berkeley.EDU with netnews
	for info-vax@kl.sri.com (info-vax@kl.sri.com)
	(contact usenet@ucbvax.Berkeley.EDU if you have questions)
Date: 6 Dec 90 20:17:33 GMT
From: soleil!mlb.semi.harris.com!rtpark.rtp.semi.harris.com!rlb@rutgers.edu
Organization: Harris Semiconductor, Microelectronics Center
Subject: Re: Accessing terminal speed from a C program
Message-Id: <1990Dec6.151733.314@rtpark.rtp.semi.harris.com>
References: <274@sdrc.UUCP>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com

In article <274@sdrc.UUCP>, spsisira@sdrc.UUCP (Sisira Jayasinghe) writes:
> 
> I am trying to access the baud rate of I/O device (Terminal)
> from a C program. VMS manuals and our systems guys say LIB$GETDVI
> 
> I really appreciate if somebody direct me in getting the
> baud rate of the terminal device.
>                                
-- 
Here is some fortran code that I wrote several years ago -- you 
can probably use it as is or make some C code to work in a similar
way.

	SUBROUTINE mec$get_speed(term_speed,term_type)
	entry	scr$get_speed(term_speed)
C
C	Subroutine to determine cursor position for vt100 type terminal
C
	implicit none
	include '($IODEF)'
c--------------------------------------------------------------------------
c      data block for tt speeds
c--------------------------------------------------------------------------
	include	'($TTDEF)/list'
	integer*2	speed_table(17)
	data	speed_table(tt$c_baud_50)	/50/
	data	speed_table(tt$c_baud_75)	/75/
	data	speed_table(tt$c_baud_110)	/110/
	data	speed_table(tt$c_baud_134)	/134/
	data	speed_table(tt$c_baud_150)	/150/
	data	speed_table(tt$c_baud_300)	/300/
	data	speed_table(tt$c_baud_600)	/600/
	data	speed_table(tt$c_baud_1200)	/1200/
	data	speed_table(tt$c_baud_1800)	/1800/
	data	speed_table(tt$c_baud_2000)	/2000/
	data	speed_table(tt$c_baud_2400)	/2400/
	data	speed_table(tt$c_baud_3600)	/3600/
	data	speed_table(tt$c_baud_4800)	/4800/
	data	speed_table(tt$c_baud_7200)	/7200/
	data	speed_table(tt$c_baud_9600)	/9600/
	data	speed_table(tt$c_baud_19200)	/19200/
	data	speed_table(tt$c_baud_38400)	/38400/
	character*7	type_table(0:112)
	data	type_table(tt$_unknown)	/'UNKNOWN'/
	data	type_table(tt$_vt05)	/'VT05'/
	data	type_table(tt$_vk100)	/'VK100'/
	data	type_table(tt$_vt173)	/'VT173'/
	data	type_table(tt$_tq_bts)	/'TQ_BTS'/
	data	type_table(tt$_TEK401X)	/'TEK401X'/
	data	type_table(tt$_ft1)	/'FT1'/
	data	type_table(tt$_ft2)	/'FT2'/
	data	type_table(tt$_ft3)	/'FT3'/
	data	type_table(tt$_ft4)	/'FT4'/
	data	type_table(tt$_ft5)	/'FT5'/
	data	type_table(tt$_ft6)	/'FT6'/
	data	type_table(tt$_ft7)	/'FT7'/
	data	type_table(tt$_FT8)	/'FT8'/
	data	type_table(tt$_LAX)	/'LAX'/
	data	type_table(tt$_LA36)	/'LA36'/
	data	type_table(tt$_LA36)	/'LA36'/
	data	type_table(tt$_LA120)	/'LA120'/
	data	type_table(tt$_LA34)	/'LA34'/
	data	type_table(tt$_LA38)	/'LA38'/
	data	type_table(tt$_LA12)	/'LA12'/
	data	type_table(tt$_LA100)	/'LA100'/
	data	type_table(tt$_LA24)	/'LA24'/
	data	type_table(tt$_LQP02)	/'LQP02'/
	data	type_table(tt$_LA84)	/'LA84'/
	data	type_table(tt$_LA210)	/'LA210'/
	data	type_table(tt$_LN03)	/'LN03'/
	data	type_table(tt$_LN01K)	/'LN01K'/
	data	type_table(tt$_LA80)	/'LA80'/
	data	type_table(tt$_vt5x)	/'VT5X'/
	data	type_table(tt$_vt55)	/'VT55'/
	data	type_table(tt$_vt100)	/'VT100'/
	data	type_table(tt$_vt101)	/'VT101'/
	data	type_table(tt$_vt102)	/'VT102'/
	data	type_table(tt$_vt105)	/'VT105'/
	data	type_table(tt$_vt125)	/'VT125'/
	data	type_table(tt$_vt131)	/'VT131'/
	data	type_table(tt$_vt132)	/'VT132'/
	data	type_table(tt$_vt80)	/'VT80'/
	data	type_table(tt$_vt200_series)	/'VT200_SERIES'/
	data	type_table(tt$_pro_series)	/'PRO_SERIES'/
	data	type_table(tt$_VT300_series)	/'VT300_SERIES'/
c	data	type_table(tt$_**)	/'**'/
	integer*4	status, term_speed, ichan
	character*(*)	term_type
	byte		char_buff1(12)
	integer*2	char_buff2(6)
	integer*4	char_buff4(3)
	equivalence	(char_buff1(1),char_buff2(1),char_buff4(1))
	integer		iosb4(2)
	byte		iosb1(8)
	equivalence	(iosb1(1),iosb4(1))
		
	call sys$assign('TT',ichan,,)
	call sys$qiow( ,%val(ichan),
	1  %val(io$_sensemode),
	2  iosb1,,,char_buff1,%val(12),,,,)
	call sys$dassgn(%val(ichan))
	term_speed = speed_table(iosb1(3))
	term_type = type_table(char_buff1(2))(:)
d	type *,term_speed
	return

          Bob
-----------------------------------------------------------------
 Bob Boyd   Voice:     (919)549-3627     
 Harris Semiconductor Microelectronics Center
 
 E-Mail Address:      rlb@rtpark.rtp.semi.harris.com

 Disclaimer?  Datclaimer?  Reclaimer?  

