meshavg bugfixes, major efficiency improvement

Using the BASIC_SYSTEM trick saves me a few dozen gigabytes of memory.

Using the right index into argv allows me to write the correct output
file instead of overwriting one of my inputs.