hdlc_input: simplify code using existing functions