]> www.infradead.org Git - users/dwmw2/ews-sync.git/commitdiff
Dump reply XML only if there's a problem
authorDavid Woodhouse <dwmw2@infradead.org>
Mon, 19 Jul 2010 21:40:01 +0000 (22:40 +0100)
committerDavid Woodhouse <dwmw2@infradead.org>
Mon, 19 Jul 2010 21:40:01 +0000 (22:40 +0100)
syncfolder.sh

index 21be63514fc19f9b3a51b599f20d3f5481a49168..129835d614e8a0c2af2e6c0445e759c56ce3210b 100755 (executable)
@@ -51,7 +51,7 @@ if ! curl $CURLAUTH -L -H "Content-Type: text/xml" \
     $EWSURL -d @$QUERYFILE > $RESULTFILE; then
     exit 1
 fi
-sed 's/\(<[^/]\)/\n\1/g' $RESULTFILE
+
 echo
 # I'm far too lazy to do proper XML parsing for a proof-of-concept
 (sed 's/\(<[^/]\)/\n\1/g' $RESULTFILE; echo) | while read LINE; do
@@ -83,7 +83,10 @@ fi
 NEWSYNCSTATE=$(sed -n '/<m:SyncState>/{s/.*<m:SyncState>\(.*\)<\/m:SyncState>.*/\1/p}' $RESULTFILE)
 
 if [ "$NEWSYNCSTATE" = "" ]; then
-    echo "No <SyncState> found in response"
+    sed 's/\(<[^/]\)/\n\1/g' $RESULTFILE
+    echo
+    echo
+    echo "No <SyncState> found in response (shown above); aborting"
     exit 1
 fi