DAOSPEC: an automatic code for measuring equivalent widths in