* Line buffered stdout (also when pipe).

This commit is contained in:
bg- 2007-05-21 15:22:45 +00:00
parent 7d3c72c8d7
commit 4275601eb8
2 changed files with 6 additions and 2 deletions

View File

@ -26,7 +26,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $Id: scat.c,v 1.5 2007/02/02 13:26:49 bg- Exp $ * $Id: scat.c,v 1.6 2007/05/21 15:22:45 bg- Exp $
* *
*/ */
@ -148,6 +148,8 @@ main(int argc, char **argv)
err(1, "usage: scat device-file"); err(1, "usage: scat device-file");
siodev = argv[1]; siodev = argv[1];
setvbuf(stdout, NULL, _IOLBF, 0); /* Line buffered output. */
slipfd = open(siodev, O_RDWR); slipfd = open(siodev, O_RDWR);
if (slipfd == -1) err(1, "can't open '%s'", siodev); if (slipfd == -1) err(1, "can't open '%s'", siodev);
stty_telos(slipfd); stty_telos(slipfd);

View File

@ -28,7 +28,7 @@
* *
* This file is part of the uIP TCP/IP stack. * This file is part of the uIP TCP/IP stack.
* *
* $Id: tunslip.c,v 1.13 2007/05/02 08:58:00 bg- Exp $ * $Id: tunslip.c,v 1.14 2007/05/21 15:22:56 bg- Exp $
* *
*/ */
@ -865,6 +865,8 @@ main(int argc, char **argv)
ip_id = getpid() * time(NULL); ip_id = getpid() * time(NULL);
setvbuf(stdout, NULL, _IOLBF, 0); /* Line buffered output. */
while ((c = getopt(argc, argv, "B:D:hs:t:")) != -1) { while ((c = getopt(argc, argv, "B:D:hs:t:")) != -1) {
switch (c) { switch (c) {
case 'B': case 'B':