1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-05-31 20:36:03 +02:00

Make printf %s handle an embedded null (21579).

This commit is contained in:
Wayne Davison 2005-08-10 07:45:17 +00:00
parent c73dd46019
commit b97ff864af

View File

@ -3745,21 +3745,24 @@ bin_print(char *name, char **args, Options ops, int func)
d[1] = '\0';
switch (*d = *c) {
case 'c':
if (curarg) {
if (curarg)
intval = *curarg;
} else
else
intval = 0;
print_val(intval);
break;
case 's':
stringval = curarg ? curarg : &nullstr;
print_val(stringval);
break;
case 'b':
if (curarg) {
char *b;
int l;
char *b = getkeystring(metafy(curarg, curlen, META_USEHEAP), &l,
OPT_ISSET(ops,'b') ? 2 : 0, &nnl);
if (*c == 'b') {
b = getkeystring(metafy(curarg, curlen, META_USEHEAP), &l,
OPT_ISSET(ops,'b') ? 2 : 0, &nnl);
} else {
b = curarg;
l = curlen;
}
/* handle width/precision here and use fwrite so that
* nul characters can be output */
if (prec >= 0 && prec < l) l = prec;