New commit in Git/spar/
[sunny256-utils.git] / xt
blobcd07f3f14ab1d99aa41773a5e51da64529b4fb05
1 #!/bin/sh
3 # xt
4 # File ID: 0c214154-5d4a-11df-940b-90e6ba3022ac
6 retval=0
8 for f in "$@"; do
9 if echo $f | grep -qi '\.gpx$'; then
10 unset gpxver
11 if [ -n "$(grep http://www.topografix.com/GPX/1/0 $f)" ]; then
12 gpxver=1.0
13 elif [ -n "$(grep http://www.topografix.com/GPX/1/1 $f)" ]; then
14 gpxver=1.1
15 else
16 echo "xt: $f: Unknwon GPX version" >&2
17 retval=1
19 if [ -n "$gpxver" ]; then
20 gpx_xsd=~/bin/Git/gpstools/Tools/xsd/gpx/gpx-$gpxver.xsd
21 if [ -e $gpx_xsd ]; then
22 xmllint --noout --schema $gpx_xsd $f || retval=1
23 else
24 xmllint --noout --schema http://www.topografix.com/GPX/1/1/gpx.xsd $f || retval=1
27 else
28 xmllint --valid --noout "$f" || retval=1
30 done
32 exit $retval