Re: uniq: add -i option

2017-12-23 Thread Jeremie Courreges-Anglas
On Sun, Dec 24 2017, Theo Buehler wrote: >> Obviously, the relevant condition should have been >> >> if ((iflag ? strcasecmp : strcmp)(t1, t2) != 0) >> >> instead of awkwardly messing with logical AND and OR. > > Indeed, this is much better. I like your version, but

Re: uniq: add -i option

2017-12-23 Thread Theo Buehler
On Sun, Dec 24, 2017 at 12:01:17AM +, kshe wrote: > On Sat, 23 Dec 2017 23:13:22 +, Theo Buehler wrote: > > > Obviously, the relevant condition should have been > > > > > > if ((iflag ? strcasecmp : strcmp)(t1, t2) != 0) > > > > > > instead of awkwardly messing with logical AND and OR.

Re: uniq: add -i option

2017-12-23 Thread kshe
On Sat, 23 Dec 2017 23:13:22 +, Theo Buehler wrote: > > Obviously, the relevant condition should have been > > > > if ((iflag ? strcasecmp : strcmp)(t1, t2) != 0) > > > > instead of awkwardly messing with logical AND and OR. > > Indeed, this is much better. I like your version, but perhaps

Re: uniq: add -i option

2017-12-23 Thread Theo Buehler
> Obviously, the relevant condition should have been > > if ((iflag ? strcasecmp : strcmp)(t1, t2) != 0) > > instead of awkwardly messing with logical AND and OR. Indeed, this is much better. I like your version, but perhaps others might like this one more: if ((iflag &&

Re: uniq: add -i option

2017-12-23 Thread kshe
Hi, This change causes uniq(1) to compare equal lines twice when run without `-i', once in strcmp(3) and once again in strcasecmp(3). In the worst case, which is also one of the most common, the main loop spends about half of its time copying buffers and looking for newlines in fgets(3), and the

Re: uniq: add -i option

2017-12-22 Thread Ingo Schwarze
Hi Theo, Theo Buehler wrote on Thu, Dec 21, 2017 at 11:57:12PM +0100: > Ingo Schwarze wrote: >> So i really don't feel like adding a BUGS section, but instead i >> think documenting that -i is intended as an ASCII-only feature is >> the way to go. > Yes, sounds reasonable. Thanks for checking!

Re: uniq: add -i option

2017-12-21 Thread Theo Buehler
> So i really don't feel like adding a BUGS section, but instead i > think documenting that -i is intended as an ASCII-only feature is > the way to go. Yes, sounds reasonable. > While here, profit from the opportunity to mention that uniq(1) is > intended to work on the level of codepoints, not

Re: uniq: add -i option

2017-12-21 Thread Claus Assmann
On Thu, Dec 21, 2017, Theo Buehler wrote: > I committed a minimally tweaked version of your diff: Thanks for the fixes and the commit, I will try to do better next time.

Re: uniq: add -i option

2017-12-21 Thread Ingo Schwarze
Hi Theo, Theo Buehler wrote on Thu, Dec 21, 2017 at 11:06:02AM +0100: > On Thu, Dec 21, 2017 at 01:50:37AM -0800, Claus Assmann wrote: >> On Fri, Dec 15, 2017, Todd C. Miller wrote: >>> On Fri, 15 Dec 2017 03:41:25 -0800, Claus Assmann wrote: I use uniq for some log file analysis and it

Re: uniq: add -i option

2017-12-21 Thread Craig Skinner
On Thu, 21 Dec 2017 11:06:02 +0100 Theo Buehler wrote: > I committed a minimally tweaked version of your diff... Thanks everybody.

Re: uniq: add -i option

2017-12-21 Thread Theo Buehler
On Thu, Dec 21, 2017 at 01:50:37AM -0800, Claus Assmann wrote: > On Fri, Dec 15, 2017, Todd C. Miller wrote: > > On Fri, 15 Dec 2017 03:41:25 -0800, Claus Assmann wrote: > > > > I use uniq for some log file analysis and it contained "duplicate" > > > lines which only differ in lower/upper case

Re: uniq: add -i option

2017-12-21 Thread Claus Assmann
On Fri, Dec 15, 2017, Todd C. Miller wrote: > On Fri, 15 Dec 2017 03:41:25 -0800, Claus Assmann wrote: > > I use uniq for some log file analysis and it contained "duplicate" > > lines which only differ in lower/upper case (user input). Hence I > > added an -i flag which also exists on FreeBSD at

Re: uniq: add -i option

2017-12-15 Thread Todd C. Miller
On Fri, 15 Dec 2017 03:41:25 -0800, Claus Assmann wrote: > I use uniq for some log file analysis and it contained "duplicate" > lines which only differ in lower/upper case (user input). Hence I > added an -i flag which also exists on FreeBSD at least. > Maybe it's useful to add to OpenBSD? Linux

uniq: add -i option

2017-12-15 Thread Claus Assmann
I use uniq for some log file analysis and it contained "duplicate" lines which only differ in lower/upper case (user input). Hence I added an -i flag which also exists on FreeBSD at least. Maybe it's useful to add to OpenBSD? Index: uniq.1