git.droids-corp.org
/
libcmdline.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cmdline-examples: remove basic_char_loop() and use cmdline_interact()
[libcmdline.git]
/
src
/
genconf
/
main.c
diff --git
a/src/genconf/main.c
b/src/genconf/main.c
index
3748710
..
95d0b78
100644
(file)
--- a/
src/genconf/main.c
+++ b/
src/genconf/main.c
@@
-59,22
+59,6
@@
struct cmdline *cl;
/*** main */
/*** main */
-void basic_char_loop(void)
-{
- char c;
-
- c = -1;
- /* XXX */
- while (1) {
- read(cl->s_in, &c, 1);
- if (cmdline_in(cl, &c, 1) < 0) {
- break;
- }
- }
- cmdline_free(cl);
- printf("\n");
-}
-
int main(void)
{
struct termios oldterm, term;
int main(void)
{
struct termios oldterm, term;
@@
-92,7
+76,8
@@
int main(void)
setbuf(stdin, NULL);
cl = cmdline_stdin_new(main_ctx, "root> ");
setbuf(stdin, NULL);
cl = cmdline_stdin_new(main_ctx, "root> ");
- basic_char_loop();
+ cmdline_interact(cl);
+ cmdline_free(cl);
tcsetattr(fileno(stdin), TCSANOW, &oldterm);
return 0;
tcsetattr(fileno(stdin), TCSANOW, &oldterm);
return 0;