S. Carolina court rules against terminal plan