projects
/
my-code
/
api.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
minor fixes + upgrades
[my-code/api.git]
/
input
/
input.c
diff --git
a/input/input.c
b/input/input.c
index
8996866
..
0060f52
100644
(file)
--- a/
input/input.c
+++ b/
input/input.c
@@
-6,13
+6,21
@@
#include "input.h"
#include "input.h"
-int input_init(t_input *input) {
+int input_init(t_input *input,int outfd) {
+
+ dprintf(outfd,"[input] initializing input system ...\n");
+
+ input->outfd=outfd;
+ input->mode=0;
+
+ return I_SUCCESS;
+}
+
+int input_ios_init(t_input *input) {
struct termios tios;
int size;
struct termios tios;
int size;
- fprintf(stderr,"[input] initializing input system ...\n");
-
size=((input->mode&CONTENT_BUFFER)?MAX_CONTENT:1);
if((input->content=(char *)malloc(size))==NULL) {
size=((input->mode&CONTENT_BUFFER)?MAX_CONTENT:1);
if((input->content=(char *)malloc(size))==NULL) {
@@
-44,7
+52,7
@@
int input_shutdown(t_input *input) {
free(input->content);
tcsetattr(0,TCSANOW,&(input->tios));
free(input->content);
tcsetattr(0,TCSANOW,&(input->tios));
-
fprintf(stderr
,"[input] shutdown\n");
+
dprintf(input->outfd
,"[input] shutdown\n");
return I_SUCCESS;
}
return I_SUCCESS;
}
@@
-64,7
+72,7
@@
int input_get_event(t_input *input,int (*callback)(t_input *input,void *ptr),
}
if(input->c_count>=MAX_CONTENT) {
}
if(input->c_count>=MAX_CONTENT) {
-
fprintf(stderr
,"[input] max input length reached\n");
+
dprintf(input->outfd
,"[input] max input length reached\n");
return I_ERROR;
}
return I_ERROR;
}