From stdcxx-commits-return-743-apmail-incubator-stdcxx-commits-archive=incubator.apache.org@incubator.apache.org Sat Jun 03 03:15:33 2006 Return-Path: Delivered-To: apmail-incubator-stdcxx-commits-archive@www.apache.org Received: (qmail 19448 invoked from network); 3 Jun 2006 03:15:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 3 Jun 2006 03:15:33 -0000 Received: (qmail 86835 invoked by uid 500); 3 Jun 2006 03:15:33 -0000 Delivered-To: apmail-incubator-stdcxx-commits-archive@incubator.apache.org Received: (qmail 86811 invoked by uid 500); 3 Jun 2006 03:15:32 -0000 Mailing-List: contact stdcxx-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-commits@incubator.apache.org Received: (qmail 86800 invoked by uid 99); 3 Jun 2006 03:15:32 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Jun 2006 20:15:32 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Jun 2006 20:15:32 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id EEA661A983A; Fri, 2 Jun 2006 20:15:11 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r411363 - /incubator/stdcxx/trunk/tests/src/printf.cpp Date: Sat, 03 Jun 2006 03:15:11 -0000 To: stdcxx-commits@incubator.apache.org From: sebor@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060603031511.EEA661A983A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: sebor Date: Fri Jun 2 20:15:11 2006 New Revision: 411363 URL: http://svn.apache.org/viewvc?rev=411363&view=rev Log: 2006-06-02 Martin Sebor * printf.cpp (_rw_fmtexpr): Added the %{$parameter!:word} drective as an extension and corrected logic error (passing a pointer to an auto array to free()). Modified: incubator/stdcxx/trunk/tests/src/printf.cpp Modified: incubator/stdcxx/trunk/tests/src/printf.cpp URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/src/printf.cpp?rev=411363&r1=411362&r2=411363&view=diff ============================================================================== --- incubator/stdcxx/trunk/tests/src/printf.cpp (original) +++ incubator/stdcxx/trunk/tests/src/printf.cpp Fri Jun 2 20:15:11 2006 @@ -2819,7 +2819,7 @@ char *param = spec.strarg; // look for the first operator character (if any) - char* word = strpbrk (param, ":+-=?"); + char* word = strpbrk (param, ":+-=?!"); if (word) { if (':' == *word) { if ( '+' == word [1] || '-' == word [1] @@ -2834,6 +2834,13 @@ // '=', or '?' is not special } } + else if ('!' == word [0] && ':' == word [1]) { + // extension + oper [0] = word [0]; + oper [1] = word [1]; + *word = '\0'; + word += 2; + } else { oper [0] = *word; *word++ = '\0'; @@ -2875,6 +2882,11 @@ // | ${parameter+word} | word | word | null | // +--------------------+-------------+-------------+-------------+ + // Extension: + // +--------------------+-------------+-------------+-------------+ + // | ${parameter!:word} | assign word | assign word | assign word | + // +--------------------+-------------+-------------+-------------+ + int assign = 0; int error = 0; @@ -2931,6 +2943,11 @@ } break; + case '!': + val = word ? word : ""; + assign = 1; + break; + default: break; } @@ -2953,7 +2970,7 @@ rw_putenv (pbuf); if (pbuf != varbuf) - free (varbuf); + free (pbuf); } if (error) {