Historically cups have not been used. For spaceflight, liquids have been stored in sealed bag-like containers and then drunk through a tube. These are somewhat similar to how many children's drinks are packaged and stored. This document shows some pictures of these sorts of containers and some food containers.
As another answer has said, there have been demonstrations of drinking containers that take advantage of certain physical properties which allow a liquid to stay inside an open container.
There is also video of astronauts letting water loose inside their cabin and then taking into their mouths by moving their head into a position which allows that. This was part of an educational video in which astronauts were showing how liquid behaves in a low gravity environment.