mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-06 03:20:26 +00:00
ncdirect: don't make infd nonblocking #919
This commit is contained in:
parent
d3e23697af
commit
201994ab0c
@ -844,9 +844,6 @@ int cbreak_mode(int ttyfd, struct termios* tpreserved){
|
||||
int ncinputlayer_init(ncinputlayer* nilayer, FILE* infp){
|
||||
nilayer->inputescapes = NULL;
|
||||
nilayer->ttyinfp = infp;
|
||||
if(make_nonblocking(nilayer->ttyinfp)){
|
||||
return -1;
|
||||
}
|
||||
if(prep_special_keys(nilayer)){
|
||||
return -1;
|
||||
}
|
||||
@ -960,6 +957,9 @@ notcurses* notcurses_init(const notcurses_options* opts, FILE* outfp){
|
||||
if(ncinputlayer_init(&ret->input, stdin)){
|
||||
goto err;
|
||||
}
|
||||
if(make_nonblocking(ret->input.ttyinfp)){
|
||||
return -1;
|
||||
}
|
||||
// Neither of these is supported on e.g. the "linux" virtual console.
|
||||
if(!(opts->flags & NCOPTION_NO_ALTERNATE_SCREEN)){
|
||||
terminfostr(&ret->tcache.smcup, "smcup");
|
||||
|
@ -15,7 +15,9 @@ print_b(struct ncdirect* nc, int r, int g, int total){
|
||||
if(ret){
|
||||
return -1;
|
||||
}
|
||||
printf("X");
|
||||
if(printf("X") < 0){
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -32,10 +34,14 @@ print_gb(struct ncdirect* nc, int r, int total){
|
||||
static int
|
||||
print_rgb(struct ncdirect* nc, int total){
|
||||
if(random() % 2){
|
||||
ncdirect_styles_off(nc, NCSTYLE_ITALIC);
|
||||
if(ncdirect_styles_off(nc, NCSTYLE_ITALIC)){
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if(random() % 16 == 0){
|
||||
ncdirect_styles_on(nc, NCSTYLE_ITALIC);
|
||||
if(ncdirect_styles_on(nc, NCSTYLE_ITALIC)){
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
for(int r = 0 ; r <= total && r < 256 ; r += 4){
|
||||
if(print_gb(nc, r, total)){
|
||||
@ -114,6 +120,7 @@ int main(void){
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
err:
|
||||
fprintf(stderr, "WE HAD A BAD ERROR YO (%s)\n", strerror(errno));
|
||||
ncdirect_stop(nc);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user