Esp. while printing the environment the output is usually longer than 512
bytes. Instead of cutting the message, send multiple 512 bytes packets.
Signed-off-by: Michael Walle <michael@walle.cc>
Acked-by: Mike Frysinger <vapier@gentoo.org>
                return;
        output_recursion = 1;
 
-       if ((len = strlen (s)) > 512)
-               len = 512;
-
-       nc_send_packet (s, len);
+       len = strlen(s);
+       while (len) {
+               int send_len = min(len, 512);
+               nc_send_packet(s, send_len);
+               len -= send_len;
+               s += send_len;
+       }
 
        output_recursion = 0;
 }