To be honest, there wasnt too many hand to hand engagements in the civil war. Picketts Charge and the Battle of the Crater are the ones that come to mind.
In Napolean Era the primary infantry weapon was the bayonet. Regiments would loosen volleys at each at close range and then close to engage in melee. The Civil War was different, the weapons were much more accurate at long range, so like WWI, infantry charge were very dangerous affairs. Gettysburg, Fredericksburg, Ft.Wagner were classic examples of how well fortified infantry could repulse attacking armies much than there own. Therefore the main weapon of a ordinary private remained his rifle-musket, bayonet charges (after several disasterous lessons on both sides) were reserved to finishing off a weaked enemy line.
As for the original question. I think an officer would have used a pistol as a short range firearm. Pistoles have very short range so the close confines of a infantry would make it an ideal weapon. There were several attempts to modify pistoles to increase its firepower. One popular design in the south involoved a 2nd barrel slung underneath the main barrel (imagine the M-16/M203) with a single shot of 00 buckshot. There were other attempts to combine sword with pistoles, or make mini bayonets for pistole but none of these were great successes. While it was against regulations soldiers also carried pistoles (looted from the battlefield) during attacks, and kept them hidden under their uniforms. Most officiers turned a blind eye to this.