]> Sergey Matveev's repositories - nnn.git/commitdiff
Refactor code
authorArun Prakash Jana <engineerarun@gmail.com>
Thu, 6 Dec 2018 16:15:29 +0000 (21:45 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Thu, 6 Dec 2018 16:15:29 +0000 (21:45 +0530)
src/nnn.c

index 53186b3b12a324d761831509ef4d003e345b779a..812f2aef58a92e9f04de46f86aec35372dc97a22 100644 (file)
--- 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;