- From: Mikhail Grouchinski <mgrouch@usa.net>
- Date: 18 Feb 99 16:38:17 EST
- To: www-lib@w3.org
libwww HTTrace function doesn't print the file name and line.
This information would be very helpful for debuging.
I offer the simple solution how to fix this problem.
in file HTUtils.h insert
#define LIBWWW_SHOW_LINES
#ifdef LIBWWW_SHOW_LINES
#define HTTRACE(args) {HTTrace("%s(%u)\t", __FILE__, __LINE__); HTTrace args;}
#else
#define HTTRACE(args) HTTrace args;
#endif /* LIBWWW_SHOW_LINES */
with very silly Perl scripts we can change LIBWWW source calls HTTrace to
HTTRACE.
go to src/ directory
Here are the necessary Perl scripts. Put them them into src directory.
---------------------------
file tr.pl
---------------------------
#! /bin/sh /usr/local/bin/perl
$flag = 1;
while(<>)
{
    if ( $flag )  
    {
        if ( s/HTTrace\(/HTTRACE\(\(/g )
        {
	    $flag = 0;
            if ( s/\)\;/\)\)\;/g ) 
            {
	        $flag = 1;
            }
	}
    }
    else
    {
        if ( s/\)\;/\)\)\;/g )
	{
	    $flag = 1;
	}
    }
    print $_;
}
---------------------------
file trmain.pl
---------------------------
#! /bin/sh /usr/local/bin/perl
@files = <*.c>;
foreach $i (@files)
{
    system "cat $i | tr.pl > ../new/$i";
}
------------------------
chmod +x tr.pl
chmod +x trmain.pl
mkdir ../old
cp *.c ../old
mkdir ../new
trmain.pl
The last command will change LIBWWW C Source files and put the output to 
../new directory
cp ../new/*.c ./
make
make install
Now libwww will print file name and line numbers when tracing is on
if you undefine LIBWWW_SHOW_LINES in HTUtils.h everything will work as before.
Mikhail Grouchinski
____________________________________________________________________
Get free e-mail and a permanent address at http://www.netaddress.com/?N=1
Received on Thursday, 18 February 1999 16:38:21 UTC