[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Script for warning about error leaks

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2006-02-07 00:38:58 CET

Peter Samuelson wrote:
> [Julian Foad]
>
>>+ATTRIB_RE="__attribute__((warn_unused_result))"
>>+ATTRIB_STR="${ATTRIB_RE//\\}" # plain text version of it: remove any backslashes
>
> ${foo//bar} is a bashism.
>
> ATTRIB_STR=$(echo "$ATTRIB_RE" | tr -d '\\')

OK, thanks. In fact, I might just hard-code the result again like I did
before, since it's not actually doing anything.

>>+for F in "$@"; do
>
> I'm fairly sure it's portable to drop the in "$@" part:
>
> for F; do
>
> ...though not everyone seems to realise this, so perhaps your version
> is clearer in general.

I normally use Bash. My "man ash" didn't document that shortcut, so I steered
clear, but in fact, trying it now, it works, and
   http://www.softpanorama.org/Scripting/Shellorama/portability.shtml
says:
> "for i; do ...; done" is a syntax error for Solaris sh. However,
> "for i do ...; done" works portably.

Well, we live and learn!

>>+ echo "$0: skipping \"$F\": is not a regular file"
>
> Looks a little funny to me; utilities would traditionally just say
>
> echo "$0: skipping \"$F\": not a regular file"

$ head tmp/
head: error reading `tmp/': Is a directory

*shrug*

Anyway, thanks, shell guru.

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Feb 7 00:39:23 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.