/* $Id$ */
/* gcc -O2 -g -pedantic -Wall fgfsclient.c -o fgfsclient */
+/* USAGE: ./fgfsclient [hostname [port]] */
/* Public Domain */
#include <stdio.h>
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");
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);