]> git.mxchange.org Git - flightgear.git/blobdiff - scripts/example/fgfsclient.c
Add -lsgthreads to fgpanel's automake
[flightgear.git] / scripts / example / fgfsclient.c
index 820d287305ab671722bc535e30488e7aaa44adf5..0be90a411ebae7f55f4fc6e457ae301294ae536d 100644 (file)
@@ -1,5 +1,7 @@
 /* $Id$ */
 /* gcc -O2 -g -pedantic -Wall fgfsclient.c -o fgfsclient */
+/* USAGE: ./fgfsclient [hostname [port]] */
+/* Public Domain */
 
 #include <stdio.h>
 #include <errno.h>
@@ -34,7 +36,7 @@ int fgfswrite(int sock, char *msg, ...)
        char buf[MAXMSG];
 
        va_start(va, msg);
-       vsprintf(buf, msg, va);
+       vsnprintf(buf, MAXMSG - 2, msg, va);
        va_end(va);
        printf("SEND: \t<%s>\n", buf);
        strcat(buf, "\015\012");
@@ -135,7 +137,7 @@ int main(int argc, char **argv)
 
        sock = fgfsconnect(hostname, port);
        if (sock < 0)
-               return (EXIT_FAILURE);
+               return EXIT_FAILURE;
 
        fgfswrite(sock, "data");
        fgfswrite(sock, "set /controls/engines/engine[%d]/throttle %d", 0, 1);