xaizek / vifm (License: GPLv2+) (since 2018-12-07)
Vifm is a file manager with curses interface, which provides Vi[m]-like environment for managing objects within file systems, extended with some useful ideas from mutt.
Commit dc1e0a43032b6e5e89086084d6dd00bca9717c2e

Prettify vifm.c:run_converter()
Mainly its Windows version.
Author: xaizek
Author date (UTC): 2014-04-21 11:16
Committer name: xaizek
Committer date (UTC): 2014-04-21 11:16
Parent(s): 48cb525b0fbade237f73d2370da3c23e2682f6ab
Signing key:
Tree: c24c87cad8c609e57a301314068db3223fadedda
File Lines added Lines deleted
src/vifm.c 15 14
File src/vifm.c changed (mode: 100644) (index e6a60737b..9aca4f77d)
... ... static int
567 567 run_converter(int vifm_like_mode) run_converter(int vifm_like_mode)
568 568 { {
569 569 #ifndef _WIN32 #ifndef _WIN32
570 char buf[PATH_MAX];
571 snprintf(buf, sizeof(buf), "vifmrc-converter %d", vifm_like_mode);
572 return shellout(buf, -1, 1);
570 char cmd[PATH_MAX];
571 snprintf(cmd, sizeof(cmd), "vifmrc-converter %d", vifm_like_mode);
572 return shellout(cmd, -1, 0);
573 573 #else #else
574 TCHAR buf[PATH_MAX + 2];
575 TCHAR *last_path_component;
574 char cmd[2*PATH_MAX];
576 575 int returned_exit_code; int returned_exit_code;
576 char *name_part;
577 577
578 if(GetModuleFileName(NULL, buf, ARRAY_LEN(buf)) == 0)
578 if(GetModuleFileName(NULL, cmd, PATH_MAX) == 0)
579 {
579 580 return -1; return -1;
581 }
580 582
581 /* Remove last path component. */
582 last_path_component = _tcsrchr(buf, _T('\\')) + 1;
583 *last_path_component = _T('\0');
584
583 /* Override last path component. */
584 name_part = strrchr(cmd, '\\');
585 name_part = (name_part == NULL) ? cmd : (name_part + 1);
585 586 switch(vifm_like_mode) switch(vifm_like_mode)
586 587 { {
587 588 case 2: case 2:
588 _tcscat(buf, _T("vifmrc-converter 2"));
589 strcpy(name_part, "vifmrc-converter 2");
589 590 break; break;
590 591 case 1: case 1:
591 _tcscat(buf, _T("vifmrc-converter 1"));
592 strcpy(name_part, "vifmrc-converter 1");
592 593 break; break;
593 594
594 595 default: default:
595 _tcscat(buf, _T("vifmrc-converter 0"));
596 strcpy(name_part, "vifmrc-converter 0");
596 597 break; break;
597 598 } }
598 599
599 return win_exec_cmd(buf, &returned_exit_code);
600 return win_exec_cmd(cmd, &returned_exit_code);
600 601 #endif #endif
601 602 } }
602 603
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vifm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vifm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master