diff options
Diffstat (limited to 'src/input-std.c')
-rw-r--r-- | src/input-std.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/input-std.c b/src/input-std.c new file mode 100644 index 0000000..4508368 --- /dev/null +++ b/src/input-std.c | |||
@@ -0,0 +1,43 @@ | |||
1 | /* This file is part of GDBM, the GNU data base manager. | ||
2 | Copyright (C) 2016 Free Software Foundation, Inc. | ||
3 | |||
4 | GDBM is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation; either version 3, or (at your option) | ||
7 | any later version. | ||
8 | |||
9 | GDBM is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with GDBM. If not, see <http://www.gnu.org/licenses/>. */ | ||
16 | |||
17 | #include "gdbmtool.h" | ||
18 | |||
19 | ssize_t | ||
20 | input_read (FILE *fp, char *buf, size_t size) | ||
21 | { | ||
22 | if (interactive) | ||
23 | { | ||
24 | print_prompt_at_bol (); | ||
25 | if (fgets (buf, size, fp) == NULL) | ||
26 | return 0; | ||
27 | return strlen (buf); | ||
28 | } | ||
29 | return fread (buf, 1, size, fp); | ||
30 | } | ||
31 | |||
32 | void | ||
33 | input_init (void) | ||
34 | { | ||
35 | /* nothing */ | ||
36 | } | ||
37 | |||
38 | void | ||
39 | input_done (void) | ||
40 | { | ||
41 | /* nothing */ | ||
42 | } | ||
43 | |||