From: Thien-Thi Nguyen Date: Wed, 24 Dec 2003 07:31:42 +0000 (+0000) Subject: (tparam1): Add handling for `%pN', which X-Git-Tag: ttn-vms-21-2-B4~8193 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9ad4bf7a45709eda54e2aa458a92413462506ea4;p=emacs.git (tparam1): Add handling for `%pN', which means use param N for the next substitution. --- diff --git a/src/tparam.c b/src/tparam.c index 7306e0d5c10..ea208692161 100644 --- a/src/tparam.c +++ b/src/tparam.c @@ -144,7 +144,9 @@ tparam1 (string, outstring, len, up, left, argp) 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; @@ -180,7 +182,10 @@ tparam1 (string, outstring, len, up, left, argp) 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. */ @@ -203,7 +208,10 @@ tparam1 (string, outstring, len, up, left, argp) *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 %+. */