Mail Archives: djgpp/2001/12/19/05:51:10
--0-1428317391-1008758773=:25844
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hello,
I have been working on a program that uses serial
communication.
I have rewritten most functions so it uses PMCOM, but
there are some pieces of code I need some help with...
Below is a part of the original UNIX-code and I would
like to know if I need to rewrtie this code to work
with PMCOM or to just pu it in a big #ifdef for
compatibility with UNIX.
Roland
__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com
--0-1428317391-1008758773=:25844
Content-Type: text/plain; name="Document.txt"
Content-Description: Document.txt
Content-Disposition: inline; filename="Document.txt"
/************************************************************************/
/* */
/* subroutine termst */
/* */
/************************************************************************/
termst()
/* This routine takes care of the terminal-settings. */
{
if(ioctl(f3,TIOCEXCL,"")==0 &&
ioctl(f4,TIOCEXCL,"")==0){ /* set exclusive owner of device*/
lkterm.sg_ispeed = bdrate; /* input baudrate */
lkterm.sg_ospeed = bdrate; /* output baudrate */
lkterm.sg_erase = ERASECH; /* erase character */
lkterm.sg_kill = KILLCH; /* kill character */
lkterm.sg_flags = FLAG; /* communication mode */
if(ioctl(f3,TIOCSETP,&lkterm)!=0 || /* set terminal- */
ioctl(f4,TIOCSETP,&lkterm)!=0){ /* characteristics */
error("terminalsettings can not be changed",-1,"\n");
finish(-1); /* reset exclusive owner */
}
}
else{
error("device is busy",-1,"\n");
finish(-1); /* reset exclusive owner */
}
}
/************************************************************************/
/* */
/* subroutine finish */
/* */
/************************************************************************/
/* The subroutine finish is called to reset the exclusive ownership of */
/* the terminal. */
finish(a)
int a; /* return value */
{
ioctl(f3,TIOCNXCL,"");
ioctl(f4,TIOCNXCL,"");
exit(a);
}
--0-1428317391-1008758773=:25844--
- Raw text -