External stabilization of discontinuous systems and nonsmooth Lyapunov functions