zsh-users
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-users@sunsite.auc.dk
Subject: Re: typeset -Z broken? -R broken too?
Date: Tue, 7 Sep 1999 10:41:31 +0200 (MET DST)	[thread overview]
Message-ID: <199909070841.KAA03729@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Gabor's message of Mon, 6 Sep 1999 11:19:08 -0400


Gabor wrote:

> It appears that -R is broken, too.
>
> ...
> 
> Also, even with the fix here is zsh for -Z

Ah. The documentation for `-Z' wasn't clear enough for me...

Bye
 Sven

--- os/subst.c	Mon Sep  6 14:51:27 1999
+++ Src/subst.c	Tue Sep  7 10:37:14 1999
@@ -1142,27 +1142,28 @@
 		case PM_RIGHT_B:
 		case PM_RIGHT_Z:
 		case PM_RIGHT_Z | PM_RIGHT_B:
-		    if (strlen(val) < fwidth) {
-			t = NULL;
-			if (v->pm->flags & PM_RIGHT_Z) {
-			    for (t = val; iblank(*t); t++);
-			    if (t && idigit(*t))
-				val = t, t = NULL;
-			}
-			if (!t) {
+		    {
+			int zero = 1;
+
+			if (strlen(val) < fwidth) {
+			    if (v->pm->flags & PM_RIGHT_Z) {
+				for (t = val; iblank(*t); t++);
+				if (!*t || !idigit(*t))
+				    zero = 0;
+			    }
 			    t = (char *)ncalloc(fwidth + 1);
-			    memset(t, (v->pm->flags & PM_RIGHT_B) ? ' ' : '0', 
-				   fwidth);
+			    memset(t, (((v->pm->flags & PM_RIGHT_B) || !zero) ?
+				       ' ' : '0'), fwidth);
 			    if ((t0 = strlen(val)) > fwidth)
 				t0 = fwidth;
 			    strcpy(t + (fwidth - t0), val);
 			    val = t;
+			} else {
+			    t = (char *)ncalloc(fwidth + 1);
+			    t[fwidth] = '\0';
+			    strncpy(t, val + strlen(val) - fwidth, fwidth);
+			    val = t;
 			}
-		    } else {
-			t = (char *)ncalloc(fwidth + 1);
-			t[fwidth] = '\0';
-			strncpy(t, val + strlen(val) - fwidth, fwidth);
-			val = t;
 		    }
 		    break;
 		}

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


             reply	other threads:[~1999-09-07  8:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-09-07  8:41 Sven Wischnowsky [this message]
  -- strict thread matches above, loose matches on Subject: below --
1999-09-05 12:57 typeset -Z broken? Gabor
1999-09-06 15:19 ` typeset -Z broken? -R broken too? Gabor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199909070841.KAA03729@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-users@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).