[git commit master] diff: honor flag -i (ignore case differences)

Denys Vlasenko vda.linux at googlemail.com
Wed Jan 20 01:46:39 UTC 2010


commit: http://git.busybox.net/busybox/commit/?id=b7a044043ceae800a1f7abd69b107876ad5e9d40
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

>>From 503a1e1d2597f7cdf86a9ea39ebd2aee050ca759 Mon Sep 17 00:00:00 2001
From: Denys Vlasenko <vda.linux at googlemail.com>
Date: Wed, 20 Jan 2010 02:46:39 +0100
Subject: [PATCH] diff: honor flag -i (ignore case differences)

function                                             old     new   delta
read_token                                           157     178     +21
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 21/0)               Total: 21 bytes
   text	   data	    bss	    dec	    hex	filename
  70102	    733	   8576	  79411	  13633	busybox_old
  70123	    733	   8576	  79432	  13648	busybox_unstripped

Signed-off-by: Matheus Izvekov <mizvekov at gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 editors/diff.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/editors/diff.c b/editors/diff.c
index 0c75873..ef20305 100644
--- a/editors/diff.c
+++ b/editors/diff.c
@@ -94,7 +94,7 @@ enum {                   /* Commandline flags */
 	FLAG_a,
 	FLAG_b,
 	FLAG_d,
-	FLAG_i, /* unused */
+	FLAG_i,
 	FLAG_L, /* unused */
 	FLAG_N,
 	FLAG_q,
@@ -177,6 +177,9 @@ static int read_token(FILE_and_pos_t *ft, token_t tok)
 		if (t == '\n')
 			tok |= TOK_EOL;
 
+		if (option_mask32 & FLAG(i)) /* Handcoded tolower() */
+			t = (t >= 'A' && t <= 'Z') ? t - ('A' - 'a') : t;
+
 		if ((option_mask32 & FLAG(w)) && is_space)
 			continue;
 
-- 
1.6.3.3



More information about the busybox-cvs mailing list