Mercurial > emacs
changeset 8141:e3859c43c6f4
(doprnt): Handle padding on %c.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 05 Jul 1994 07:24:16 +0000 |
parents | ed2ac2e85eef |
children | 66a5487be3a7 |
files | src/doprnt.c |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/doprnt.c Tue Jul 05 07:23:18 1994 +0000 +++ b/src/doprnt.c Tue Jul 05 07:24:16 1994 +0000 @@ -62,6 +62,7 @@ char *fmtcpy; int minlen; int size; /* Field width factor; e.g., %90d */ + char charbuf[2]; /* Used for %c. */ if (format_end == 0) format_end = format + strlen (format); @@ -154,6 +155,7 @@ /* Copy string into final output, truncating if no room. */ doit: tem = strlen (string); + doit1: if (minlen > 0) { while (minlen > tem && bufsize > 0) @@ -184,9 +186,12 @@ case 'c': if (cnt == nargs) error ("not enough arguments for format string"); - *bufptr++ = (int) args[cnt++]; - bufsize--; - continue; + *charbuf = (int) args[cnt++]; + string = charbuf; + tem = 1; + if (fmtcpy[1] != 'c') + minlen = atoi (&fmtcpy[1]); + goto doit1; case '%': fmt--; /* Drop thru and this % will be treated as normal */