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 298327059a7fc8301a1e48b405fbdbc4632fcc68

Fix segfault when vifmrc is truncated.
Author: xaizek
Author date (UTC): 2011-07-20 19:31
Committer name: xaizek
Committer date (UTC): 2011-07-20 19:31
Parent(s): 446be6d5b47f53669c6e99678d4db9bfe3dff902
Signing key:
Tree: 2727949dc96207031b8a97aabf4ffcdfe4a8f03c
File Lines added Lines deleted
src/config.c 21 21
File src/config.c changed (mode: 100644) (index 6eae071a7..c7a46ac97)
... ... init_config(void)
76 76 cfg.follow_links = 1; cfg.follow_links = 1;
77 77 cfg.fast_run = 0; cfg.fast_run = 0;
78 78 cfg.confirm = 1; cfg.confirm = 1;
79 cfg.vi_command = strdup("vim");
80 cfg.use_trash = 1;
81 cfg.fuse_home = strdup("/tmp/vifm_FUSE");
82 cfg.use_screen = 0;
83 cfg.history_len = 15;
84 cfg.use_vim_help = 0;
79 85
80 86 /* Maximum argument length to pass to the shell */ /* Maximum argument length to pass to the shell */
81 87 if((cfg.max_args = sysconf(_SC_ARG_MAX)) == 0) if((cfg.max_args = sysconf(_SC_ARG_MAX)) == 0)
 
... ... create_startup_file(void)
112 118 file_exec(command); file_exec(command);
113 119 } }
114 120
115 static void
116 load_view_defaults(FileView *view)
117 {
118 strncpy(view->regexp, "\\..~$", sizeof(view->regexp) - 1);
119
120 view->filename_filter = strdup("");
121 view->prev_filter = strdup("");
122 view->invert = TRUE;
123
124 view->sort_type = SORT_BY_NAME;
125 }
126
127 121 /* This is just a safety check so that vifm will still load and run if /* This is just a safety check so that vifm will still load and run if
128 122 * the configuration file is not present. * the configuration file is not present.
129 123 */ */
 
... ... static void
131 125 load_default_configuration(void) load_default_configuration(void)
132 126 { {
133 127 cfg.using_default_config = 1; cfg.using_default_config = 1;
134 cfg.use_trash = 1;
135 cfg.vi_command = strdup("vim");
136 cfg.fuse_home = strdup("/tmp/vifm_FUSE");
137 cfg.use_screen = 0;
138 cfg.history_len = 15;
139 cfg.use_vim_help = 0;
140
141 load_view_defaults(&lwin);
142 load_view_defaults(&rwin);
143 128
144 129 read_color_scheme_file(); read_color_scheme_file();
145 130 } }
 
... ... set_config_dir(void)
185 170 } }
186 171 } }
187 172
173 static void
174 load_view_defaults(FileView *view)
175 {
176 strncpy(view->regexp, "\\..~$", sizeof(view->regexp) - 1);
177
178 view->filename_filter = strdup("");
179 view->prev_filter = strdup("");
180 view->invert = TRUE;
181
182 view->sort_type = SORT_BY_NAME;
183 }
184
188 185 /* Returns zero when default configuration is used */ /* Returns zero when default configuration is used */
189 186 int int
190 187 read_config_file(void) read_config_file(void)
 
... ... read_config_file(void)
202 199
203 200 snprintf(config_file, sizeof(config_file), "%s/vifmrc", cfg.config_dir); snprintf(config_file, sizeof(config_file), "%s/vifmrc", cfg.config_dir);
204 201
202 load_view_defaults(&lwin);
203 load_view_defaults(&rwin);
204
205 205 if((fp = fopen(config_file, "r")) == NULL) if((fp = fopen(config_file, "r")) == NULL)
206 206 { {
207 207 fprintf(stdout, "Unable to find configuration file.\n Using defaults."); fprintf(stdout, "Unable to find configuration file.\n Using defaults.");
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