aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-01-21 21:50:29 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-01-22 00:12:10 +0530
commita3dfeafa56e83f710026a6a790dd347e5fbc42fa (patch)
tree97f846e51c5da39ee751eaa573bd6e4810af4c35 /src
parent7eb376bcc47b0f448be18e09b3c228d72ea6a40e (diff)
downloadnnn-a3dfeafa56e83f710026a6a790dd347e5fbc42fa.tar.gz
Code reformat
Diffstat (limited to 'src')
-rw-r--r--src/nnn.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/nnn.c b/src/nnn.c
index 8ae25c8..b168b6c 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -458,7 +458,7 @@ static const char * const envs[] = {
/* Forward declarations */
static void redraw(char *path);
static void spawn(const char *file, const char *arg1, const char *arg2, const char *dir, uchar flag);
-int (*nftw_fn) (const char *fpath, const struct stat *sb, int typeflag, struct FTW *ftwbuf);
+static int (*nftw_fn) (const char *fpath, const struct stat *sb, int typeflag, struct FTW *ftwbuf);
/* Functions */
@@ -541,7 +541,7 @@ static int get_input(const char *prompt)
static char confirm_force()
{
- int r = get_input("use force? ('y/Y' confirms, else interactive)");
+ int r = get_input("use force? (y/Y)");
if (r == 'y' || r == 'Y')
return 'f'; /* forceful */
@@ -786,10 +786,11 @@ static bool appendfpath(const char *path, const size_t len)
/* Write selected file paths to fd, linefeed separated */
static ssize_t selectiontofd(int fd)
{
+ uint lastpos = copybufpos - 1;
char *pbuf = pcopybuf;
- ssize_t pos = 0, len, r, lastpos = copybufpos - 1;
+ ssize_t pos = 0, len, r;
- while (pos < copybufpos) {
+ while (pos <= lastpos) {
len = strlen(pbuf);
pos += len;
@@ -797,7 +798,7 @@ static ssize_t selectiontofd(int fd)
if (r != len)
return pos;
- if (pos != lastpos) {
+ if (pos <= lastpos) {
if (write(fd, "\n", 1) != 1)
return pos;
pbuf += pos + 1;
@@ -1185,7 +1186,6 @@ static int nextsel(int *presel)
#elif defined(BSD_KQUEUE)
static struct kevent event_data[NUM_EVENT_SLOTS];
#endif
-
c = *presel;
if (c == 0) {
@@ -1228,9 +1228,8 @@ static int nextsel(int *presel)
idle = 0;
for (i = 0; i < len; ++i)
- if (c == bindings[i].sym) {
+ if (c == bindings[i].sym)
return bindings[i].act;
- }
return 0;
}
@@ -3464,7 +3463,7 @@ nochange:
tmp = xreadline(NULL, "open with: ");
break;
case SEL_NEW:
- tmp = xreadline(NULL, "name/link suffix [@ for no suffix]: ");
+ tmp = xreadline(NULL, "name/link suffix [@ for none]: ");
break;
default: /* SEL_RENAME */
tmp = xreadline(dents[cur].name, "");