texturing cylinders

I’ve been searching for code to texture cylinders, and can’t find any. Anyone know how to do it?

Thanks.