aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
Diffstat (limited to 'editors')
-rw-r--r--editors/vi.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/editors/vi.c b/editors/vi.c
index 863735e31..853303249 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -260,7 +260,9 @@ static void crash_dummy();
260static void crash_test(); 260static void crash_test();
261static int crashme = 0; 261static int crashme = 0;
262#endif 262#endif
263#if ENABLE_FEATURE_VI_COLON
263static char *initial_cmds[] = { NULL, NULL , NULL }; // currently 2 entries, NULL terminated 264static char *initial_cmds[] = { NULL, NULL , NULL }; // currently 2 entries, NULL terminated
265#endif
264 266
265 267
266static void write1(const char *out) 268static void write1(const char *out)
@@ -307,12 +309,14 @@ int vi_main(int argc, char **argv)
307 // 1- process $HOME/.exrc file (not inplemented yet) 309 // 1- process $HOME/.exrc file (not inplemented yet)
308 // 2- process EXINIT variable from environment 310 // 2- process EXINIT variable from environment
309 // 3- process command line args 311 // 3- process command line args
312#if ENABLE_FEATURE_VI_COLON
310 { 313 {
311 char *p = getenv("EXINIT"); 314 char *p = getenv("EXINIT");
312 if (p && *p) 315 if (p && *p)
313 initial_cmds[0] = xstrdup(p); 316 initial_cmds[0] = xstrdup(p);
314 } 317 }
315 while ((c = getopt(argc, argv, "hCRc:")) != -1) { 318#endif
319 while ((c = getopt(argc, argv, "hCR" USE_FEATURE_VI_COLON("c:"))) != -1) {
316 switch (c) { 320 switch (c) {
317#if ENABLE_FEATURE_VI_CRASHME 321#if ENABLE_FEATURE_VI_CRASHME
318 case 'C': 322 case 'C':
@@ -328,11 +332,13 @@ int vi_main(int argc, char **argv)
328 //case 'r': // recover flag- ignore- we don't use tmp file 332 //case 'r': // recover flag- ignore- we don't use tmp file
329 //case 'x': // encryption flag- ignore 333 //case 'x': // encryption flag- ignore
330 //case 'c': // execute command first 334 //case 'c': // execute command first
335#if ENABLE_FEATURE_VI_COLON
331 case 'c': // cmd line vi command 336 case 'c': // cmd line vi command
332 if (*optarg) 337 if (*optarg)
333 initial_cmds[initial_cmds[0] != 0] = xstrdup(optarg); 338 initial_cmds[initial_cmds[0] != 0] = xstrdup(optarg);
334 break; 339 break;
335 //case 'h': // help -- just use default 340 //case 'h': // help -- just use default
341#endif
336 default: 342 default:
337 show_help(); 343 show_help();
338 return 1; 344 return 1;
@@ -431,6 +437,7 @@ static void edit_file(char * fn)
431 redraw(FALSE); // dont force every col re-draw 437 redraw(FALSE); // dont force every col re-draw
432 show_status_line(); 438 show_status_line();
433 439
440#if ENABLE_FEATURE_VI_COLON
434 { 441 {
435 char *p, *q; 442 char *p, *q;
436 int n = 0; 443 int n = 0;
@@ -450,6 +457,7 @@ static void edit_file(char * fn)
450 n++; 457 n++;
451 } 458 }
452 } 459 }
460#endif
453 //------This is the main Vi cmd handling loop ----------------------- 461 //------This is the main Vi cmd handling loop -----------------------
454 while (editing > 0) { 462 while (editing > 0) {
455#if ENABLE_FEATURE_VI_CRASHME 463#if ENABLE_FEATURE_VI_CRASHME
@@ -938,7 +946,9 @@ static void colon(char * buf)
938 } 946 }
939#if ENABLE_FEATURE_VI_SET 947#if ENABLE_FEATURE_VI_SET
940 } else if (strncasecmp(cmd, "set", i) == 0) { // set or clear features 948 } else if (strncasecmp(cmd, "set", i) == 0) { // set or clear features
949#if ENABLE_FEATURE_VI_SETOPTS
941 char *argp; 950 char *argp;
951#endif
942 i = 0; // offset into args 952 i = 0; // offset into args
943 // only blank is regarded as args delmiter. What about tab '\t' ? 953 // only blank is regarded as args delmiter. What about tab '\t' ?
944 if (!args[0] || strcasecmp(args, "all") == 0) { 954 if (!args[0] || strcasecmp(args, "all") == 0) {