lib/configs: add head parameter to configs_refer_filename()
Allow configs_refer_filename() to add entries at either the head
or tail of the list by adding a 'head' parameter. This simplifies
the code for adding the main config file, eliminating the need to
add to the tail and then move to the head.
When head=1, use list_add() to prepend to the list.
When head=0, use list_add_tail() to append to the list.