aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2018-12-06 21:45:29 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2018-12-06 21:45:29 +0530
commit82a58800d3e78d5c0ac19ff874e815cbec5319e9 (patch)
treeedf6bc84c67f22364566cc4031df8aa8d43ff232
parentabfdc76e43d896a70f00855a1efc6a1b6527b140 (diff)
downloadnnn-82a58800d3e78d5c0ac19ff874e815cbec5319e9.tar.gz
Refactor code
-rw-r--r--src/nnn.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/nnn.c b/src/nnn.c
index 53186b3..812f2ae 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -2923,28 +2923,32 @@ nochange:
case SEL_EXTRACT: // fallthrough
case SEL_MEDIA: // fallthrough
case SEL_FMEDIA:
+ {
if (!ndents)
break;
mkpath(path, dents[cur].name, newpath, PATH_MAX);
- if (sel == SEL_MEDIA)
+ switch(sel) {
+ case SEL_MEDIA:
r = show_mediainfo(newpath, NULL);
- else if (sel == SEL_FMEDIA)
+ break;
+ case SEL_FMEDIA:
r = show_mediainfo(newpath, "-f");
- else if (sel == SEL_LIST)
+ break;
+ case SEL_LIST:
r = handle_archive(newpath, "-l", path);
- else
+ break;
+ case SEL_EXTRACT:
r = handle_archive(newpath, "-x", path);
+ break;
+ default:
+ r = 0;
+ break;
+ }
if (r == -1) {
- xstrlcpy(newpath, "missing ", PATH_MAX);
- if (sel == SEL_MEDIA || sel == SEL_FMEDIA)
- xstrlcpy(newpath + 8, utils[cfg.metaviewer], 32);
- else
- xstrlcpy(newpath + 8, utils[ATOOL], 32);
-
- printmsg(newpath);
+ printmsg("utility missing");
goto nochange;
}
@@ -2961,6 +2965,7 @@ nochange:
goto begin;
}
break;
+ }
case SEL_FSIZE:
cfg.sizeorder ^= 1;
cfg.mtimeorder = 0;