Ah, you certainly came to the right place. You are referring to one of Ambrose Bierce's greatest and most terrifying stories. It's called "One of the Missing," readily available on the Internet. In it, Private Jerome Searing, a Union soldier, is trapped and immobilized by a bomb shell in a collapsed barn with his own hair-trigger rifle pointed directly between his eyes. I wasn't aware it had ever been filmed, it is so deeply psychological, but it is truly frightening.