diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-09-26 14:10:17 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-09-26 14:10:17 +0000 |
commit | 48a6773b3ae627a67ab7b191df0063dcefc3f470 (patch) | |
tree | 8d6a07081b087e82771b88e8a16ad769835e0175 | |
parent | fd3552dff905e03842197291a2a3627acd53756c (diff) | |
download | busybox-w32-48a6773b3ae627a67ab7b191df0063dcefc3f470.tar.gz busybox-w32-48a6773b3ae627a67ab7b191df0063dcefc3f470.tar.bz2 busybox-w32-48a6773b3ae627a67ab7b191df0063dcefc3f470.zip |
- add less -I to be able to search case-insensitively
+17b, but the helptext is quite elaborate, thus:
function old new delta
.rodata 118995 119032 +37
packed_usage 24731 24767 +36
regex_process 284 300 +16
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 89/0) Total: 89 bytes
-rw-r--r-- | include/usage.h | 3 | ||||
-rw-r--r-- | miscutils/less.c | 6 |
2 files changed, 6 insertions, 3 deletions
diff --git a/include/usage.h b/include/usage.h index ac6376afd..24008deeb 100644 --- a/include/usage.h +++ b/include/usage.h | |||
@@ -2078,7 +2078,7 @@ | |||
2078 | "5\n" | 2078 | "5\n" |
2079 | 2079 | ||
2080 | #define less_trivial_usage \ | 2080 | #define less_trivial_usage \ |
2081 | "[-EMNmh~?] [FILE...]" | 2081 | "[-EMNmh~I?] [FILE...]" |
2082 | #define less_full_usage "\n\n" \ | 2082 | #define less_full_usage "\n\n" \ |
2083 | "View a file or list of files. The position within files can be\n" \ | 2083 | "View a file or list of files. The position within files can be\n" \ |
2084 | "changed, and files can be manipulated in various ways.\n" \ | 2084 | "changed, and files can be manipulated in various ways.\n" \ |
@@ -2087,6 +2087,7 @@ | |||
2087 | "\n -M,-m Display a status line containing the line numbers" \ | 2087 | "\n -M,-m Display a status line containing the line numbers" \ |
2088 | "\n and percentage through the file" \ | 2088 | "\n and percentage through the file" \ |
2089 | "\n -N Prefix line numbers to each line" \ | 2089 | "\n -N Prefix line numbers to each line" \ |
2090 | "\n -I Ignore case in all searches" \ | ||
2090 | "\n -~ Suppress ~s displayed past the end of the file" \ | 2091 | "\n -~ Suppress ~s displayed past the end of the file" \ |
2091 | 2092 | ||
2092 | #define linux32_trivial_usage NOUSAGE_STR | 2093 | #define linux32_trivial_usage NOUSAGE_STR |
diff --git a/miscutils/less.c b/miscutils/less.c index 530a40a8c..cd47590ee 100644 --- a/miscutils/less.c +++ b/miscutils/less.c | |||
@@ -79,6 +79,7 @@ enum { | |||
79 | FLAG_m = 1 << 2, | 79 | FLAG_m = 1 << 2, |
80 | FLAG_N = 1 << 3, | 80 | FLAG_N = 1 << 3, |
81 | FLAG_TILDE = 1 << 4, | 81 | FLAG_TILDE = 1 << 4, |
82 | FLAG_I = 1 << 5, | ||
82 | /* hijack command line options variable for internal state vars */ | 83 | /* hijack command line options variable for internal state vars */ |
83 | LESS_STATE_MATCH_BACKWARDS = 1 << 15, | 84 | LESS_STATE_MATCH_BACKWARDS = 1 << 15, |
84 | }; | 85 | }; |
@@ -965,7 +966,8 @@ static void regex_process(void) | |||
965 | } | 966 | } |
966 | 967 | ||
967 | /* Compile the regex and check for errors */ | 968 | /* Compile the regex and check for errors */ |
968 | err = regcomp_or_errmsg(&pattern, uncomp_regex, 0); | 969 | err = regcomp_or_errmsg(&pattern, uncomp_regex, |
970 | option_mask32 & FLAG_I ? REG_ICASE : 0); | ||
969 | free(uncomp_regex); | 971 | free(uncomp_regex); |
970 | if (err) { | 972 | if (err) { |
971 | print_statusline(err); | 973 | print_statusline(err); |
@@ -1359,7 +1361,7 @@ int less_main(int argc, char **argv) | |||
1359 | /* TODO: -x: do not interpret backspace, -xx: tab also */ | 1361 | /* TODO: -x: do not interpret backspace, -xx: tab also */ |
1360 | /* -xxx: newline also */ | 1362 | /* -xxx: newline also */ |
1361 | /* -w N: assume width N (-xxx -w 32: hex viewer of sorts) */ | 1363 | /* -w N: assume width N (-xxx -w 32: hex viewer of sorts) */ |
1362 | getopt32(argv, "EMmN~"); | 1364 | getopt32(argv, "EMmN~I"); |
1363 | argc -= optind; | 1365 | argc -= optind; |
1364 | argv += optind; | 1366 | argv += optind; |
1365 | num_files = argc; | 1367 | num_files = argc; |