public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* strings: \t special but \n not?
@ 2014-06-19  0:18 Erik Ackermann
  2014-06-19  0:41 ` Erik Ackermann
  0 siblings, 1 reply; 2+ messages in thread
From: Erik Ackermann @ 2014-06-19  0:18 UTC (permalink / raw)
  To: binutils

I have noticed that \n is treated differently than \t. Consider

echo -e "HELLO\nW" | strings
echo -e "HELLO\tW" | strings

The first will print "HELLO" and the second "HELLO\tW"

I have noticed in the code that in addition to checking ISPRINT(c), c
== '\t' is also special cased as being a "string". Why is \t special
and not other whitespace?

Thanks,
Erik

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: strings: \t special but \n not?
  2014-06-19  0:18 strings: \t special but \n not? Erik Ackermann
@ 2014-06-19  0:41 ` Erik Ackermann
  0 siblings, 0 replies; 2+ messages in thread
From: Erik Ackermann @ 2014-06-19  0:41 UTC (permalink / raw)
  To: binutils

Did some digging and appears the '\t' was special cased back in commit
6b3bf560900b549065d93d5d43a9b6af0e3a5e95

Can we just include all whitespace characters?

This would allow you pull out text with short lines (or even empty
liines) from binaries etc

On Wed, Jun 18, 2014 at 5:17 PM, Erik Ackermann
<kurterikackermann@gmail.com> wrote:
> I have noticed that \n is treated differently than \t. Consider
>
> echo -e "HELLO\nW" | strings
> echo -e "HELLO\tW" | strings
>
> The first will print "HELLO" and the second "HELLO\tW"
>
> I have noticed in the code that in addition to checking ISPRINT(c), c
> == '\t' is also special cased as being a "string". Why is \t special
> and not other whitespace?
>
> Thanks,
> Erik

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-19  0:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-19  0:18 strings: \t special but \n not? Erik Ackermann
2014-06-19  0:41 ` Erik Ackermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).