The Shootist (1976)

A dying gunfighter spends his last days looking for a way to die with a minimum of pain and a maximum of dignity.