EarthScope / msmod

3 stars 0 forks source link

--timecorrval does not accept negative values #1

Open speleos opened 8 months ago

speleos commented 8 months ago

https://github.com/EarthScope/msmod/blob/3dafc8c91dc5dcaf9e1422c426ce2fea20f521dd/src/msmod.c#L693

If negative skew values are given, msmod returns the following: ERROR Option --timecorrval requires a value, try -h for usage

./msmod -o test.XX.XXX..XXX.X.XXXX.XX.XX --quality 'Q' --actflags 1,1 --timecorrval -12 --loc 00 XX.XXXX..XXX.X.XXXX.XX.XX

speleos commented 8 months ago

The issue seems to stem from getoptval and its very strict interpretation that anything with prefixed by "--" or a "-" is an option.

using --timecorrval -- -12 also doesn't work, nor --timecorrval=-12.

chad-earthscope commented 8 months ago

Thanks for reporting this. The simple arg parser here: https://github.com/EarthScope/msmod/blob/3dafc8c91dc5dcaf9e1422c426ce2fea20f521dd/src/msmod.c#L917

needs additional exceptions for the timecorr and timecorrval arguments.

speleos commented 6 months ago

I believe this is the solution, could you please check if it this is enough?

/ Special case of '--timecorrval -X' / if ( (argopt+1) < argcount && strcmp (argvec[argopt], "--timecorrval") == 0 ) if ( lisnumber(argvec[argopt+1]) ) return argvec[argopt+1];