Skip to content

Commit

Permalink
Fix conversions between char and int
Browse files Browse the repository at this point in the history
  • Loading branch information
mortie committed Apr 11, 2023
1 parent 93b2db9 commit ef561ce
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions linenoise.c
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,7 @@ char *linenoiseEditFeed(struct linenoiseState *l) {

char c;
int nread;
int ret;
char seq[3];

nread = read(l->ifd,&c,1);
Expand All @@ -940,11 +941,12 @@ char *linenoiseEditFeed(struct linenoiseState *l) {
* there was an error reading from fd. Otherwise it will return the
* character that should be handled next. */
if ((l->in_completion || c == 9) && completionCallback != NULL) {
c = completeLine(l,c);
ret = completeLine(l,(unsigned char)c);
/* Return on errors */
if (c < 0) return NULL;
if (ret < 0) return NULL;
/* Read next character when 0 */
if (c == 0) return linenoiseEditMore;
if (ret == 0) return linenoiseEditMore;
c = (char)ret;
}

switch(c) {
Expand Down

0 comments on commit ef561ce

Please sign in to comment.