Introduction
Introduction Statistics Contact Development Disclaimer Help
Simplified character input processing. - sam - An updated version of the sam te…
git clone git://vernunftzentrum.de/sam.git
Log
Files
Refs
LICENSE
---
commit ab21252fbf883e2f6fd0f8293ea109839f37728c
parent 9c1beacd363c68e2a85a9ebc94e28ace320958fa
Author: Rob King <[email protected]>
Date: Thu, 20 Oct 2016 16:44:38 -0500
Simplified character input processing.
Diffstat:
sam/cmd.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
---
diff --git a/sam/cmd.c b/sam/cmd.c
@@ -86,12 +86,9 @@ resetcmd(void)
int
inputc(void)
{
- int n, nbuf;
- char buf[3] = {0};
wchar_t r = 0;
Again:
- nbuf = 0;
if(downloaded){
while(termoutp == terminp){
cmdupdate();
@@ -107,20 +104,14 @@ inputc(void)
r = *termoutp++;
if(termoutp == terminp)
terminp = termoutp = termline;
- }else{
- do{
- n = read(STDIN_FILENO, buf+nbuf, 1);
- if(n <= 0)
- return -1;
- nbuf += n;
- }while(!fullrune(buf, nbuf));
- if (mbtowc(&r, buf, strlen(buf)) < 0)
+ } else if (fscanf(stdin, "%lc", &r) != 1)
r = UNICODE_REPLACEMENT_CHAR;
- }
+
if(r == 0){
warn(Wnulls);
goto Again;
}
+
return r;
}
You are viewing proxied material from vernunftzentrum.de. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.