git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* Make the ksym table built-in with kernel image, thus remove the need
[lunaix-os.git]
/
lunaix-os
/
hal
/
term
/
lcntls
/
lcntl.c
diff --git
a/lunaix-os/hal/term/lcntls/lcntl.c
b/lunaix-os/hal/term/lcntls/lcntl.c
index 08023183ecab1f637d704e7d66e09a62662367c2..db146e1d84de8f915469dd184a658e47d2276ccf 100644
(file)
--- a/
lunaix-os/hal/term/lcntls/lcntl.c
+++ b/
lunaix-os/hal/term/lcntls/lcntl.c
@@
-17,7
+17,7
@@
static inline void
raise_sig(struct term* at_term, struct linebuffer* lbuf, int sig)
{
static inline void
raise_sig(struct term* at_term, struct linebuffer* lbuf, int sig)
{
- term_sendsig(at_term,
SIGINT
);
+ term_sendsig(at_term,
sig
);
lbuf->sflags |= LSTATE_SIGRAISE;
}
lbuf->sflags |= LSTATE_SIGRAISE;
}
@@
-44,6
+44,13
@@
lcntl_transform_seq(struct term* tdev, struct linebuffer* lbuf, bool out)
#define QUIT tdev->cc[_VQUIT]
#define SUSP tdev->cc[_VSUSP]
#define QUIT tdev->cc[_VQUIT]
#define SUSP tdev->cc[_VSUSP]
+#define putc_safe(rb, chr) \
+ ({ \
+ if (!rbuffer_put_nof(rb, chr)) { \
+ break; \
+ } \
+ })
+
if (!out) {
// Keep all cc's (except VMIN & VTIME) up to L2 cache.
for (size_t i = 0; i < _VMIN; i++) {
if (!out) {
// Keep all cc's (except VMIN & VTIME) up to L2 cache.
for (size_t i = 0; i < _VMIN; i++) {
@@
-51,7
+58,7
@@
lcntl_transform_seq(struct term* tdev, struct linebuffer* lbuf, bool out)
}
}
}
}
- while (
rbuffer_get(raw, &c) && allow_more
) {
+ while (
allow_more && rbuffer_get(raw, &c)
) {
if (c == '\r' && ((_if & _ICRNL) || (_of & _OCRNL))) {
c = '\n';
if (c == '\r' && ((_if & _ICRNL) || (_of & _OCRNL))) {
c = '\n';
@@
-136,14
+143,14
@@
lcntl_transform_seq(struct term* tdev, struct linebuffer* lbuf, bool out)
do_out:
if (c == '\n' && (_of & _ONLCR)) {
do_out:
if (c == '\n' && (_of & _ONLCR)) {
-
rbuffer_put
(cooked, '\r');
+
putc_safe
(cooked, '\r');
}
put_char:
if (!out && (_lf & _IEXTEN) && lcntl_slave_put) {
allow_more = lcntl_slave_put(tdev, lbuf, c);
} else {
}
put_char:
if (!out && (_lf & _IEXTEN) && lcntl_slave_put) {
allow_more = lcntl_slave_put(tdev, lbuf, c);
} else {
- allow_more = rbuffer_put(cooked, c);
+ allow_more = rbuffer_put
_nof
(cooked, c);
}
}
}
}