Electronic structure and magnetic properties of the linear chain cuprates Sr_2CuO_3 and Ca_2CuO_3