@@ -232,7 +232,7 @@ static void expandResponseFiles(int argc, char *argv[],
232232 for (int i = 0 ; i < argc; i++)
233233 {
234234 const char *s = argv[i];
235- if (!s) continue ;
235+ if (!s || s[ 0 ] == ' \0 ' ) continue ;
236236 if (s[0 ] != ' @' )
237237 {
238238 out.emplace_back (s);
@@ -315,7 +315,7 @@ static void parseSettings(Setting &s, char *argv[], int ptr, int argc)
315315
316316static bool isOption (const std::string &s)
317317{
318- return s.length () >= 2 && s[0 ] == ' -' && std::isalpha (s[1 ]);
318+ return s.length () >= 2 && s[0 ] == ' -' && std::isalpha (( unsigned char ) s[1 ]);
319319}
320320
321321static void Assert (bool b, std::string &context, const std::string &msg = " " )
@@ -830,7 +830,7 @@ static void parseCLI(int argc, char *argv[], RunState &state, Config &c, int &cb
830830 state.receivers .back ()->getDeviceManager ().SerialPort ().SetKey (AIS::KEY_SETTING_BAUDRATE, arg1).SetKey (AIS::KEY_SETTING_PORT, arg2);
831831 break ;
832832 case ' l' :
833- Assert (count == 0 || count == 2 , param, MSG_NO_PARAMETER );
833+ Assert (count == 0 || count == 2 , param, " takes no parameters or [JSON on/off]. " );
834834 if (count == 2 )
835835 {
836836 Assert (arg1 == " JSON" , param, " requires JSON on/off" );
@@ -848,10 +848,10 @@ static void parseCLI(int argc, char *argv[], RunState &state, Config &c, int &cb
848848 state.receivers .push_back (std::unique_ptr<Receiver>(new Receiver ()));
849849 }
850850
851- if (param.length () = = 4 && param[2 ] == ' :' )
851+ if (param.length () > = 4 && param[2 ] == ' :' )
852852 {
853853 Assert (count == 0 , param, MSG_NO_PARAMETER);
854- int n = param[ 3 ] - ' 0 ' ;
854+ int n = ( int ) Util::Parse::Integer ( param. substr ( 3 )) ;
855855 state.receivers .back ()->getDeviceManager ().selectDeviceByIndex (n);
856856 }
857857 else
@@ -900,13 +900,18 @@ static void parseCLI(int argc, char *argv[], RunState &state, Config &c, int &cb
900900 {
901901 state.xshare_defined = true ;
902902
903- if (count == 1 && (arg1 == " OFF" || arg1 == " off" ))
903+ std::string xarg_upper = arg1;
904+ Util::Convert::toUpper (xarg_upper);
905+
906+ if (count == 1 && xarg_upper == " OFF" )
904907 {
905- // Explicitly disable sharing if "OFF " is provided as second parameter
908+ // Explicitly disable sharing if "off " is provided as second parameter
906909 Info () << " Community feed sharing disabled." ;
907910 break ;
908911 }
909912
913+ bool xarg_is_on = (count == 1 && xarg_upper == " ON" );
914+
910915 if (!comm_feed)
911916 {
912917 state.msg .push_back (std::unique_ptr<IO::OutputMessage>(new IO::TCPClientStreamer ()));
@@ -915,7 +920,7 @@ static void parseCLI(int argc, char *argv[], RunState &state, Config &c, int &cb
915920 comm_feed->SetKey (AIS::KEY_SETTING_MSGFORMAT, " COMMUNITY_HUB" );
916921 }
917922
918- if (count >= 1 && comm_feed)
923+ if (count >= 1 && !xarg_is_on && comm_feed)
919924 comm_feed->SetKey (AIS::KEY_SETTING_UUID, arg1);
920925 }
921926 break ;
0 commit comments