1 /* Copyright (C) 2001-2019 Artifex Software, Inc.
2 All Rights Reserved.
3
4 This software is provided AS-IS with no warranty, either express or
5 implied.
6
7 This software is distributed under license and may not be copied,
8 modified or distributed except as expressly authorized under the terms
9 of the license contained in the file LICENSE in this distribution.
10
11 Refer to licensing information at http://www.artifex.com or contact
12 Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato,
13 CA 94945, U.S.A., +1(415)492-9861, for further information.
14 */
15
16
17 /* Read stdin on platforms that do not support unbuffered read.
18 * This is the most portable implementation, but it is very slow
19 * when reading stdin because it will read one byte at a time.
20 * Platforms that support unbuffered read should use gp_stdia.c
21 * or provide their own implementation
22 */
23
24 #include "stdio_.h"
25 #include "gx.h"
26 #include "gp.h"
27
28 /* Read bytes from stdin, using unbuffered if possible.
29 * This implementation doesn't do unbuffered, so if
30 * interactive read one byte at a time.
31 */
gp_stdin_read(char * buf,int len,int interactive,FILE * f)32 int gp_stdin_read(char *buf, int len, int interactive, FILE *f)
33 {
34 return fread(buf, 1, interactive ? 1 : len, f);
35 }
36