Appeals court rules in favor of coal terminal