Shell-model calculations with Woods-Saxon wave functions in 18O and 42Ca