]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/Sockets/DataSource/DataSource.c
Update the sockets applications
[mirror_edk2.git] / AppPkg / Applications / Sockets / DataSource / DataSource.c
index 9add3f24e7b7c89c5dc1e4aae720aa592a25ad83..98a0c9f1209db132fa5d40b47ce5e139f746ccdc 100644 (file)
@@ -84,7 +84,7 @@ UINT64 TotalBytesSent;
 UINT64 PreviousBytes;\r
 UINT64 AverageBytes;\r
 UINT64 Samples;\r
-UINT8 Buffer [ DATA_BUFFER_SIZE ];\r
+UINT8 Buffer[ DATA_BUFFER_SIZE ];\r
 \r
 \r
 //\r
@@ -146,8 +146,7 @@ GetDigit (
   //  Walk the digits\r
   //\r
   Value = 0;\r
-  while (( '0' <= *pDigit ) && ( '9' >= *pDigit ))\r
-  {\r
+  while (( '0' <= *pDigit ) && ( '9' >= *pDigit )) {\r
     //\r
     //  Make room for the new least significant digit\r
     //\r
@@ -313,7 +312,7 @@ SocketConnect (
     //\r
     //  Check for user stop request\r
     //\r
-    while ( ! bTick ) {\r
+    while ( !bTick ) {\r
       Status = ControlCCheck ( );\r
       if ( EFI_ERROR ( Status )) {\r
         break;\r
@@ -494,8 +493,7 @@ SocketOpen (
   //\r
   //  Use do/while and break instead of goto\r
   //\r
-  do\r
-  {\r
+  do {\r
     //\r
     //  Wait for the network layer to initialize\r
     //\r
@@ -801,7 +799,7 @@ Tcp4Locate (
     //\r
     //  Open the network controller's service protocol\r
     //\r
-    Tcp4Controller = pHandles [ Tcp4Index++ ];\r
+    Tcp4Controller = pHandles[ Tcp4Index++ ];\r
     Status = gBS->OpenProtocol (\r
                     Tcp4Controller,\r
                     &gEfiTcp4ServiceBindingProtocolGuid,\r
@@ -1499,12 +1497,15 @@ main (
   //\r
   //  Validate the command line\r
   //\r
-  if ( 2 != Argc ) {\r
-    Print ( L"%s  <remote IP address>\r\n", Argv[0] );\r
+  if ( 2 > Argc ) {\r
+    Print ( L"%s  <remote IP address> [Use TCP]\r\n", Argv[0] );\r
     return -1;\r
   }\r
 \r
-bTcp4 = TRUE;\r
+  //\r
+  //  Determine if TCP should be used\r
+  //\r
+  bTcp4 = (BOOLEAN)( 2 < Argc );\r
 \r
   //\r
   //  Determine the support routines\r
@@ -1522,8 +1523,7 @@ bTcp4 = TRUE;
   //\r
   //  Use for/break instead of goto\r
   //\r
-  for ( ; ; )\r
-  {\r
+  for ( ; ; ) {\r
     //\r
     //  No bytes sent so far\r
     //\r
@@ -1540,14 +1540,10 @@ bTcp4 = TRUE;
     RemoteHostAddress.sin_family = AF_INET;\r
     RemoteHostAddress.sin_port = htons ( PcdGet16 ( DataSource_Port ));\r
 \r
-Print ( L"Argc: %d\r\n", Argc);\r
-Print ( L"Argv[0]: %a\r\n", Argv[0]);\r
-Print ( L"Argv[1]: %a\r\n", Argv[1]);\r
-\r
     //\r
     //  Get the IP address\r
     //\r
-    pRemoteHost = Argv [1];\r
+    pRemoteHost = Argv[1];\r
     Status = IpAddress ( );\r
     if ( EFI_ERROR ( Status )) {\r
       break;\r