diff options
author | Thien-Thi Nguyen <ttn@gnuvola.org> | 2003-12-24 07:31:42 +0000 |
---|---|---|
committer | Thien-Thi Nguyen <ttn@gnuvola.org> | 2003-12-24 07:31:42 +0000 |
commit | 9ad4bf7a45709eda54e2aa458a92413462506ea4 (patch) | |
tree | 8c22eda65048b7e2639376d1860d409443ecbae3 /src/tparam.c | |
parent | 08a39b830496f07d491f94d205da822ba7c05a1f (diff) | |
download | emacs-9ad4bf7a45709eda54e2aa458a92413462506ea4.tar.gz |
(tparam1): Add handling for `%pN', which
means use param N for the next substitution.
Diffstat (limited to 'src/tparam.c')
-rw-r--r-- | src/tparam.c | 14 |
1 files changed, 11 insertions, 3 deletions
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 %+. */ |