refactor scanf core to use common code path for all string formats