This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

awk problem with embedded awk scripts...



I have a problem with running a test suite of a network simulator 
(http://www-mash.cs.berkeley.edu/ns/ns.html) and I have been told 
before to suspect binary mount / text file problems with awk but who 
knows.

This is what I get as output:
ns: _o4 finish_flows test_flows_unforced: awk.exe: cmd. line:4:
        print "
awk.exe: cmd. line:4:                               ^ unterminated string
    while executing
"exec awk [$self $awkprocedure_] $flowfile >@ $outdesc"
    (procedure "_o4" line 26)
    (TestSuite create_flow_graph line 26)
    invoked from within
"$self create_flow_graph $testname $flowgraphfile"
    (procedure "_o4" line 6)
    (TestSuite finish_flows line 6)
    invoked from within
"_o4 finish_flows test_flows_unforced"

and the tcl file containing the supposedly malfunctioning awk (code) has 
this:

TestSuite instproc allmakeawk { } {
    set awkCode {
        BEGIN {prev=-1; tot_bytes=0; tot_packets=0; forced_total=0; unforced_total=0}
        {
            if ($5 != prev) {
                print " "; print "\"flow ",$5;
                prev = $5
            }
            tot_bytes = $19-$11;
            forced_total= $16-$14;
            tot_packets = $10;
            tot_arrivals = $9;
            unforced_total = $14;
            if (unforced_total + forced_total > 0) {
                if ($14 > 0) {
                    frac_packets = tot_packets/$14;
                }
                else { frac_packets = 0;}
                if ($17-$15 > 0) {
                    frac_bytes = tot_bytes/($17-$15);
                }
                else {frac_bytes = 0;} 
                if ($13 > 0) {
                    frac_arrivals = tot_arrivals/$13;
                }
                else {frac_arrivals = 0;}
                if (frac_packets + frac_bytes > 0) {
                    unforced_total_part = frac_packets * unforced_total / ( unforced_total + forced_total)
                    forced_total_part = frac_bytes * forced_total / ( unforced_total + forced_total)
                    print 100.0 * frac_arrivals, 100.0 * ( unforced_total_part +forced_total_part)
                }
            }
        }
    }
    return $awkCode
}

The problem is at print " "; print "\"flow ",$5; The first print 
statement when passed from tcl script code to the awk program hits 
something nasty. Now, the tcl used is a native (binary release) of 
tcl8.0.5 for win32...

Any help or hint is greatly appreciated. 

TIA,

/ChJ


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]