Structure of amorphous carbon from near-edge and extended x-ray absorption spectroscopy