Also, don't define _XOPEN_SOURCE if already defined
Signed-off-by: Steve Bennett <steveb@workware.net.au>
int cols; /* Size of the window, in chars */
};
int cols; /* Size of the window, in chars */
};
+/* gcc/glibc insists that we care about the return code of write! */
+#define IGNORE_RC(EXPR) ((EXPR) < 0 ? -1 : 0)
+
/* This is fd_printf() on some systems, but use a different
* name to avoid conflicts
*/
/* This is fd_printf() on some systems, but use a different
* name to avoid conflicts
*/
va_start(args, format);
n = vsnprintf(buf, sizeof(buf), format, args);
va_end(args);
va_start(args, format);
n = vsnprintf(buf, sizeof(buf), format, args);
va_end(args);
+ IGNORE_RC(write(fd, buf, n));
}
static int utf8_getchars(char *buf, int c)
}
static int utf8_getchars(char *buf, int c)
if (pos >= 0 && pos < current->chars) {
int c;
int i = utf8_index(current->buf, pos);
if (pos >= 0 && pos < current->chars) {
int c;
int i = utf8_index(current->buf, pos);
- utf8_tounicode(current->buf + i, &c);
+ (void)utf8_tounicode(current->buf + i, &c);
/* Cursor to left edge, then the prompt */
fd_printf(current->fd, "\x1b[0G");
/* Cursor to left edge, then the prompt */
fd_printf(current->fd, "\x1b[0G");
- write(current->fd, prompt, plen);
+ IGNORE_RC(write(current->fd, prompt, plen));
/* Now the current buffer content */
/* Now the current buffer content */
}
if (ch < ' ') {
/* A control character, so write the buffer so far */
}
if (ch < ' ') {
/* A control character, so write the buffer so far */
- write(current->fd, buf, b);
+ IGNORE_RC(write(current->fd, buf, b));
buf += b + w;
b = 0;
fd_printf(current->fd, "\033[7m^%c\033[0m", ch + '@');
buf += b + w;
b = 0;
fd_printf(current->fd, "\033[7m^%c\033[0m", ch + '@');
- write(current->fd, buf, b);
+ IGNORE_RC(write(current->fd, buf, b));
/* Erase to right, move cursor to original position */
fd_printf(current->fd, "\x1b[0K" "\x1b[0G\x1b[%dC", pos + pchars + backup);
/* Erase to right, move cursor to original position */
fd_printf(current->fd, "\x1b[0K" "\x1b[0G\x1b[%dC", pos + pchars + backup);