static void show_status_line(void); // put a message on the bottom line
static void status_line(const char *, ...); // print to status buf
static void status_line_bold(const char *, ...);
+static void status_line_bold_errno(const char *fn);
static void not_implemented(const char *); // display "Not implemented" message
static int format_edit_status(void); // format file status on status line
static void redraw(int); // force a full screen refresh
}
if (l < 0) {
if (l == -1)
- status_line_bold("'%s' %s", fn, strerror(errno));
+ status_line_bold_errno(fn);
} else {
status_line("'%s' %dL, %dC", fn, li, l);
if (q == text && r == end - 1 && l == ch) {
/* Validate file */
if (stat(fn, &statbuf) < 0) {
- status_line_bold("'%s' %s", fn, strerror(errno));
+ status_line_bold_errno(fn);
goto fi0;
}
if (!S_ISREG(statbuf.st_mode)) {
// read file to buffer
fd = open(fn, O_RDONLY);
if (fd < 0) {
- status_line_bold("'%s' %s", fn, strerror(errno));
+ status_line_bold_errno(fn);
goto fi0;
}
size = (statbuf.st_size < INT_MAX ? (int)statbuf.st_size : INT_MAX);
p += text_hole_make(p, size);
cnt = safe_read(fd, p, size);
if (cnt < 0) {
- status_line_bold("'%s' %s", fn, strerror(errno));
+ status_line_bold_errno(fn);
p = text_hole_delete(p, p + size - 1); // un-do buffer insert
} else if (cnt < size) {
// There was a partial read, shrink unused space text[]
have_status_msg = 1 + sizeof(ESC_BOLD_TEXT) + sizeof(ESC_NORM_TEXT) - 2;
}
+static void status_line_bold_errno(const char *fn)
+{
+ status_line_bold("'%s' %s", fn, strerror(errno));
+}
+
// format status buffer
static void status_line(const char *format, ...)
{