From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3960 invoked by alias); 13 Dec 2016 06:28:33 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 40172 Received: (qmail 21251 invoked from network); 13 Dec 2016 06:28:32 -0000 X-Qmail-Scanner-Diagnostics: from out4-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(66.111.4.28):SA:0(-0.7/5.0):. Processed in 1.271402 secs); 13 Dec 2016 06:28:32 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= mesmtp; bh=gV1DyL24Fsp8xI/8H3Jlnwxdo6g=; b=vb+TgSYorGq2v3AmuIScP HVj59i/ZMWMfGowFXLepO1QdmzONJdV+Qa4EzTX6RNWAy01P9X8iA5VNhcOZ2TE8 H/c5c29XWsDSuSE1dQO60YGMpcXKyQTH0bV+wYFWw9Q70mlCHKua82xvc34UcZRG stoV8jhTEryjOD0rcvhoDw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= smtpout; bh=gV1DyL24Fsp8xI/8H3Jlnwxdo6g=; b=OzTIuvdnJkAeVWssjJV1 SCXVifQNL2YlXOgj9SLt61CvNjb3vOE+oij3y9DZr6BwhscpSXro1GU0B2sK2NWN 0OB+FGvw7xDepZlO8aOLj+809dhY13Wtgq9iKP+emF005ZJ19Z4/B2yyQoRYWQz5 JAQ4y4/OaEBVcCBtqwXp0WQ= X-ME-Sender: X-Sasl-enc: PbDHSg37WyK27YsTr+P5K+kJwzC+AkgVRRbD569YgHYZ 1481610502 Date: Tue, 13 Dec 2016 06:25:31 +0000 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: Re: 5.3: printf - Message-ID: <20161213062531.GA7133@fujitsu.shahaf.local2> References: <20161212234102.GB5457@fujitsu.shahaf.local2> <161212202110.ZM19667@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <161212202110.ZM19667@torch.brasslantern.com> User-Agent: Mutt/1.5.23 (2014-03-12) Bart Schaefer wrote on Mon, Dec 12, 2016 at 20:21:10 -0800: > On Dec 12, 11:41pm, Daniel Shahaf wrote: > } > } % printf - > } printf: not enough arguments > } > } Happens in sh mode too. dash and bash [that's what I have handy] print > } a minus sign. > > I was going to blame this on zsh generally treating a single "-" like > "--" in argument lists (which is documented), but something is fishy: > > torch% printf -- -- > printf: not enough arguments > torch% printf - - > -% > torch% printf - -- > printf: not enough arguments > torch% printf -- - > -% > torch% printf -- -- -- > --% I think these should: • In sh mode, emit argv[1] and ignore the others: it is the format string even if it happens to start with a minus. • In zsh mode, interpret argv[1] as end-of-options, then emit argv[2] and ignore any other arguments: argv[2] is the format string. Another case: «printf -x». > ("%" there is PROMPT_SP of course). >