svn commit: trunk/busybox: include miscutils

aldot at busybox.net aldot at busybox.net
Fri Sep 26 14:10:17 UTC 2008


Author: aldot
Date: 2008-09-26 07:10:17 -0700 (Fri, 26 Sep 2008)
New Revision: 23519

Log:
- 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



Modified:
   trunk/busybox/include/usage.h
   trunk/busybox/miscutils/less.c


Changeset:
Modified: trunk/busybox/include/usage.h
===================================================================
--- trunk/busybox/include/usage.h	2008-09-26 14:04:08 UTC (rev 23518)
+++ trunk/busybox/include/usage.h	2008-09-26 14:10:17 UTC (rev 23519)
@@ -2078,7 +2078,7 @@
        "5\n"
 
 #define less_trivial_usage \
-       "[-EMNmh~?] [FILE...]"
+       "[-EMNmh~I?] [FILE...]"
 #define less_full_usage "\n\n" \
        "View a file or list of files. The position within files can be\n" \
        "changed, and files can be manipulated in various ways.\n" \
@@ -2087,6 +2087,7 @@
      "\n	-M,-m	Display a status line containing the line numbers" \
      "\n		and percentage through the file" \
      "\n	-N	Prefix line numbers to each line" \
+     "\n	-I	Ignore case in all searches" \
      "\n	-~	Suppress ~s displayed past the end of the file" \
 
 #define linux32_trivial_usage NOUSAGE_STR

Modified: trunk/busybox/miscutils/less.c
===================================================================
--- trunk/busybox/miscutils/less.c	2008-09-26 14:04:08 UTC (rev 23518)
+++ trunk/busybox/miscutils/less.c	2008-09-26 14:10:17 UTC (rev 23519)
@@ -79,6 +79,7 @@
 	FLAG_m = 1 << 2,
 	FLAG_N = 1 << 3,
 	FLAG_TILDE = 1 << 4,
+	FLAG_I = 1 << 5,
 /* hijack command line options variable for internal state vars */
 	LESS_STATE_MATCH_BACKWARDS = 1 << 15,
 };
@@ -965,7 +966,8 @@
 	}
 
 	/* Compile the regex and check for errors */
-	err = regcomp_or_errmsg(&pattern, uncomp_regex, 0);
+	err = regcomp_or_errmsg(&pattern, uncomp_regex,
+							option_mask32 & FLAG_I ? REG_ICASE : 0);
 	free(uncomp_regex);
 	if (err) {
 		print_statusline(err);
@@ -1359,7 +1361,7 @@
 	/* TODO: -x: do not interpret backspace, -xx: tab also */
 	/* -xxx: newline also */
 	/* -w N: assume width N (-xxx -w 32: hex viewer of sorts) */
-	getopt32(argv, "EMmN~");
+	getopt32(argv, "EMmN~I");
 	argc -= optind;
 	argv += optind;
 	num_files = argc;




More information about the busybox-cvs mailing list