summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Fox2008-03-06 16:26:12 +0000
committerPaul Fox2008-03-06 16:26:12 +0000
commit35e9c5d83ada1fea40798365a1b4c728f64ded98 (patch)
treebaf13f0fc18eafa19eb1f394310c3dd0be70e76b
parentc51fc7bed6d6555997fdfb3879f42c6b1191465c (diff)
downloadbusybox-35e9c5d83ada1fea40798365a1b4c728f64ded98.zip
busybox-35e9c5d83ada1fea40798365a1b4c728f64ded98.tar.gz
fixups to vi usage, and move the initial redraw() past the
execution of commands supplied by -c or EXINIT, so their effect is displayed correctly.
-rw-r--r--editors/vi.c16
-rw-r--r--include/usage.h6
2 files changed, 14 insertions, 8 deletions
diff --git a/editors/vi.c b/editors/vi.c
index d9db943..572e049 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -23,6 +23,7 @@
#include "libbb.h"
+/* the CRASHME code is unmaintained, and doesn't currently build */
#define ENABLE_FEATURE_VI_CRASHME 0
@@ -395,7 +396,7 @@ int vi_main(int argc, char **argv)
initial_cmds[0] = xstrndup(p, MAX_INPUT_LEN);
}
#endif
- while ((c = getopt(argc, argv, "hCR" USE_FEATURE_VI_COLON("c:"))) != -1) {
+ while ((c = getopt(argc, argv, "hCRH" USE_FEATURE_VI_COLON("c:"))) != -1) {
switch (c) {
#if ENABLE_FEATURE_VI_CRASHME
case 'C':
@@ -407,18 +408,18 @@ int vi_main(int argc, char **argv)
SET_READONLY_MODE(readonly_mode);
break;
#endif
- //case 'r': // recover flag- ignore- we don't use tmp file
- //case 'x': // encryption flag- ignore
- //case 'c': // execute command first
#if ENABLE_FEATURE_VI_COLON
case 'c': // cmd line vi command
if (*optarg)
initial_cmds[initial_cmds[0] != 0] = xstrndup(optarg, MAX_INPUT_LEN);
break;
- //case 'h': // help -- just use default
#endif
- default:
+ case 'H':
show_help();
+ /* fall through */
+
+ default:
+ bb_show_usage();
return 1;
}
}
@@ -532,7 +533,6 @@ static void edit_file(char *fn)
lmc_len = 0;
adding2q = 0;
#endif
- redraw(FALSE); // dont force every col re-draw
#if ENABLE_FEATURE_VI_COLON
{
@@ -555,6 +555,7 @@ static void edit_file(char *fn)
}
}
#endif
+ redraw(FALSE); // dont force every col re-draw
//------This is the main Vi cmd handling loop -----------------------
while (editing > 0) {
#if ENABLE_FEATURE_VI_CRASHME
@@ -3849,6 +3850,7 @@ static void do_cmd(char c)
dot--;
}
+/* NB! the CRASHME code is unmaintained, and doesn't currently build */
#if ENABLE_FEATURE_VI_CRASHME
static int totalcmds = 0;
static int Mp = 85; // Movement command Probability
diff --git a/include/usage.h b/include/usage.h
index 4eac174..f575f46 100644
--- a/include/usage.h
+++ b/include/usage.h
@@ -4237,7 +4237,11 @@ USE_FEATURE_RUN_PARTS_FANCY("\n -l Prints names of all matching files even when
#define vi_full_usage \
"Edit FILE" \
"\n\nOptions:\n" \
- " -R Read-only - do not write to the file"
+ USE_FEATURE_VI_COLON( \
+ " -c Initial command to run ($EXINIT also available)\n") \
+ USE_FEATURE_VI_READONLY( \
+ " -R Read-only - do not write to the file\n") \
+ " -H Short help regarding available features"
#define vlock_trivial_usage \
"[OPTIONS]"