(b) Bail. If the person detained has been admitted to bail but the amount fixed is so excessive as to constitute an abuse of discretion, and he is not ordered discharged, the court shall direct a final judgment reducing bail to a proper amount. If the person detained has been denied bail, and he is not ordered discharged, the court shall direct a final judgment admitting him to bail forthwith, if he is entitled to be admitted to bail as a matter of right, or if it appears that the denial of bail constituted an abuse of discretion. Such judgment must fix the amount of bail, specify the time and place at which the person detained is required to appear, and order his release upon bail being given in accordance with the criminal procedure law.
(c) Remand. If the person detained is not ordered discharged and not admitted to bail, a final judgment shall be directed dismissing the proceeding, and, if he was actually produced in court, remanding him to the detention from which he was taken, unless the person then detaining him was not entitled to do so, in which case he shall be remanded to proper detention.