means use param N for the next substitution.
int outlen = 0;
register int tem;
- int *old_argp = argp;
+ int *old_argp = argp; /* can move */
+ int *fixed_argp = argp; /* never moves */
+ int explicit_param_p = 0; /* set by %p */
int doleft = 0;
int doup = 0;
if (c == '%')
{
c = *p++;
- tem = *argp;
+ if (explicit_param_p)
+ explicit_param_p = 0;
+ else
+ tem = *argp;
switch (c)
{
case 'd': /* %d means output in decimal. */
*op++ = tem % 10 + '0';
argp++;
break;
-
+ case 'p': /* %pN means use param N for next subst. */
+ tem = fixed_argp[(*p++) - '1'];
+ explicit_param_p = 1;
+ break;
case 'C':
/* For c-100: print quotient of value by 96, if nonzero,
then do like %+. */