kszbcss / xspec

Private backup of the xspec project at google code, as google code is going to disappear.
MIT License
1 stars 0 forks source link

Enhancement to xspec.sh when saxon script not found #37

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Call xspec.sh without having a "saxon" script

I get the error msg:
./xspec.sh: line 64: saxon: command not found
which was supposed to be captured by redirecting to /dev/null:
saxon --help 2>&1 > /dev/null

However the line should read:
saxon --help > /dev/null 2>&1

I attach a patch which fixes this and a few more things:
1. typo in the comment: "later" -> "latter"

2. added a function "findSaxonJar" that looks for saxon jar.
   It might be more easy to add new jars, since
   new jars would only need to be appended to the list
   instead of reproducing a line with "elif" etc.

3. line 64 calling saxon script (see above)

4. changed message when script not found (because it's not an error)

5. typo in comment: "toopen" -> "to open"

6. unified the style: defining functions according to environment instead
   of using environment variables (added function "openReport" instead of
   using environment var "$OPEN").

7. replaced if/elif cascade for determining saxon jar by call to function
   "findSaxonJar" defined in 2.

8. replaced invokation of "$OPEN" by function "openReport" defined in 6.

Original issue reported on code.google.com by sbs....@gmail.com on 21 Sep 2010 at 1:11

Attachments:

GoogleCodeExporter commented 9 years ago
PS: changed the script to be sh instead of bash. This is a question to be 
discussed of course. Sorry.
Bernhard

Original comment by sbs....@gmail.com on 21 Sep 2010 at 1:12

GoogleCodeExporter commented 9 years ago
Thanks for this detailed patch, Bernhard!  I agree with your
first 5 points.  About using a function instead of $OPEN and
$SAXON_CP direct initialization, I am a bit reluctant though, as
I'd like to be UNIX Open compliant as possible, in order to not
rely on Bash.  Whilst $OPEN does not rely change anything, I am
not sure your findSaxonJar() does not use any Bash-specific
feature (and it does not really solve any issue, that's more a
cosmetics change to avoid several IF's).

So I suggest to integrate the first 74 lines of your patch :-)
What do you think?

Original comment by fgeorges on 21 Sep 2010 at 1:53

GoogleCodeExporter commented 9 years ago
Thanks, Florent!

Actually, I changed the script's first line from #!/bin/bash to #!/bin/sh to 
ensure I'm only using bourne shell and no bash-specific features.
Of course, you're right: It's a cosmetic change. You can be sure though, it's 
bourne shell compatible.

It's your call. I'm fine with whatever decision you take.

Original comment by sbs....@gmail.com on 21 Sep 2010 at 2:19

GoogleCodeExporter commented 9 years ago
Fixed in revision 213 (some selected pieces).

Original comment by fgeorges on 11 Sep 2011 at 6:22