From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9854 invoked from network); 7 Sep 1999 08:41:58 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 7 Sep 1999 08:41:58 -0000 Received: (qmail 24924 invoked by alias); 7 Sep 1999 08:41:36 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 2578 Received: (qmail 24917 invoked from network); 7 Sep 1999 08:41:35 -0000 Date: Tue, 7 Sep 1999 10:41:31 +0200 (MET DST) Message-Id: <199909070841.KAA03729@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-users@sunsite.auc.dk In-reply-to: Gabor's message of Mon, 6 Sep 1999 11:19:08 -0400 Subject: Re: typeset -Z broken? -R broken too? 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