cURL / Mailing Lists / curl-library / Single Mail

curl-library

wc test in c7b6e43e fails on sysv

From: Tor Arntsen <tor_at_spacetec.no>
Date: Wed, 30 Jan 2013 10:07:59 +0100

The test for the existence of 'wc' fails on at least IRIX and Solaris:

+xc_tst_str='unknown unknown unknown unknown'
+xc_tst_str=`echo "$xc_tst_str" 2>/dev/null \
+ | wc -w 2>/dev/null`
+case "x$xc_tst_str" in @%:@ ((
+ x4)
+ :
+ ;;
+ *)
+ echo "$xc_msg_err 'wc' utility not found in 'PATH'. $xc_msg_abrt" >&2
+ exit 1
+ ;;
+esac

This is because on those architectures 'wc' outputs the number(s) with
leading zeros, consider:

Linux:
$ echo "h h h h"|wc -w
4

IRIX, Solaris:
$ echo "h h h h"|wc -w
             4

So the check for 'x4' will fail as the string is actually 'x 4'

Not certain what would be the least clumsy way of fixing it.. short of
removing the test, as I don't know any *nix variant which doesn't have
a 'wc' in the most basic PATH.

.-Tor

CONFIDENTIALITY
This e-mail and any attachment contain KONGSBERG information which may be
proprietary, confidential or subject to export regulations, and is only meant
for the intended recipient(s). Any disclosure, copying, distribution or use is
prohibited, if not otherwise explicitly agreed with KONGSBERG. If received in
error, please delete it immediately from your system and notify the sender
properly.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-01-30