ksb@mentor.cc.purdue.edu (Kevin Braunsdorf) (01/26/91)
I wanted to let a configure script give me a service name or a port
number, like:
cc -DPORT=\"junk\" server.c
or
cc -DPORT=2189 server.c
But I needed to be able to check in the C code to see which one I got:
/* $Compile(1): cc -DPORT=\"123\" %f
* $Compile(1): cc -DPORT=123 %f
*/
main()
{
static char a[] = { PORT };
if (1 != sizeof(a) || sizeof(PORT) != sizeof(PORT+1)) {
printf("string %s\n", a);
} else {
printf("int %d\n", PORT);
}
exit(0);
}
--
If you're not part of the solution, you're part of the problem.
kayessbee, Kevin Braunsdorf, ksb@cc.purdue.edu, pur-ee!ksb, purdue!ksb