commit ffc72a08ee221b75ef04988fb273e33eb8137ca8
parent 0fe0b3ba1640d6e4efc5e0aff0d80eb5add693a1
Author: mrbesen <y.g.2@gmx.de>
Date: Sat, 21 Jan 2023 13:08:51 +0100
add error message when protocol is not supported
Diffstat:
1 file changed, 11 insertions(+), 0 deletions(-)
diff --git a/cnping.c b/cnping.c
@@ -775,6 +775,17 @@ int main( int argc, const char ** argv )
}
else
{
+ char* protoEnd = strstr( pinghost, "://" );
+ if ( protoEnd )
+ {
+ int protoSize = protoEnd - pinghost;
+ char protoBuffer[protoSize + 1];
+ memcpy( protoBuffer, pinghost, protoSize );
+ protoBuffer[protoSize] = '\0';
+ ERRM( "Protocol \"%s\" is not supported\n", protoBuffer );
+ exit( -1 );
+ }
+
ping_setup( pinghost, device );
OGCreateThread( PingSend, 0 );
OGCreateThread( PingListen, 0 );