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 (merge-intel): cosmetic fixes, conform to coding rules
[libcmdline.git]
/
src
/
lib
/
cmdline_rdline.c
diff --git
a/src/lib/cmdline_rdline.c
b/src/lib/cmdline_rdline.c
index
86d3a9c
..
15f096d
100644
(file)
--- a/
src/lib/cmdline_rdline.c
+++ b/
src/lib/cmdline_rdline.c
@@
-91,7
+91,8
@@
isblank2(char c)
return 0;
}
return 0;
}
-void rdline_init(struct rdline *rdl,
+void
+rdline_init(struct rdline *rdl,
rdline_write_char_t *write_char,
rdline_validate_t *validate,
rdline_complete_t *complete)
rdline_write_char_t *write_char,
rdline_validate_t *validate,
rdline_complete_t *complete)
@@
-172,7
+173,8
@@
display_right_buffer(struct rdline *rdl)
}
}
}
}
-void rdline_redisplay(struct rdline *rdl)
+void
+rdline_redisplay(struct rdline *rdl)
{
unsigned int i;
char tmp;
{
unsigned int i;
char tmp;
@@
-197,11
+199,11
@@
rdline_char_in(struct rdline *rdl, char c)
#endif
if (rdl->status != RDLINE_RUNNING)
#endif
if (rdl->status != RDLINE_RUNNING)
- return
-1
;
+ return
RDLINE_RES_NOT_RUNNING
;
cmd = vt100_parser(&rdl->vt100, c);
if (cmd == -2)
cmd = vt100_parser(&rdl->vt100, c);
if (cmd == -2)
- return
0
;
+ return
RDLINE_RES_SUCCESS
;
if (cmd >= 0) {
switch (cmd) {
if (cmd >= 0) {
switch (cmd) {
@@
-283,7
+285,7
@@
rdline_char_in(struct rdline *rdl, char c)
if (cmd == CMDLINE_KEY_CTRL_D &&
CIRBUF_IS_EMPTY(&rdl->left) &&
CIRBUF_IS_EMPTY(&rdl->right)) {
if (cmd == CMDLINE_KEY_CTRL_D &&
CIRBUF_IS_EMPTY(&rdl->left) &&
CIRBUF_IS_EMPTY(&rdl->right)) {
- return
-2
;
+ return
RDLINE_RES_EOF
;
}
if (!cirbuf_del_head_safe(&rdl->right)) {
display_right_buffer(rdl);
}
if (!cirbuf_del_head_safe(&rdl->right)) {
display_right_buffer(rdl);
@@
-365,12
+367,12
@@
rdline_char_in(struct rdline *rdl, char c)
&complete_state);
/* no completion or error */
if (ret <= 0) {
&complete_state);
/* no completion or error */
if (ret <= 0) {
- return
2
;
+ return
RDLINE_RES_COMPLETE
;
}
tmp_size = strlen(tmp_buf);
/* add chars */
}
tmp_size = strlen(tmp_buf);
/* add chars */
- if (ret ==
2
) {
+ if (ret ==
RDLINE_RES_COMPLETE
) {
i=0;
while(CIRBUF_GET_LEN(&rdl->right) + CIRBUF_GET_LEN(&rdl->left) <
RDLINE_BUF_SIZE &&
i=0;
while(CIRBUF_GET_LEN(&rdl->right) + CIRBUF_GET_LEN(&rdl->left) <
RDLINE_BUF_SIZE &&
@@
-380,7
+382,7
@@
rdline_char_in(struct rdline *rdl, char c)
i++;
}
display_right_buffer(rdl);
i++;
}
display_right_buffer(rdl);
- return
2
; /* ?? */
+ return
RDLINE_RES_COMPLETE
; /* ?? */
}
/* choice */
}
/* choice */
@@
-397,7
+399,7
@@
rdline_char_in(struct rdline *rdl, char c)
rdline_redisplay(rdl);
}
rdline_redisplay(rdl);
}
- return
2
;
+ return
RDLINE_RES_COMPLETE
;
case CMDLINE_KEY_RETURN:
case CMDLINE_KEY_RETURN2:
case CMDLINE_KEY_RETURN:
case CMDLINE_KEY_RETURN2:
@@
-411,7
+413,7
@@
rdline_char_in(struct rdline *rdl, char c)
if (rdl->validate)
rdl->validate(rdl, rdl->left_buf, CIRBUF_GET_LEN(&rdl->left)+2);
if (rdl->validate)
rdl->validate(rdl, rdl->left_buf, CIRBUF_GET_LEN(&rdl->left)+2);
- return
1
;
+ return
RDLINE_RES_VALIDATED
;
#ifndef NO_RDLINE_HISTORY
case CMDLINE_KEY_UP_ARR:
#ifndef NO_RDLINE_HISTORY
case CMDLINE_KEY_UP_ARR:
@@
-457,23
+459,23
@@
rdline_char_in(struct rdline *rdl, char c)
break;
}
break;
}
- return
0
;
+ return
RDLINE_RES_SUCCESS
;
}
if (!isprint((int)c))
}
if (!isprint((int)c))
- return
0
;
+ return
RDLINE_RES_SUCCESS
;
/* standard chars */
if (CIRBUF_GET_LEN(&rdl->left) + CIRBUF_GET_LEN(&rdl->right) >= RDLINE_BUF_SIZE)
/* standard chars */
if (CIRBUF_GET_LEN(&rdl->left) + CIRBUF_GET_LEN(&rdl->right) >= RDLINE_BUF_SIZE)
- return
0
;
+ return
RDLINE_RES_SUCCESS
;
if (cirbuf_add_tail_safe(&rdl->left, c))
if (cirbuf_add_tail_safe(&rdl->left, c))
- return
0
;
+ return
RDLINE_RES_SUCCESS
;
rdl->write_char(rdl, c);
display_right_buffer(rdl);
rdl->write_char(rdl, c);
display_right_buffer(rdl);
- return
0
;
+ return
RDLINE_RES_SUCCESS
;
}
}
@@
-621,9
+623,9
@@
rdline_miniprintf(struct rdline *rdl, const char * buf, unsigned int val)
}
/* val is never more than 255 */
while (div) {
}
/* val is never more than 255 */
while (div) {
- c =
val / div
;
+ c =
(char)(val / div)
;
if (c || started) {
if (c || started) {
- rdl->write_char(rdl,
c+'0'
);
+ rdl->write_char(rdl,
(char)(c+'0')
);
started = 1;
}
val %= div;
started = 1;
}
val %= div;