On Sat, 08 May 2004 16:24:05 +0100
P at draigBrady.com wrote:
> Nice try. The hard bit is finding the appropriate header files.
> I'm now down to 60 bytes. It's beginning to look like Perl though.
>> #!/bin/sh
> echo|cpp -includeerrno.h -dD|egrep -w "E[^ ]+ *$1"
The contents of your echo go unused by cpp, so all you
really need is a command that generates some output
and creates an EOF for stdin..
How about
w|cpp -includeerrno.h -dD|egrep -w "E[^ ]+ *$1"
and you don't *really* need the #!/bin/sh, just
having it executable should do you nicely..
Which makes it 49 bytes ( if you include the ^M
at the end of the line :-)
And your *$1, isn't really making much difference
either.
luggage:~> cat t.sh
w|cpp -includeerrno.h -dD|egrep -w "E[^ ]+ *$1"
luggage:~> ./t.sh | wc
126 378 2468
luggage:~> cat t.sh
w|cpp -includeerrno.h -dD|egrep -w "E[^ ]+"
luggage:~> ./t.sh | wc
126 378 2468
Which makes it 43 ( if you don't count the ^M at the end ),
were we counting the ^M ?
Can't you replace the "E[^ ]+" with E.+ ( no spaces, no quotes )
Which ( not counting the ^M ) gives 38 chars ?
:-)
( Now - I have to say that I missed the start of
this thread, so I could just have killed some functionality,
but all my tests give the same answer for the last one
w|cpp -includeerrno.h -dD|egrep -w E.+
as to the first one :-)
--
Chris Higgins Cisco Learning Partner
Darach Technology Ltd tel: +353-1-6204370
email: chris.higgins at darach.ie fax: +353-1-6204371
http://www.darach.ie
Debian Hint #10: There are Debian mailing lists for everything from user
questions to debates over what to put into the Debian Policy documents.
Check out the list at http://www.debian.org/MailingLists/ and subscribe
to
those that interest you.
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!