diff options
| author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-07-02 18:06:14 +0000 |
|---|---|---|
| committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-07-02 18:06:14 +0000 |
| commit | ef2d706f87a562b1d8d805cb78e2e0d8d6e8ddbd (patch) | |
| tree | cc734f8192ce2350438f66ab9d8e401d3acf8e02 | |
| parent | 258b151af8dcb0e92819e3baa10a39ab31e9fb39 (diff) | |
| download | busybox-w32-ef2d706f87a562b1d8d805cb78e2e0d8d6e8ddbd.tar.gz busybox-w32-ef2d706f87a562b1d8d805cb78e2e0d8d6e8ddbd.tar.bz2 busybox-w32-ef2d706f87a562b1d8d805cb78e2e0d8d6e8ddbd.zip | |
Cleanups and sinze reduction for the vi applet from Aaron Lehmann
<aaronl@vitelus.com>
git-svn-id: svn://busybox.net/trunk/busybox@2971 69ca8d6d-28ef-0310-b511-8ec308f3f277
| -rw-r--r-- | editors/vi.c | 29 | ||||
| -rw-r--r-- | vi.c | 29 |
2 files changed, 30 insertions, 28 deletions
diff --git a/editors/vi.c b/editors/vi.c index e1ff9336f..9e3355685 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | char *vi_Version = | 21 | char *vi_Version = |
| 22 | "$Id: vi.c,v 1.10 2001/06/26 02:06:08 bug1 Exp $"; | 22 | "$Id: vi.c,v 1.11 2001/07/02 18:06:14 andersen Exp $"; |
| 23 | 23 | ||
| 24 | /* | 24 | /* |
| 25 | * To compile for standalone use: | 25 | * To compile for standalone use: |
| @@ -367,7 +367,7 @@ extern int vi_main(int argc, char **argv) | |||
| 367 | //case 'h': // help -- just use default | 367 | //case 'h': // help -- just use default |
| 368 | default: | 368 | default: |
| 369 | show_help(); | 369 | show_help(); |
| 370 | break; | 370 | return 1; |
| 371 | } | 371 | } |
| 372 | } | 372 | } |
| 373 | 373 | ||
| @@ -2958,34 +2958,35 @@ static Byte *yank_delete(Byte * start, Byte * stop, int dist, int yf) | |||
| 2958 | 2958 | ||
| 2959 | static void show_help(void) | 2959 | static void show_help(void) |
| 2960 | { | 2960 | { |
| 2961 | printf("These features are available:\n"); | 2961 | puts("These features are available:" |
| 2962 | #ifdef BB_FEATURE_VI_SEARCH | 2962 | #ifdef BB_FEATURE_VI_SEARCH |
| 2963 | printf("\tPattern searches with / and ?\n"); | 2963 | "\n\tPattern searches with / and ?" |
| 2964 | #endif /* BB_FEATURE_VI_SEARCH */ | 2964 | #endif /* BB_FEATURE_VI_SEARCH */ |
| 2965 | #ifdef BB_FEATURE_VI_DOT_CMD | 2965 | #ifdef BB_FEATURE_VI_DOT_CMD |
| 2966 | printf("\tLast command repeat with \'.\'\n"); | 2966 | "\n\tLast command repeat with \'.\'" |
| 2967 | #endif /* BB_FEATURE_VI_DOT_CMD */ | 2967 | #endif /* BB_FEATURE_VI_DOT_CMD */ |
| 2968 | #ifdef BB_FEATURE_VI_YANKMARK | 2968 | #ifdef BB_FEATURE_VI_YANKMARK |
| 2969 | printf("\tLine marking with 'x\n"); | 2969 | "\n\tLine marking with 'x" |
| 2970 | printf("\tNamed buffers with \"x\n"); | 2970 | "\n\tNamed buffers with \"x" |
| 2971 | #endif /* BB_FEATURE_VI_YANKMARK */ | 2971 | #endif /* BB_FEATURE_VI_YANKMARK */ |
| 2972 | #ifdef BB_FEATURE_VI_READONLY | 2972 | #ifdef BB_FEATURE_VI_READONLY |
| 2973 | printf("\tReadonly if vi is called as \"view\"\n"); | 2973 | "\n\tReadonly if vi is called as \"view\"" |
| 2974 | printf("\tReadonly with -R command line arg\n"); | 2974 | "\n\tReadonly with -R command line arg" |
| 2975 | #endif /* BB_FEATURE_VI_READONLY */ | 2975 | #endif /* BB_FEATURE_VI_READONLY */ |
| 2976 | #ifdef BB_FEATURE_VI_SET | 2976 | #ifdef BB_FEATURE_VI_SET |
| 2977 | printf("\tSome colon mode commands with \':\'\n"); | 2977 | "\n\tSome colon mode commands with \':\'" |
| 2978 | #endif /* BB_FEATURE_VI_SET */ | 2978 | #endif /* BB_FEATURE_VI_SET */ |
| 2979 | #ifdef BB_FEATURE_VI_SETOPTS | 2979 | #ifdef BB_FEATURE_VI_SETOPTS |
| 2980 | printf("\tSettable options with \":set\"\n"); | 2980 | "\n\tSettable options with \":set\"" |
| 2981 | #endif /* BB_FEATURE_VI_SETOPTS */ | 2981 | #endif /* BB_FEATURE_VI_SETOPTS */ |
| 2982 | #ifdef BB_FEATURE_VI_USE_SIGNALS | 2982 | #ifdef BB_FEATURE_VI_USE_SIGNALS |
| 2983 | printf("\tSignal catching- ^C\n"); | 2983 | "\n\tSignal catching- ^C" |
| 2984 | printf("\tJob suspend and resume with ^Z\n"); | 2984 | "\n\tJob suspend and resume with ^Z" |
| 2985 | #endif /* BB_FEATURE_VI_USE_SIGNALS */ | 2985 | #endif /* BB_FEATURE_VI_USE_SIGNALS */ |
| 2986 | #ifdef BB_FEATURE_VI_WIN_RESIZE | 2986 | #ifdef BB_FEATURE_VI_WIN_RESIZE |
| 2987 | printf("\tAdapt to window re-sizes\n"); | 2987 | "\n\tAdapt to window re-sizes" |
| 2988 | #endif /* BB_FEATURE_VI_WIN_RESIZE */ | 2988 | #endif /* BB_FEATURE_VI_WIN_RESIZE */ |
| 2989 | ); | ||
| 2989 | } | 2990 | } |
| 2990 | 2991 | ||
| 2991 | static void print_literal(Byte * buf, Byte * s) // copy s to buf, convert unprintable | 2992 | static void print_literal(Byte * buf, Byte * s) // copy s to buf, convert unprintable |
| @@ -19,7 +19,7 @@ | |||
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | char *vi_Version = | 21 | char *vi_Version = |
| 22 | "$Id: vi.c,v 1.10 2001/06/26 02:06:08 bug1 Exp $"; | 22 | "$Id: vi.c,v 1.11 2001/07/02 18:06:14 andersen Exp $"; |
| 23 | 23 | ||
| 24 | /* | 24 | /* |
| 25 | * To compile for standalone use: | 25 | * To compile for standalone use: |
| @@ -367,7 +367,7 @@ extern int vi_main(int argc, char **argv) | |||
| 367 | //case 'h': // help -- just use default | 367 | //case 'h': // help -- just use default |
| 368 | default: | 368 | default: |
| 369 | show_help(); | 369 | show_help(); |
| 370 | break; | 370 | return 1; |
| 371 | } | 371 | } |
| 372 | } | 372 | } |
| 373 | 373 | ||
| @@ -2958,34 +2958,35 @@ static Byte *yank_delete(Byte * start, Byte * stop, int dist, int yf) | |||
| 2958 | 2958 | ||
| 2959 | static void show_help(void) | 2959 | static void show_help(void) |
| 2960 | { | 2960 | { |
| 2961 | printf("These features are available:\n"); | 2961 | puts("These features are available:" |
| 2962 | #ifdef BB_FEATURE_VI_SEARCH | 2962 | #ifdef BB_FEATURE_VI_SEARCH |
| 2963 | printf("\tPattern searches with / and ?\n"); | 2963 | "\n\tPattern searches with / and ?" |
| 2964 | #endif /* BB_FEATURE_VI_SEARCH */ | 2964 | #endif /* BB_FEATURE_VI_SEARCH */ |
| 2965 | #ifdef BB_FEATURE_VI_DOT_CMD | 2965 | #ifdef BB_FEATURE_VI_DOT_CMD |
| 2966 | printf("\tLast command repeat with \'.\'\n"); | 2966 | "\n\tLast command repeat with \'.\'" |
| 2967 | #endif /* BB_FEATURE_VI_DOT_CMD */ | 2967 | #endif /* BB_FEATURE_VI_DOT_CMD */ |
| 2968 | #ifdef BB_FEATURE_VI_YANKMARK | 2968 | #ifdef BB_FEATURE_VI_YANKMARK |
| 2969 | printf("\tLine marking with 'x\n"); | 2969 | "\n\tLine marking with 'x" |
| 2970 | printf("\tNamed buffers with \"x\n"); | 2970 | "\n\tNamed buffers with \"x" |
| 2971 | #endif /* BB_FEATURE_VI_YANKMARK */ | 2971 | #endif /* BB_FEATURE_VI_YANKMARK */ |
| 2972 | #ifdef BB_FEATURE_VI_READONLY | 2972 | #ifdef BB_FEATURE_VI_READONLY |
| 2973 | printf("\tReadonly if vi is called as \"view\"\n"); | 2973 | "\n\tReadonly if vi is called as \"view\"" |
| 2974 | printf("\tReadonly with -R command line arg\n"); | 2974 | "\n\tReadonly with -R command line arg" |
| 2975 | #endif /* BB_FEATURE_VI_READONLY */ | 2975 | #endif /* BB_FEATURE_VI_READONLY */ |
| 2976 | #ifdef BB_FEATURE_VI_SET | 2976 | #ifdef BB_FEATURE_VI_SET |
| 2977 | printf("\tSome colon mode commands with \':\'\n"); | 2977 | "\n\tSome colon mode commands with \':\'" |
| 2978 | #endif /* BB_FEATURE_VI_SET */ | 2978 | #endif /* BB_FEATURE_VI_SET */ |
| 2979 | #ifdef BB_FEATURE_VI_SETOPTS | 2979 | #ifdef BB_FEATURE_VI_SETOPTS |
| 2980 | printf("\tSettable options with \":set\"\n"); | 2980 | "\n\tSettable options with \":set\"" |
| 2981 | #endif /* BB_FEATURE_VI_SETOPTS */ | 2981 | #endif /* BB_FEATURE_VI_SETOPTS */ |
| 2982 | #ifdef BB_FEATURE_VI_USE_SIGNALS | 2982 | #ifdef BB_FEATURE_VI_USE_SIGNALS |
| 2983 | printf("\tSignal catching- ^C\n"); | 2983 | "\n\tSignal catching- ^C" |
| 2984 | printf("\tJob suspend and resume with ^Z\n"); | 2984 | "\n\tJob suspend and resume with ^Z" |
| 2985 | #endif /* BB_FEATURE_VI_USE_SIGNALS */ | 2985 | #endif /* BB_FEATURE_VI_USE_SIGNALS */ |
| 2986 | #ifdef BB_FEATURE_VI_WIN_RESIZE | 2986 | #ifdef BB_FEATURE_VI_WIN_RESIZE |
| 2987 | printf("\tAdapt to window re-sizes\n"); | 2987 | "\n\tAdapt to window re-sizes" |
| 2988 | #endif /* BB_FEATURE_VI_WIN_RESIZE */ | 2988 | #endif /* BB_FEATURE_VI_WIN_RESIZE */ |
| 2989 | ); | ||
| 2989 | } | 2990 | } |
| 2990 | 2991 | ||
| 2991 | static void print_literal(Byte * buf, Byte * s) // copy s to buf, convert unprintable | 2992 | static void print_literal(Byte * buf, Byte * s) // copy s to buf, convert unprintable |
