[comp.lang.c] cpp - the C language preprocessor

trevor@trevan.UUCP (trevor) (07/25/88)

	Please can someone tell me how I can use the -D option to define
a name with a space in it ie 

#define fred xxxx yyyy

	I have tried alot of combinations like -Dfred='xxxx yyyy' but
nothing seems to work. This is using Microport System V/286.

hd@mh_co2.mh.nl (Theo Hardendood) (07/25/88)

From article <173@trevan.UUCP>, by trevor@trevan.UUCP (trevor):
> 
> 	Please can someone tell me how I can use the -D option to define
> a name with a space in it ie 
> 
> #define fred xxxx yyyy
> 
> 	I have tried alot of combinations like -Dfred='xxxx yyyy' but
> nothing seems to work. This is using Microport System V/286.

Try something like this:
	'-Dfred="xxxx yyyy"'

Theo Hardendood                  hd@mh.nl via european backbone (mcvax)
Multihouse NV, Gouda - The Netherlands          uucp: ..!mcvax!mh.nl!hd
"A conclusion is simply the place where someone got tired of thinking."

bernie@codas.att.com (Bernie Brown) (07/26/88)

In article <173@trevan.UUCP>, trevor@trevan.UUCP writes:
> 	Please can someone tell me how I can use the -D option to define
> a name with a space in it ie 
> 
> #define fred xxxx yyyy

We've used -D'fred="xxxx yyyy"'.  Works great on a 3B2 with CPLU 4.0

Good Luck,
Bernie
-- 
Bernie Brown
bernie@codas.att.com

sdf@abcom.ATT.COM (6362 Two Gateway Center Newark) (07/27/88)

In article <173@trevan.UUCP>, trevor@trevan.UUCP writes:
> 
> 	Please can someone tell me how I can use the -D option to define
> a name with a space in it ie 
> 
> #define fred xxxx yyyy
> 
> 	I have tried alot of combinations like -Dfred='xxxx yyyy' but
> nothing seems to work. This is using Microport System V/286.

I tried the above on an Amdahl running UTS and it worked fine. In your case,
try escaping the space with a backslash, as in:

			-Dfred='xxxx\ yyyy'

The backslash will (or should) treat the space as a literal part of the
string.


----------------
Stephen Fried
AT&T
Newark, NJ
----------------
-- 
... Any resemblance between the above views and those of my employer, my 
terminal, or the view out my window are purely coincidental. The question of 
the existence of views in the absence of anyone to hold them is left as an 
exercise for the reader.  ----- Stephen Fried - AT&T, Newark, NJ - abcom!sdf

mmengel@cuuxb.ATT.COM (~XT4103000~Marc Mengel~C25~G25~6184~) (07/27/88)

In article <173@trevan.UUCP> trevor@trevan.UUCP writes:
>
>	Please can someone tell me how I can use the -D option to define
>a name with a space in it ie 
>
>#define fred xxxx yyyy
>
>	I have tried alot of combinations like -Dfred='xxxx yyyy' but
>nothing seems to work. This is using Microport System V/286.

I am assuming this is breaking in a Makefile, since that works
on most systems I have seen; problem is, in a Makefile, make strips
off the quotes an hands the option to the shell without them; so
you end up doing someting bizarre like
CFLAGS= "-Dfred='xxx yyy'"

so make eats the ""s and the shell still gets handed the ''s


-- 
 Marc Mengel			       
				
 attmail!mmengel	
 {lll-crg|mtune|ihnp4}!cuuxb!mmengel