From patchwork Mon Dec 21 15:29:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alex Xu (Hello71)" X-Patchwork-Id: 7896551 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 328A0BEEE5 for ; Mon, 21 Dec 2015 15:31:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9B83E2056D for ; Mon, 21 Dec 2015 15:31:47 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AC12F2055C for ; Mon, 21 Dec 2015 15:31:46 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aB2On-0002bA-HG; Mon, 21 Dec 2015 15:29:21 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aB2Ol-0002b4-Sm for xen-devel@lists.xen.org; Mon, 21 Dec 2015 15:29:20 +0000 Received: from [85.158.143.35] by server-3.bemta-4.messagelabs.com id E6/1E-31122-FCA18765; Mon, 21 Dec 2015 15:29:19 +0000 X-Env-Sender: alex_y_xu@yahoo.ca X-Msg-Ref: server-16.tower-21.messagelabs.com!1450711757!2129709!1 X-Originating-IP: [98.139.213.95] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 7822 invoked from network); 21 Dec 2015 15:29:18 -0000 Received: from nm8-vm0.bullet.mail.bf1.yahoo.com (HELO nm8-vm0.bullet.mail.bf1.yahoo.com) (98.139.213.95) by server-16.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 21 Dec 2015 15:29:18 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.ca; s=s2048; t=1450711756; bh=xKiDRWvIx5+PpBPZqaRIYepoVYbiYoyeFNpfJfhV7z0=; h=From:To:Cc:Subject:Date:From:Subject; b=SNuC+AJKyuuXnjcPX3thqxnfYc//qvR5s6TrIKaM58ow/DPqtFeDc2Etii/aYsa+CoOC1Ht8JvP2M3a9DE3KxF13d2BWkeTwdoWN7W8I1pkAZ8q7vuGaAFOafIlh8LXe6BwOVy8pBORqQAqwXlkVb/K8INgEw8KQ4uLt1IeatZrVitv8Sg8Zp/G+OhD01F0XOsYFJ6aNjdD+D0BfDDyjYqo40st0/mHEv+YQO6hfMIf53H/FiO/6Cf997mUEPxtqfik45892qZYWWyu2tLhzlG2o9sRtHrSf0uQMBEXBxmsGQRLkPAyEMpkQG9Obw71UiZU+xTD7ET6qmbC9L/r3bA== Received: from [66.196.81.172] by nm8.bullet.mail.bf1.yahoo.com with NNFMP; 21 Dec 2015 15:29:16 -0000 Received: from [98.139.213.15] by tm18.bullet.mail.bf1.yahoo.com with NNFMP; 21 Dec 2015 15:29:16 -0000 Received: from [127.0.0.1] by smtp115.mail.bf1.yahoo.com with NNFMP; 21 Dec 2015 15:29:16 -0000 X-Yahoo-Newman-Id: 790533.43254.bm@smtp115.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: dvYi8H4VM1ksCS4npwJMWafsC8Kfq0zt.9.jHmlzMe3YiKp ae1Vw8vLRevVF8LjJ1fmRBreqg9nLFSxaFxlQ0lb73qiJgKUepD5lMJ6NtXR Skl6ADARn8dkqGULaZiThb5h_4JP6nIpfPQhtqtYRg2ROWTF.iDrGbBDB5ol vxdN9YguEH1e0qI9w73acC_dBCEcitGhPxKWCQNkgEAk0qjGLwpz4JNvB.2I ST8Y3ViOPHqpxr0ejhE7i1FN_YgLTJj3FyGJJD0TUPY1kziFhpqpeofujBJn YD8JbB0RWQxfQTfpeVf0sTIG47lEY990bbI0Z53XinZIibjhOgJwbk_d5eJe W4KZ3W0cBqqWafQZ.V5I8eUWHMNrztrqA4hzCq_.6sRpavSUCvoVvfpaAUNq 2PprQiIN_LH6hHWHq2kVTYlVmJTmWmtmm7S62PPBKmHrh01DhODR2L5QADEW mH6XrOdflqMAxwjD0.pOT9_O0QqVSKoet_GMrXv3n3vckedqYwu5nVglLA.K t3DGg1uO7JBJXTrcSx8gk4ovSCsoEPlbX2we.BfoNLgperg-- X-Yahoo-SMTP: Zybq.GKswBCVR5oJTLrx1T39m2F9FA-- From: Alex Xu To: xen-devel@lists.xen.org Date: Mon, 21 Dec 2015 10:29:05 -0500 Message-Id: <1450711745-1879-1-git-send-email-alex_y_xu@yahoo.ca> X-Mailer: git-send-email 2.6.4 Cc: keir@xen.org, ian.campbell@citrix.com, tim@xen.org, ian.jackson@eu.citrix.com, Alex Xu , jbeulich@suse.com Subject: [Xen-devel] [PATCH] xen/tools/get-fields.sh: Use printf for POSIX compat X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP xen/tools/get-fields.sh used echo -n which is not POSIX compatible and breaks building with dash (shell). Change it to use printf %s which is usable everywhere. Signed-off-by: Alex Xu --- xen/tools/get-fields.sh | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/xen/tools/get-fields.sh b/xen/tools/get-fields.sh index 4547dc2..887feec 100644 --- a/xen/tools/get-fields.sh +++ b/xen/tools/get-fields.sh @@ -130,9 +130,9 @@ handle_field () echo " \\" if [ -z "$4" ] then - echo -n "$1(_d_)->$3 = (_s_)->$3;" + printf %s "$1(_d_)->$3 = (_s_)->$3;" else - echo -n "$1XLAT_${2}_HNDL_$(echo $3 | $SED 's,\.,_,g')(_d_, _s_);" + printf %s "$1XLAT_${2}_HNDL_$(echo $3 | $SED 's,\.,_,g')(_d_, _s_);" fi elif [ -z "$(echo "$5" | $SED 's,[^{}],,g')" ] then @@ -142,7 +142,7 @@ for line in sys.stdin.readlines(): print re.subn(r"\s*(struct|union)\s+(compat_)?(\w+)\s.*", r"\3", line)[0].rstrip() ') echo " \\" - echo -n "${1}XLAT_$tag(&(_d_)->$3, &(_s_)->$3);" + printf %s "${1}XLAT_$tag(&(_d_)->$3, &(_s_)->$3);" else local level=1 kind= fields= id= array= arrlvl=1 array_type= type= token for token in $5 @@ -156,7 +156,7 @@ for line in sys.stdin.readlines(): if [ $kind = union ] then echo " \\" - echo -n "${1}switch ($(echo $3 | $SED 's,\.,_,g')) {" + printf %s "${1}switch ($(echo $3 | $SED 's,\.,_,g')) {" fi fi ;; @@ -168,7 +168,7 @@ for line in sys.stdin.readlines(): if [ $level = 1 -a $kind = union ] then echo " \\" - echo -n "$1}" + printf %s "$1}" fi ;; "[") @@ -223,7 +223,7 @@ for line in sys.stdin.readlines(): if [ $kind = union ] then echo " \\" - echo -n "${1}case XLAT_${2}_$(echo $3.$id | $SED 's,\.,_,g'):" + printf %s "${1}case XLAT_${2}_$(echo $3.$id | $SED 's,\.,_,g'):" handle_field "$1 " $2 $3.$id "$type" "$fields" elif [ -z "$array" -a -z "$array_type" ] then @@ -239,7 +239,7 @@ for line in sys.stdin.readlines(): if [ $kind = union ] then echo " \\" - echo -n "$1 break;" + printf %s "$1 break;" fi fi ;; @@ -259,7 +259,7 @@ copy_array () { echo " \\" echo "${1}if ((_d_)->$2 != (_s_)->$2) \\" - echo -n "$1 memcpy((_d_)->$2, (_s_)->$2, sizeof((_d_)->$2));" + printf %s "$1 memcpy((_d_)->$2, (_s_)->$2, sizeof((_d_)->$2));" } handle_array () @@ -268,7 +268,7 @@ handle_array () echo " \\" echo "$1{ \\" echo "$1 unsigned int $i; \\" - echo -n "$1 for ($i = 0; $i < "${4%%;*}"; ++$i) {" + printf %s "$1 for ($i = 0; $i < "${4%%;*}"; ++$i) {" if [ "$4" = "${4#*;}" ] then handle_field "$1 " $2 $3[$i] "$5" "$6" @@ -277,13 +277,13 @@ handle_array () fi echo " \\" echo "$1 } \\" - echo -n "$1}" + printf %s "$1}" } build_body () { echo - echo -n "#define XLAT_$1(_d_, _s_) do {" + printf %s "#define XLAT_$1(_d_, _s_) do {" local level=1 fields= id= array= arrlvl=1 array_type= type= token for token in $2 do @@ -389,7 +389,7 @@ check_field () struct|union) ;; [a-zA-Z_]*) - echo -n " CHECK_${n#xen_}" + printf %s " CHECK_${n#xen_}" break ;; *) @@ -400,9 +400,9 @@ check_field () done elif [ $n = 0 ] then - echo -n " CHECK_FIELD_($1, $2, $3)" + printf %s " CHECK_FIELD_($1, $2, $3)" else - echo -n " CHECK_SUBFIELD_${n}_($1, $2, $(echo $3 | $SED 's!\.!, !g'))" + printf %s " CHECK_SUBFIELD_${n}_($1, $2, $(echo $3 | $SED 's!\.!, !g'))" fi else local level=1 fields= id= token @@ -446,7 +446,7 @@ build_check () if [ $level = 1 ] then kind=$token - echo -n " CHECK_SIZE_($kind, $1)" + printf %s " CHECK_SIZE_($kind, $1)" elif [ $level = 2 ] then fields=" "