Usenet comp.unix.osf.misc (1992-2004)
 help / color / mirror / Atom feed
From: ccam@spiral2.its.latrobe.edu.au (Andrew Moar)
Subject: Re: PGP 5.0i compile problem - LOCATED
Date: 1999/01/20	[thread overview]
Message-ID: <783k9b$d73$1@news.latrobe.edu.au> (raw)
In-Reply-To: 36A4749D.37F4F8D4@ev.co.yu

In article <36A4749D.37F4F8D4@ev.co.yu>,
	Nikola Milutinovic <Nikola.Milutinovic@ev.co.yu> writes:
[ -snip- ]

> PROBLEM
> -------
> Several lines containing conditional pre-processor directives "#if",
> "#ifdef", "#ifndef" and "#endif" were not placed in the 1st column of
> the line, they were in. In other words, they were indented. This caused
> cpp to drop them from compiling, causing "a lot of fun" for the cc.

I've seen similar problems in other freeware source code and have used
the following perl script to fix it.

#!/usr/local/bin/perl
$file = @ARGV[0];
$filetmp = "$file.xxx";
open(OUTFILE, ">$filetmp") || die "$0: can't open $filetmp\n";
select(OUTFILE);
#printf "%s\n", $file;
while (<>)
{
 $a = $_;
 if ($a =~ /#/) {
    $a =~ s/^ +//;
    $a =~ s/^\t+//;
 }
 print $a;
}
rename($filetmp,$file);

(perl isn't my strongest language so it's probably a pretty average script. 
Looking back at it, I'm not even sure how it works!)

You could then run it something like:

find . -exec fixdefines.pl {} \;

under the source code directory.

Cheers
-- 
        Andrew Moar : Ph +61 3 9479 1505  email A.Moar@latrobe.edu.au
          Unix Environment Manager, Information Technology Services
                    La Trobe University, Melbourne



  reply	other threads:[~1999-01-20  5:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-01-19  5:00 PGP 5.0i compile problem - LOCATED Nikola Milutinovic
1999-01-20  5:00 ` Andrew Moar [this message]
1999-01-20  5:00   ` Ray Bellis
1999-01-20  5:00     ` John Parks
1999-01-21  5:00     ` Martin Vorlaender
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox