4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-02 12:30:24 +08:00

21 lines
404 B
C

#include "msg_peek.h"
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");
}