"if a person who has been released from prison after having undertaken in terms of subsection to do what is required of him fails to fulfil his undertaking the said officer may commit him to prison as often as may be necessary to compel him to do what is required of him"