gawk error prevents build

2007-12-05
2013-03-12
  • MrMilktoast
    MrMilktoast
    2007-12-05

    I'm using GNU Awk 3.0.5 and in opt-gather.awk, this loop fails

    # Sort it and output it
    END {
        sort(record,numrec)
       
        for (i = 1; i <= numrec; i++) {
            print record[i] }
    }

    The value of numrec is "73" but the loop stops when i is "7".  The high order character "7" of "73" is what the index is compared to.  Strange indeed.  This is one way to get around the problem:

    # Sort it and output it
    END {
        sort(record,numrec)
       
        for (i = numrec; i > 0; i--) {
            print record[numrec-i+1] }
    }