4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-08 18:19:08 +08:00

23 lines
426 B
C

#include "waitall.h"
#define BUF_SIZE 100
int
main ()
{
int sfd;
ssize_t nread;
char buf[BUF_SIZE];
if ((sfd = unixConnect (SV_SOCK_PATH, SOCK_STREAM)) < 0)
errExit ("unixConnect");
/* Copy stdin to socket. */
while ((nread = read (STDIN_FILENO, buf, BUF_SIZE)) > 0)
if (write (sfd, buf, nread) != nread)
errExit ("partial/failed write");
if (nread < 0)
errExit ("read");
}