Summary: Platform definitions on Solaris

From: Andreas Höschler <>
Date: Mon Oct 31 2005 - 04:15:27 EST
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 &= 
    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 <> 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

would be it.

Thanks a lot!


sunmanagers mailing list
Received on Mon Oct 31 04:15:56 2005

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:52 EST