Or you write platform specific code in it's own files, and link it in conditionally.
port-linux.c
port-win32.c
port-solaris.c
myprog.c
and just compile/link port-$TARGET.c into your program. The code tends to be cleaner, and the platform knowledge is concentrated in one place.