aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2003-12-17 03:08:22 +0000
committerClint Adams <clint@users.sourceforge.net>2003-12-17 03:08:22 +0000
commit066a24c46bbf11032bcdde5f019e415af6505962 (patch)
treeb55de955b84769e4927828524ab3a7e0ef13b826
parent1e1ed87dc5d309c7d5e3056659a652df6c1cb5d9 (diff)
downloadzsh-066a24c46bbf11032bcdde5f019e415af6505962.tar.gz
zsh-066a24c46bbf11032bcdde5f019e415af6505962.tar.xz
zsh-066a24c46bbf11032bcdde5f019e415af6505962.zip
Oliver: 18626: Src/Modules/terminfo.c: Try to do a better job
of arg support for echoti, fixing compile problem on 64-bit Solaris
-rw-r--r--ChangeLog2
-rw-r--r--Src/Modules/terminfo.c42
2 files changed, 26 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 48466c91a..be9a63e3a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,8 @@
* Stephen RĂ¼ger: 19255: Completion/Debian/Command/_apt: update
to work with APT 0.5.14
+ * Oliver: 18626: Src/Modules/terminfo.c: Try to do a better job
+ of arg support for echoti, fixing compile problem on 64-bit Solaris
2003-12-16 Oliver Kiddle <opk@zsh.org>
diff --git a/Src/Modules/terminfo.c b/Src/Modules/terminfo.c
index b3fb83e2a..e450c24a9 100644
--- a/Src/Modules/terminfo.c
+++ b/Src/Modules/terminfo.c
@@ -65,8 +65,10 @@ static Param terminfo_pm;
static int
bin_echoti(char *name, char **argv, char *ops, int func)
{
- char *s, *t, *u;
- int num, argct;
+ char *s, *t, **u;
+ int arg, num, strarg = 0;
+ long pars[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
+ char *strcap[] = { "pfkey", "pfloc", "pfx", "pln", "pfxl", NULL };
s = *argv++;
/* This depends on the termcap stuff in init.c */
@@ -98,28 +100,32 @@ bin_echoti(char *name, char **argv, char *ops, int func)
zwarnnam(name, "no such terminfo capability: %s", s, 0);
return 1;
}
- /* count the number of arguments required */
- for (argct = 0, u = t; *u; u++)
- if (*u == '%') {
- if (u++, (*u == 'd' || *u == '2' || *u == '3' || *u == '.' ||
- *u == '+'))
- argct++;
- }
- /* check that the number of arguments provided is correct */
- if (arrlen(argv) != argct) {
- zwarnnam(name, (arrlen(argv) < argct) ? "not enough arguments" :
- "too many arguments", NULL, 0);
+ /* check that the number of arguments provided is not too high */
+ if (arrlen(argv) > 9) {
+ zwarnnam(name, "too many arguments", NULL, 0);
return 1;
}
+
+ /* check if we have a capability taking non-integers for parameters */
+ for (u = strcap; *u && !strarg; u++)
+ strarg = !strcmp(s, *u);
+
+ /* get the arguments */
+ for (arg=0; argv[arg]; arg++) {
+ if (strarg && arg > 0)
+ pars[arg] = (long) argv[arg];
+ else
+ pars[arg] = atoi(argv[arg]);
+ }
+
/* output string, through the proper termcap functions */
- if (!argct)
- tputs(t, 1, putraw);
+ if (!arg)
+ putp(t);
else {
- num = (argv[1]) ? atoi(argv[1]) : atoi(*argv);
- tputs(tparm(t, atoi(*argv)), num, putraw);
+ putp(tparm(t, pars[0], pars[1], pars[2], pars[3], pars[4],
+ pars[5], pars[6], pars[7], pars[8]));
}
return 0;
-
}
/**/