options: clean up config path handling

There is no need to export 'optind' and to use it in the main
function. It is better to return the config path in the options
parsing function.

Functionality is exactly the same.
ugtrain: fix segfaults in 'NONE' config path handling

The check if an empty config is allowed dereferences the discovery
string which may be NULL. Also the active config list is not
allocated there. So fix that by putting the active config list on
the stack and adding NULL checks.

Tested with "ugtrain -S NONE".
ugtrain: use an options pointer in main()

Using a pointer to the actual options structure makes it later
easier to move code out of the main function. The compiler should
be intelligent enough to access the structure directly.

Used vim commands to replace the occurrences:
:%s/opt\./opt->/g
:%s/&opt/opt/g

Functionality is exactly the same.
ugtrain: use a config lines pointer in main()

Using a pointer to the actual config lines vector makes it later
easier to move code out of the main function.

Used vim command to replace the occurrences:
:%s/&lines/lines/g

Functionality is exactly the same.
ugtrain: move the config path to the options

Changes a lot but code becomes much cleaner. Less function
parameters, C++ strings only where they are required.