Summary: Platform definitions on Solaris
From: Andreas Höschler (ahoesch_at_smartsoft.de)
Date: 10/31/05
- Previous message: Andreas Höschler: "Platform definitions on Solaris"
- In reply to: Andreas Höschler: "Platform definitions on Solaris"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 31 Oct 2005 10:15:27 +0100 To: sunmanagers@sunmanagers.org
Dear maangers,
thanks for your replies (less than usual). :-)
> we are building C-code on MacOSX, Solaris, Linux,... using gcc. We
> just realized, that cfsetspeed and cfmakeraw do not exist on Solaris.
> Does anybody know the corresponding replacements?
I googled some more and finally found that the replacements would
probably be:
// cfmakeraw(&options); // <--- not available on Solaris, so we
better do it manually
// begin of cfmakeraw replacement
options.c_iflag &=
~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
options.c_oflag &= ~OPOST;
options.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
options.c_cflag &= ~(CSIZE|PARENB);
options.c_cflag |= CS8;
// end of cfmakeraw replacement
// cfsetspeed(&options, speed); // not available on Solaris, so we
better do it manually
// begin of cfsetspeed replacement
cfsetospeed(&options, speed); // Set 9600 baud
cfsetispeed(&options, speed); // Set 9600 baud
// end of cfsetspeed replacement
> On MacOSX we use "#ifdef __APPLE__" to comment out code that does not
> work on MacOSX. What definition can we use to comment out code on
> Solaris (e.g. the lines containing cfsetspeed,...)?
Special thanks to Dale Ghent <daleg@elemental.org> who outlined that we
can use
touch foo.h; cpp -dM foo.h
to get a list of defined macros on each platform. It seems that
#ifdef __sparc
...
#endif
would be it.
Thanks a lot!
Regards,
Andreas
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
- Previous message: Andreas Höschler: "Platform definitions on Solaris"
- In reply to: Andreas Höschler: "Platform definitions on Solaris"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]