diff options
author | 2017-09-02 14:09:34 +0530 | |
---|---|---|
committer | 2017-09-02 14:09:34 +0530 | |
commit | c35c1afa875eac047c28ba5a192b3bc42fc8fb34 (patch) | |
tree | 28a447f12735dc580b11ca196ac132d98cc51da2 | |
parent | 056a79635ab90e0faf94389d7ef6edf56934823f (diff) | |
download | nnn-c35c1afa875eac047c28ba5a192b3bc42fc8fb34.tar.gz |
Reorder APIs
-rw-r--r-- | nnn.c | 76 |
1 files changed, 38 insertions, 38 deletions
@@ -1087,6 +1087,20 @@ xreadline(char *fname) return g_buf; } +static char * +readinput(void) +{ + cleartimeout(); + echo(); + curs_set(TRUE); + memset(g_buf, 0, LINE_MAX); + wgetnstr(stdscr, g_buf, LINE_MAX - 1); + noecho(); + curs_set(FALSE); + settimeout(); + return g_buf[0] ? g_buf : NULL; +} + /* * Returns "dir/name or "/name" */ @@ -1144,20 +1158,6 @@ parsebmstr(char *bms) } } -static char * -readinput(void) -{ - cleartimeout(); - echo(); - curs_set(TRUE); - memset(g_buf, 0, LINE_MAX); - wgetnstr(stdscr, g_buf, LINE_MAX - 1); - noecho(); - curs_set(FALSE); - settimeout(); - return g_buf[0] ? g_buf : NULL; -} - static void resetdircolor(mode_t mode) { @@ -1204,30 +1204,6 @@ unescape(const char *str, uint maxcols) return buffer; } -static void -printent(struct entry *ent, int sel, uint namecols) -{ - static char *pname; - - pname = unescape(ent->name, namecols); - - /* Directories are always shown on top */ - resetdircolor(ent->mode); - - if (S_ISDIR(ent->mode)) - printw("%s%s/\n", CURSYM(sel), pname); - else if (S_ISLNK(ent->mode)) - printw("%s%s@\n", CURSYM(sel), pname); - else if (S_ISSOCK(ent->mode)) - printw("%s%s=\n", CURSYM(sel), pname); - else if (S_ISFIFO(ent->mode)) - printw("%s%s|\n", CURSYM(sel), pname); - else if (ent->mode & 0100) - printw("%s%s*\n", CURSYM(sel), pname); - else - printw("%s%s\n", CURSYM(sel), pname); -} - static char * coolsize(off_t size) { @@ -1253,6 +1229,30 @@ coolsize(off_t size) } static void +printent(struct entry *ent, int sel, uint namecols) +{ + static char *pname; + + pname = unescape(ent->name, namecols); + + /* Directories are always shown on top */ + resetdircolor(ent->mode); + + if (S_ISDIR(ent->mode)) + printw("%s%s/\n", CURSYM(sel), pname); + else if (S_ISLNK(ent->mode)) + printw("%s%s@\n", CURSYM(sel), pname); + else if (S_ISSOCK(ent->mode)) + printw("%s%s=\n", CURSYM(sel), pname); + else if (S_ISFIFO(ent->mode)) + printw("%s%s|\n", CURSYM(sel), pname); + else if (ent->mode & 0100) + printw("%s%s*\n", CURSYM(sel), pname); + else + printw("%s%s\n", CURSYM(sel), pname); +} + +static void printent_long(struct entry *ent, int sel, uint namecols) { static char buf[18], *pname; |