source: web/old/remctl-2.14/tests/data/cmd-streaming.c @ f6f3e91

web
Last change on this file since f6f3e91 was f6f3e91, checked in by Jessica B. Hamrick <jhamrick@…>, 15 years ago

Preserve directory hierarchy (not sure what happened to it)

  • Property mode set to 100644
File size: 849 bytes
Line 
1/*
2 * Small C program to output three lines, one to stdout, one to stderr, and
3 * then one to stdout again.  Used to test remctl streaming support.
4 *
5 * Written by Russ Allbery <rra@stanford.edu>
6 * Copyright 2006 Board of Trustees, Leland Stanford Jr. University
7 *
8 * See LICENSE for licensing terms.
9 */
10
11#include <config.h>
12#include <portable/system.h>
13
14#ifdef HAVE_SYS_SELECT_H
15# include <sys/select.h>
16#endif
17#include <sys/time.h>
18
19int
20main(void)
21{
22    struct timeval tv;
23
24    fprintf(stdout, "This is the first line\n");
25    fflush(stdout);
26    tv.tv_sec = 0;
27    tv.tv_usec = 100000;
28    select(0, NULL, NULL, NULL, &tv);
29    fprintf(stderr, "This is the second line\n");
30    fflush(stderr);
31    tv.tv_sec = 0;
32    tv.tv_usec = 100000;
33    select(0, NULL, NULL, NULL, &tv);
34    fprintf(stdout, "This is the third line\n");
35
36    return 0;
37}
Note: See TracBrowser for help on using the repository browser.