Welcome to mirror list, hosted at ThFree Co, Russian Federation.

waitall_cl.c « socket_tests « cygwin « winsup - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 49aba3e877d9bd71a8507403c7f5329e413b7339 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#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");
}