Fix checkpatch reports

This commit is contained in:
Arun Prakash Jana 2017-12-28 01:47:44 +05:30
parent 2c50c92b3d
commit 9b010b1c03

78
nnn.c
View file

@ -1094,7 +1094,8 @@ xreadline(char *fname)
} }
buf[len] = '\0'; buf[len] = '\0';
if (old_curs != ERR) curs_set(old_curs); if (old_curs != ERR)
curs_set(old_curs);
settimeout(); settimeout();
DPRINTF_S(buf); DPRINTF_S(buf);
@ -1191,6 +1192,7 @@ get_bm_loc(char *key, char *buf)
if (xstrcmp(bookmark[r].key, key) == 0) { if (xstrcmp(bookmark[r].key, key) == 0) {
if (bookmark[r].loc[0] == '~') { if (bookmark[r].loc[0] == '~') {
char *home = getenv("HOME"); char *home = getenv("HOME");
if (!home) { if (!home) {
DPRINTF_S(STR_NOHOME); DPRINTF_S(STR_NOHOME);
return NULL; return NULL;
@ -1270,6 +1272,7 @@ coolsize(off_t size)
static char size_buf[12]; /* Buffer to hold human readable size */ static char size_buf[12]; /* Buffer to hold human readable size */
static int i; static int i;
static off_t tmp; static off_t tmp;
static long double rem; static long double rem;
static const double div_2_pow_10 = 1.0 / 1024.0; static const double div_2_pow_10 = 1.0 / 1024.0;
@ -1677,8 +1680,8 @@ show_help(char *path)
int i = 0, fd = mkstemp(tmp); int i = 0, fd = mkstemp(tmp);
char *start, *end; char *start, *end;
static char helpstr[] = ( static char helpstr[] = (
"cKey | Function\n" "cKey | Function\n"
"e- + -\n" "e- + -\n"
"7↑, k, ^P | Previous entry\n" "7↑, k, ^P | Previous entry\n"
"7↓, j, ^N | Next entry\n" "7↓, j, ^N | Next entry\n"
"7PgUp, ^U | Scroll half page up\n" "7PgUp, ^U | Scroll half page up\n"
@ -1687,38 +1690,38 @@ show_help(char *path)
"2End, G, $, ^E | Last entry\n" "2End, G, $, ^E | Last entry\n"
"4→, ↵, l, ^M | Open file or enter dir\n" "4→, ↵, l, ^M | Open file or enter dir\n"
"1←, Bksp, h, ^H | Go to parent dir\n" "1←, Bksp, h, ^H | Go to parent dir\n"
"d^O | Open with...\n" "d^O | Open with...\n"
"9Insert | Toggle navigate-as-you-type\n" "9Insert | Toggle navigate-as-you-type\n"
"e~ | Go HOME\n" "e~ | Go HOME\n"
"e& | Go to initial dir\n" "e& | Go to initial dir\n"
"e- | Go to last visited dir\n" "e- | Go to last visited dir\n"
"e/ | Filter dir contents\n" "e/ | Filter dir contents\n"
"d^/ | Open desktop search tool\n" "d^/ | Open desktop search tool\n"
"e. | Toggle hide . files\n" "e. | Toggle hide . files\n"
"eb | Bookmark prompt\n" "eb | Bookmark prompt\n"
"d^B | Pin current dir\n" "d^B | Pin current dir\n"
"d^V | Go to pinned dir\n" "d^V | Go to pinned dir\n"
"ec | Change dir prompt\n" "ec | Change dir prompt\n"
"ed | Toggle detail view\n" "ed | Toggle detail view\n"
"eD | File details\n" "eD | File details\n"
"em | Brief media info\n" "em | Brief media info\n"
"eM | Full media info\n" "eM | Full media info\n"
"en | Create new\n" "en | Create new\n"
"d^R | Rename entry\n" "d^R | Rename entry\n"
"es | Toggle sort by size\n" "es | Toggle sort by size\n"
"eS | Toggle du mode\n" "eS | Toggle du mode\n"
"et | Toggle sort by mtime\n" "et | Toggle sort by mtime\n"
"e! | Spawn SHELL in dir\n" "e! | Spawn SHELL in dir\n"
"ee | Edit entry in EDITOR\n" "ee | Edit entry in EDITOR\n"
"eo | Open dir in file manager\n" "eo | Open dir in file manager\n"
"ep | Open entry in PAGER\n" "ep | Open entry in PAGER\n"
"eF | List archive\n" "eF | List archive\n"
"d^X | Extract archive\n" "d^X | Extract archive\n"
"d^K | Invoke file path copier\n" "d^K | Invoke file path copier\n"
"d^L | Redraw, clear prompt\n" "d^L | Redraw, clear prompt\n"
"e? | Help, settings\n" "e? | Help, settings\n"
"eQ | Quit and cd\n" "eQ | Quit and cd\n"
"aq, ^Q | Quit\n\n"); "aq, ^Q | Quit\n\n");
if (fd == -1) if (fd == -1)
return -1; return -1;
@ -1993,6 +1996,7 @@ populate(char *path, char *oldname, char *fltr)
#ifdef DEBUGMODE #ifdef DEBUGMODE
struct timespec ts1, ts2; struct timespec ts1, ts2;
clock_gettime(CLOCK_REALTIME, &ts1); /* Use CLOCK_MONOTONIC on FreeBSD */ clock_gettime(CLOCK_REALTIME, &ts1); /* Use CLOCK_MONOTONIC on FreeBSD */
#endif #endif
@ -2741,10 +2745,10 @@ nochange:
r = getch(); r = getch();
settimeout(); settimeout();
if (r == 'f') { if (r == 'f') {
r = openat(fd, tmp, O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); r = openat(fd, tmp, O_CREAT, 0666);
close(r); close(r);
} else if (r == 'd') } else if (r == 'd')
r = mkdirat(fd, tmp, S_IRWXU | S_IRWXG | S_IRWXO); r = mkdirat(fd, tmp, 0777);
else { else {
close(fd); close(fd);
break; break;