Renormalization-group study of Anderson and Kondo impurities in gapless Fermi systems