In order to provide better encapsulation, the function search_listing() has to be rewritten. Right now, there are lots of printfs which are part of the user interface. That's not very elegant.
I would suggest that the function has only one responsibility. Take search options in the form of an adlist_t struct and return (by reference or value) a list of the search results. The UI part shall be completely moved to main.c.
In order to provide better encapsulation, the function
search_listing()has to be rewritten. Right now, there are lots ofprintfs which are part of the user interface. That's not very elegant.I would suggest that the function has only one responsibility. Take search options in the form of an
adlist_tstruct and return (by reference or value) a list of the search results. The UI part shall be completely moved tomain.c.