repo.or.cz
/
glg-sh.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
add support for input command str
[glg-sh.git]
/
input.c
blob
e3ca8fefebd7f60cde771ec8800786cbabe244d8
1
#include <stdbool.h>
2
#include <string.h>
3
4
#include
"input.h"
5
6
#define CMDSTR 0
7
#define INTERACTIVE 1
8
9
static int
input_type
;
10
11
static char
*
cmdstr
;
12
static int
cmdstrlen
=
0
;
13
14
15
void
input_set_cmdstr
(
char
*
str
)
16
{
17
input_type
=
CMDSTR
;
18
cmdstr
=
str
;
19
cmdstrlen
=
strlen
(
cmdstr
);
20
}
21
22
int
input_get_next_char
(
void
)
23
{
24
int
c
;
25
26
if
(
cmdstrlen
==
0
) {
27
c
= -
1
;
28
}
else
{
29
c
= *(
cmdstr
++);
30
cmdstrlen
--;
31
}
32
return
c
;
33
}
34