* check.t: add new regression test "typeset-padding-1" according to TFM
* edit.c: remove debug stuff again; next time better use shl.c functions ;) * sh.h: add format attributes to a few shf functions * histrap.c, var.c: fix format string mistakes * main.c, sh.h: error_prefix and warningf take bool not int * misc.c: make chvt() stuff use shf_* functions * misc.c: rewrite the TIOCSTTY stuff to be better integrated in mksh, since it originally was an external patch * misc.c: chvt() no longer fails if e.g. chown fails due to e.g. R/O / fs * var.c: fix typeset padding for right-justified zero-filled
This commit is contained in:
12
var.c
12
var.c
@ -2,7 +2,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.23 2006/08/18 18:48:26 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.24 2006/11/10 01:13:52 tg Exp $");
|
||||
|
||||
/*
|
||||
* Variables
|
||||
@ -510,10 +510,12 @@ formatstr(struct tbl *vp, const char *s)
|
||||
s += slen - vp->u2.field;
|
||||
slen = vp->u2.field;
|
||||
}
|
||||
shf_snprintf(p, nlen + 1,
|
||||
((vp->flag & ZEROFIL) && digit(*s)) ?
|
||||
"%0*s%.*s" : "%*s%.*s",
|
||||
vp->u2.field - slen, null, slen, s);
|
||||
if (vp->u2.field - slen)
|
||||
memset(p, (vp->flag & ZEROFIL) ? '0' : ' ',
|
||||
vp->u2.field - slen);
|
||||
shf_snprintf(p + vp->u2.field - slen,
|
||||
nlen + 1 - (vp->u2.field - slen),
|
||||
"%.*s", slen, s);
|
||||
} else {
|
||||
/* strip leading spaces/zeros */
|
||||
while (isspace((unsigned char)*s))
|
||||
|
Reference in New Issue
Block a user