mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 05:41:31 +00:00
Rework messages and errno warnings
This commit is contained in:
parent
a543eed112
commit
9acdb3332b
20
noice.c
20
noice.c
|
@ -109,13 +109,19 @@ exitcurses(void)
|
||||||
endwin(); /* Restore terminal */
|
endwin(); /* Restore terminal */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Messages show up at the bottom */
|
||||||
/* Warning shows up at the bottom */
|
|
||||||
void
|
void
|
||||||
printwarn(char *prefix)
|
printmsg(char *msg)
|
||||||
{
|
{
|
||||||
move(LINES - 1, 0);
|
move(LINES - 1, 0);
|
||||||
printw("%s: %s\n", prefix, strerror(errno));
|
printw("%s\n", msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Display warning as a message */
|
||||||
|
void
|
||||||
|
printwarn(void)
|
||||||
|
{
|
||||||
|
printmsg(strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Kill curses and display error before exiting */
|
/* Kill curses and display error before exiting */
|
||||||
|
@ -218,7 +224,7 @@ begin:
|
||||||
|
|
||||||
dirp = opendir(path);
|
dirp = opendir(path);
|
||||||
if (dirp == NULL) {
|
if (dirp == NULL) {
|
||||||
printwarn("opendir");
|
printwarn();
|
||||||
goto nochange;
|
goto nochange;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,7 +350,7 @@ nochange:
|
||||||
path = newpath;
|
path = newpath;
|
||||||
goto out;
|
goto out;
|
||||||
} else {
|
} else {
|
||||||
printwarn(newpath);
|
printwarn();
|
||||||
free(newpath);
|
free(newpath);
|
||||||
goto nochange;
|
goto nochange;
|
||||||
}
|
}
|
||||||
|
@ -357,7 +363,7 @@ nochange:
|
||||||
/* Open with */
|
/* Open with */
|
||||||
bin = openwith(name);
|
bin = openwith(name);
|
||||||
if (bin == NULL) {
|
if (bin == NULL) {
|
||||||
printwarn("no association\n");
|
printmsg("No association");
|
||||||
goto nochange;
|
goto nochange;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue