Rich Morin <[EMAIL PROTECTED]> wrote:

> When I run "cpp -C", the evil spaces do not appear.  However,
> there's no telling what options dtrace is sending to cpp.  I
> looked at the dtrace man page on Leopard, and it says:
>
>   -C  Run the C preprocessor cpp over D programs before compiling
>       them.  Options can be passed to the C preprocessor using the -D,
>       -U,  -I,  and  -H options.  The degree of C standard conformance
>       can be selected using the -X option.  Refer to  the  description
>       of  the -X option for a description of the set of tokens defined
>       by the D compiler when invoking the C preprocessor.
>
> Sadly, there _is_ no description of a -X option in either the cpp or
> dtrace man page.  Sigh.

/usr/ccs/lib/cpp is not conforming to an official C standard but it is the
standard K&R cpp from 30 years ago.

Platforms that do not have a UNIX history in background today do not deliver
a K&R cpp anymore.

You may get a similar behavior woth gcc's cpp if you use -traditional-cpp.
This still gives a different output.... As cpp is non-free, SchilliX pipes the
outpout from gcc-cpp -traditional-cpp though /usr/lib/cpp-post which has been
written to convert ANSI cpp output to something that looks similar to K&R cpp.

#include <schily/mconfig.h>

#include <stdio.h>
#include <schily/schily.h>

int     fixline __PR((char *line, int amt));

main()
{
        char    line[8192];
        int     amt;

        while ((amt = fgetline(stdin, line, sizeof (line))) >= 0) {
                amt = fixline(line, amt);
                filewrite(stdout, line, amt);
                putchar('\n');
        }
        return (0);
}

fixline(line, amt)
        char    *line;
        int     amt;
{
        char    *p = line;

        if (p[0] != '#')
                return (amt);
        if (p[1] != ' ')
                return (amt);

        if (line[amt-1] == '"') {
                line[amt] = ' ';
                line[amt+1] = '\0';
                amt += 1;
        }
        return (amt);
}

Jörg

-- 
 EMail:[EMAIL PROTECTED] (home) Jörg Schilling D-13353 Berlin
       [EMAIL PROTECTED]                (uni)  
       [EMAIL PROTECTED]     (work) Blog: http://schily.blogspot.com/
 URL:  http://cdrecord.berlios.de/old/private/ ftp://ftp.berlios.de/pub/schily
_______________________________________________
dtrace-discuss mailing list
[email protected]

Reply via email to