Hi Andreas,
On Tue, Oct 26, 2010 at 02:35:36PM +0200, Andreas.Eversberg wrote:
i like to change the handling of command line options in layer23 applications, because different layer23 applications require different individual options, and common options also. (e.g. the "mobile" application does not required "--arfcn" option, but "--vty-port". others do not require "--vty-port", but might require a "--gps-device". all apps together require "--socket" and "--gsmtap-ip".)
therefore i like to leave all common options in common/main.c. additional options i like to put in the individual app_*.c files. each options i like to check at the individual app file. if it doesn't exist there, the main.c checks if the option is a common option: [...] any suggestions or complains?
looks fine to me. I wonder though, if it actoually would work, I've never tried to do multiple getopt_long() calls with different opstring/longopt arguments.
I always pondered if it would be worth to have a modular commandline option parser as part of libosmocore, as it is something that we could also need in OpenBSC / OsmoBSC / OsmoSGSN & co. In reality, certain protocol modules have a command line argument, or other parts like the logging subsystem inside libosmocore.