Mail Archives: djgpp/1997/10/08/04:42:25
Date: | Wed, 8 Oct 1997 10:40:38 +0200 (IST)
|
From: | Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
|
To: | djgpp AT delorie DOT com
|
Subject: | Re: Writing code for both DJGPP and Linux.
|
In-Reply-To: | <3439DF8C.7D6A@techfak.uni-kiel.de>
|
Message-ID: | <Pine.SUN.3.91.971008103827.28262C-100000@is>
|
MIME-Version: | 1.0
|
On Tue, 7 Oct 1997, Hartmut Schirmer wrote:
> Isolate your serial routines in one source for for DJGPP and one for
> Linux. For Unix (incl. Linux) serial port programming see
>
> http://www.easysw.com/~mike/serial/
I'd like to suggest another approach here? Since on Linux, the ``correct''
way of accessing devices is through `ioctl' and "/dev/ttyX", why not
add this to DJGPP? It shouldn't be too hard: all Alex has to do is to
use the DJGPP Filesystem Extension feature. Using it, Alex will need
to install a handler for several functions, like `open', `close',
`ioctl', `lseek', `read' and `write', and when they reference
"/dev/ttyX" file, redirect them to some serial code (e.g., Bills
`bcserio' package which is available from the DJGPP archives). On
Linux, these calls will just work as usual.
That way, Alex gets a portable program, while DJGPP gets
POSIX-compliant serial port support. And they all live happily ever
after...
- Raw text -