From patchwork Sun Dec 20 16:41:34 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: 7892261 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 C69E5BEEE5 for ; Sun, 20 Dec 2015 16:44:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B3305202DD for ; Sun, 20 Dec 2015 16:44:52 +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 9FE3F20204 for ; Sun, 20 Dec 2015 16:44:50 +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 1aAh3X-00026B-Jm; Sun, 20 Dec 2015 16:41:59 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aAh3V-000266-Af for xen-devel@lists.xen.org; Sun, 20 Dec 2015 16:41:57 +0000 Received: from [85.158.139.211] by server-1.bemta-5.messagelabs.com id 7D/A5-32615-45AD6765; Sun, 20 Dec 2015 16:41:56 +0000 X-Env-Sender: alex_y_xu@yahoo.ca X-Msg-Ref: server-3.tower-206.messagelabs.com!1450629714!11843579!1 X-Originating-IP: [72.30.239.209] 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 57126 invoked from network); 20 Dec 2015 16:41:55 -0000 Received: from nm40-vm1.bullet.mail.bf1.yahoo.com (HELO nm40-vm1.bullet.mail.bf1.yahoo.com) (72.30.239.209) by server-3.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 20 Dec 2015 16:41:55 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.ca; s=s2048; t=1450629714; bh=CRD25Gqnzqs0zPmFkkz2g41dOGqnkGOz+BGidpOZUs4=; h=From:To:Cc:Subject:Date:From:Subject; b=n2NyvXoFVrVuWdcaMQid6rI2bSQdJXGsCICReVsOMH54QO6wYtqbtAUPWOpuXlb/2oz5QHtJDgGHgnM7L3jOOHwhPhgs5XYkGVyfOb9JKaZYiNYKAKS90fTE4+tKm7Nc0J9EuEdYRF5VMnY8fdrtYHDw7na54sj3frBkXh0SixiqgZHF/VGavHY5N8b2AXY4I/vW+mxEcO0hc6kt8DEsOBn9dtV3vPpzGApi6FxSV9FJ1+b7kS2XUd4nldfUbpui7Qx5+hNzxEd8gzN+rt6j7MgoafNcUN4cveT2eq7+jfpLhzGqx4k/+YZ4Dipn2CTcoSTfRKd6YillciiYJJAVPA== Received: from [98.139.215.143] by nm40.bullet.mail.bf1.yahoo.com with NNFMP; 20 Dec 2015 16:41:54 -0000 Received: from [98.139.213.15] by tm14.bullet.mail.bf1.yahoo.com with NNFMP; 20 Dec 2015 16:41:54 -0000 Received: from [127.0.0.1] by smtp115.mail.bf1.yahoo.com with NNFMP; 20 Dec 2015 16:41:54 -0000 X-Yahoo-Newman-Id: 89711.51868.bm@smtp115.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: gSxeNsQVM1kvCM6TL31Jhvpx5mEHCeL84ccLti39U_ux7n1 uWgFEO2KHE7iNX8QiUftyOUyhLYpFfGZvGQZHweg1l1SRbupIDVK7GGIMYXp Zh9.XDsey4JV4X714Og3YBPpjh8m3VTBQPCHX9RoLGzTRYe6aRwT2ZaEKYSu XRqm_3AQyQ72CGHNfm2shULWORgxboBdg.FhCddwRftB5SML3IpGX6zbadoa ZllP0Tyi_Mvis2eR_49bok5umPq_x5ACNWr9kD0Vv96xK0TTvlsylMOVu4wX RyxbVjE9jfRbwHKP.e3NjCUxYu_ZbTJiIjUDmbPGaW6gMW59RckHVAw3q.eK DgzPA2obUC_PjxirldepFfUsLjJRTtS.88cZFM6EEsllMXyi7OCpxqjQ5MFQ fAptdtw4lYJgxid388Xm2cNzTy4r8ruvg.zpILX0wdl9apbxoZc0Z3i1C4T5 pKmjp5PJlaf4NU49y13GuCW8nUgKSGuerUS5a5SSWXahrEaU8hZ5U1CHFe7o .0Jaiox.XCiMAE7FdbhPs6s6Vw_WAahl6YkDdPF_4eoUg0Q-- X-Yahoo-SMTP: Zybq.GKswBCVR5oJTLrx1T39m2F9FA-- From: Alex Xu To: xen-devel@lists.xen.org Date: Sun, 20 Dec 2015 11:41:34 -0500 Message-Id: <1450629694-4783-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..9c0b286 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=" "