added exec(cmd,output,input,avpenv) function for exec module

Who checks that buf doesn't overflow? And use fread instead of fgets, since you don't care about there the line feeds are.