]> git.mxchange.org Git - flightgear.git/blobdiff - src/NetworkOLK/Tools/fgd_scan.c
Added write-all parameter to save command. If set to true, the
[flightgear.git] / src / NetworkOLK / Tools / fgd_scan.c
index 4d9420c4d048ece77b3b4c4ef60899a48651b2c7..7f301bfad3802cab1824371f145a86fb191f3f09 100644 (file)
@@ -1,33 +1,35 @@
-/***********************************************************/
-/* FGD_SCAN.C by Oliver Delise                             */
-/* Contact info:                                           */
-/* e-mail: delise@rp-plus.de                               */
-/* www: http://www.online-club.de/~olk/progs/mmx-emu/      */
-/* ftp: http://www.online-club.de/~olk/progs/flightgear    */ 
-/*                                                         */
-/* Version 0.1pre-alpha                                    */
-/* The author of this program offers no waranty at all     */
-/* about the correct execution of this software material.  */
-/* Furthermore, the author can NOT be held responsible for */
-/* any physical or moral damage caused by the use of this  */
-/* software.                                               */
-/*                                                         */
-/* This is a standalone Tool to scan for any FlightGear    */
-/* Deamon.                                                 */
-/* This is Open Source Software with many parts            */
-/* shamelessly stolen from others...                       */
-/*                                                         */
-/* -> This program will scan for TCP port listening on a   */
-/*    remote or local host inside the range you give to it.*/
-/*    I offer no warranty over the accuracy though :)      */
-/*    There are 3 verbose modes: No info, service info, and*/
-/*    full info. No info is good of you only want the list */
-/*    of the ports, no more info. The best mode is Full    */
-/*    info, as you get error information,etc. The main     */
-/*    output is STDOUT, and ALL the errors go to STDERR.   */
-/*                                                         */
-/*    History: v0.1pre-alpha: May 25 1999 -> First release */
-/***********************************************************/
+/*************************************************************/
+/* FGD_SCAN.C by Oliver Delise                               */
+/* Contact info:                                             */
+/* e-mail: delise@mail-isis.de                               */
+/* www: http://www.isis.de/members/odelise/progs/flightgear  */
+/*                                                           */
+/* Version 0.1-beta                                          */
+/* The author of this program offers no waranty at all       */
+/* about the correct execution of this software material.    */
+/* Furthermore, the author can NOT be held responsible for   */
+/* any physical or moral damage caused by the use of this    */
+/* software.                                                 */
+/*                                                           */
+/* This is a standalone Tool to scan for any FlightGear      */
+/* Deamon.                                                   */
+/* This is Open Source Software with many parts              */
+/* shamelessly stolen from others...                         */
+/*                                                           */
+/* -> This program will scan for TCP port listening on a     */
+/*    remote or local host inside the range you give to it.  */
+/*    I offer no warranty over the accuracy though :)        */
+/*    There are 3 verbose modes: No info, service info, and  */
+/*    full info. No info is good of you only want the list   */
+/*    of the ports, no more info. The best mode is Full      */
+/*    info, as you get error information,etc. The main       */
+/*    output is STDOUT, and ALL the errors go to STDERR.     */
+/*                                                           */
+/*    History: v0.1pre-alpha: May 25 1999 -> First release   */
+/*             v0.1-alpha     Nov 08 1999                    */
+/*             v0.1-beta      Jan 16 2000 libc5/glibc-2.0    */
+/*                                        glibc-2.1 cleanups */
+/*************************************************************/
 
 
 #include <stdio.h>
@@ -46,7 +48,6 @@ int my_sock;
 struct sockaddr_in address;
 struct sockaddr_in my_address;
 int result;
-extern char *sys_errlist[];
 extern int errno;
 int current_port  = 20000; 
 u_short base_port = 20000;
@@ -166,10 +167,11 @@ void fgd_scan() {
               break; 
       case 2: service_info = getservbyport(htons(current_port),"tcp");
               if (!service_info) {
-                read( sock, &buff, 3);
+                read( sock, &buff, 4);
                 printf(" Got reply : %s\n", &buff);
                 if (strncmp(&buff, "FGD", 3) == 0) {
-                  printf(" FlightGear-Deamon detected\n");
+                  read( sock, &buff, (int) &buff[3]);
+                  printf(" FlightGear-Deamon %s detected.\n", &buff);
                   break;
                 }
               printf("Port %d found. Service name unknown\n",current_port);