Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
8-bit output fixes
- X-seq: zsh-workers 1093
- From: Zefram <A.Main@xxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx (Z Shell workers mailing list)
- Subject: 8-bit output fixes
- Date: Sat, 18 May 1996 12:52:03 +0100 (BST)
-----BEGIN PGP SIGNED MESSAGE-----
This patch fixes the outputs in zerr(nam) and hashtable.c to use
demetafying output functions as appropriate.
-zefram
Index: hashtable.c
*** hashtable.c 1996/05/10 08:44:02 1.2
--- hashtable.c 1996/05/18 10:08:35
***************
*** 596,620 ****
Cmdnam cn = (Cmdnam) hn;
if ((printflags & PRINT_WHENCE_CSH) || (printflags & PRINT_WHENCE_SIMPLE)) {
! if (cn->flags & HASHED)
! printf("%s\n", cn->u.cmd);
! else
! printf("%s/%s\n", *(cn->u.name), cn->nam);
return;
}
if (printflags & PRINT_WHENCE_VERBOSE) {
! if (cn->flags & HASHED)
! printf("%s is hashed to %s\n", cn->nam, cn->u.cmd);
! else
! printf("%s is %s/%s\n", cn->nam, *(cn->u.name), cn->nam);
return;
}
! if (cn->flags & HASHED)
! printf("%s=%s\n", cn->nam, cn->u.cmd);
! else
! printf("%s=%s/%s\n", cn->nam, *(cn->u.name), cn->nam);
}
/***************************************/
--- 596,643 ----
Cmdnam cn = (Cmdnam) hn;
if ((printflags & PRINT_WHENCE_CSH) || (printflags & PRINT_WHENCE_SIMPLE)) {
! if (cn->flags & HASHED) {
! zputs(cn->u.cmd, stdout);
! putchar('\n');
! } else {
! zputs(*(cn->u.name), stdout);
! putchar('/');
! zputs(cn->u.cmd, stdout);
! putchar('\n');
! }
return;
}
if (printflags & PRINT_WHENCE_VERBOSE) {
! if (cn->flags & HASHED) {
! nicezputs(cn->nam, stdout);
! printf(" is hashed to ");
! nicezputs(cn->u.cmd, stdout);
! putchar('\n');
! } else {
! nicezputs(cn->nam, stdout);
! printf(" is ");
! nicezputs(*(cn->u.name), stdout);
! putchar('/');
! nicezputs(cn->u.cmd, stdout);
! putchar('\n');
! }
return;
}
! if (cn->flags & HASHED) {
! quotedzputs(cn->nam, stdout);
! putchar('=');
! quotedzputs(cn->u.cmd, stdout);
! putchar('\n');
! } else {
! quotedzputs(cn->nam, stdout);
! putchar('=');
! quotedzputs(*(cn->u.name), stdout);
! putchar('/');
! quotedzputs(cn->u.cmd, stdout);
! putchar('\n');
! }
}
/***************************************/
***************
*** 718,730 ****
if ((printflags & PRINT_NAMEONLY) ||
((printflags & PRINT_WHENCE_SIMPLE) &&
!(printflags & PRINT_WHENCE_FUNCDEF))) {
! printf("%s\n", f->nam);
return;
}
if ((printflags & PRINT_WHENCE_VERBOSE) &&
!(printflags & PRINT_WHENCE_FUNCDEF)) {
! printf("%s is a shell function\n", f->nam);
return;
}
--- 741,755 ----
if ((printflags & PRINT_NAMEONLY) ||
((printflags & PRINT_WHENCE_SIMPLE) &&
!(printflags & PRINT_WHENCE_FUNCDEF))) {
! zputs(f->nam, stdout);
! putchar('\n');
return;
}
if ((printflags & PRINT_WHENCE_VERBOSE) &&
!(printflags & PRINT_WHENCE_FUNCDEF)) {
! nicezputs(f->nam, stdout);
! printf(" is a shell function\n");
return;
}
***************
*** 733,744 ****
if (f->flags & PM_TAGGED)
printf("traced ");
if (!f->funcdef) {
! printf("%s ()\n", f->nam);
return;
}
t = getpermtext((void *) dupstruct((void *) f->funcdef));
! printf("%s () {\n\t%s\n}\n", f->nam, t);
zsfree(t);
}
--- 758,773 ----
if (f->flags & PM_TAGGED)
printf("traced ");
if (!f->funcdef) {
! nicezputs(f->nam, stdout);
! printf(" ()\n");
return;
}
t = getpermtext((void *) dupstruct((void *) f->funcdef));
! quotedzputs(f->nam, stdout);
! printf(" () {\n\t");
! zputs(t, stdout);
! printf("\n}\n");
zsfree(t);
}
***************
*** 920,954 ****
Alias a = (Alias) hn;
if (printflags & PRINT_NAMEONLY) {
! quotedzputs(a->nam, stdout);
putchar('\n');
return;
}
if (printflags & PRINT_WHENCE_SIMPLE) {
! quotedzputs(a->text, stdout);
putchar('\n');
return;
}
if (printflags & PRINT_WHENCE_CSH) {
! quotedzputs(a->nam, stdout);
if (a->flags & ALIAS_GLOBAL)
printf(": globally aliased to ");
else
printf(": aliased to ");
! quotedzputs(a->text, stdout);
putchar('\n');
return;
}
if (printflags & PRINT_WHENCE_VERBOSE) {
! quotedzputs(a->nam, stdout);
if (a->flags & ALIAS_GLOBAL)
printf(" is a global alias for ");
else
printf(" is an alias for ");
! quotedzputs(a->text, stdout);
putchar('\n');
return;
}
--- 949,983 ----
Alias a = (Alias) hn;
if (printflags & PRINT_NAMEONLY) {
! zputs(a->nam, stdout);
putchar('\n');
return;
}
if (printflags & PRINT_WHENCE_SIMPLE) {
! zputs(a->text, stdout);
putchar('\n');
return;
}
if (printflags & PRINT_WHENCE_CSH) {
! nicezputs(a->nam, stdout);
if (a->flags & ALIAS_GLOBAL)
printf(": globally aliased to ");
else
printf(": aliased to ");
! nicezputs(a->text, stdout);
putchar('\n');
return;
}
if (printflags & PRINT_WHENCE_VERBOSE) {
! nicezputs(a->nam, stdout);
if (a->flags & ALIAS_GLOBAL)
printf(" is a global alias for ");
else
printf(" is an alias for ");
! nicezputs(a->text, stdout);
putchar('\n');
return;
}
***************
*** 1021,1040 ****
}
if (printflags & PRINT_NAMEONLY) {
! printf("%s\n", p->nam);
return;
}
/* How the value is displayed depends *
* on the type of the parameter */
! printf("%s=", p->nam);
switch (PM_TYPE(p->flags)) {
case PM_SCALAR:
/* string: simple output */
if (p->gets.cfn && (t = p->gets.cfn(p)))
! puts(t);
! else
! putchar('\n');
break;
case PM_INTEGER:
/* integer */
--- 1050,1070 ----
}
if (printflags & PRINT_NAMEONLY) {
! zputs(p->nam, stdout);
! putchar('\n');
return;
}
/* How the value is displayed depends *
* on the type of the parameter */
! quotedzputs(p->nam, stdout);
! putchar('=');
switch (PM_TYPE(p->flags)) {
case PM_SCALAR:
/* string: simple output */
if (p->gets.cfn && (t = p->gets.cfn(p)))
! quotedzputs(t, stdout);
! putchar('\n');
break;
case PM_INTEGER:
/* integer */
***************
*** 1044,1056 ****
/* array */
putchar('(');
u = p->gets.afn(p);
! if (!*u)
! printf(")\n");
! else {
! while (u[1])
! printf("%s ", *u++);
! printf("%s)\n", *u);
}
break;
}
}
--- 1074,1085 ----
/* array */
putchar('(');
u = p->gets.afn(p);
! while (*u) {
! quotedzputs(*u++, stdout);
! if(u[1])
! putchar(' ');
}
+ printf(")\n");
break;
}
}
***************
*** 1179,1185 ****
Nameddir nd = (Nameddir) hn;
if (printflags & PRINT_NAMEONLY) {
! quotedzputs(nd->nam, stdout);
putchar('\n');
return;
}
--- 1208,1214 ----
Nameddir nd = (Nameddir) hn;
if (printflags & PRINT_NAMEONLY) {
! zputs(nd->nam, stdout);
putchar('\n');
return;
}
Index: utils.c
*** utils.c 1996/05/18 09:39:24 1.12
--- utils.c 1996/05/18 09:48:43
***************
*** 52,58 ****
return;
errflag = 1;
trashzle();
! fprintf(stderr, "%s: ", (isset(SHINSTDIN)) ? "zsh" : unmeta(argzero));
zerrnam(NULL, fmt, str, num);
}
--- 52,59 ----
return;
errflag = 1;
trashzle();
! nicezputs(isset(SHINSTDIN) ? "zsh" : argzero, stderr);
! fputs(": ", stderr);
zerrnam(NULL, fmt, str, num);
}
***************
*** 65,82 ****
return;
errflag = 1;
trashzle();
! if (isset(SHINSTDIN))
! fprintf(stderr, "%s: ", cmd);
! else
! fprintf(stderr, "%s: %s: ", argzero, cmd);
}
while (*fmt)
if (*fmt == '%') {
fmt++;
switch (*fmt++) {
case 's':
! while (*str)
! niceputc(*str == Meta ? (str += 2, str[-1] ^ 32) : *str++, stderr);
break;
case 'l':
while (num--)
--- 66,84 ----
return;
errflag = 1;
trashzle();
! if(unset(SHINSTDIN)) {
! nicezputs(argzero, stderr);
! fputs(": ", stderr);
! }
! nicezputs(cmd, stderr);
! fputs(": ", stderr);
}
while (*fmt)
if (*fmt == '%') {
fmt++;
switch (*fmt++) {
case 's':
! nicezputs(str, stderr);
break;
case 'l':
while (num--)
-----BEGIN PGP SIGNATURE-----
Version: 2.6.2
iQCVAwUBMZ2kLHD/+HJTpU/hAQHh1AQAizeCtaigV8zPwG7KgJIlQT8pmpX8uav8
VczSVwlLf0ktDzgx4KMPxBkB/tDfKcYekpEVJDFTd6cIYiJ7lE139H6nUqrTiaxj
jqXLUEblDSokUfoSoj3ZUsiieTRulh/+VmWc9METE5+SejHxYFdBE4Ycq7iroXyr
SrmG+/W8FWA=
=rjsE
-----END PGP SIGNATURE-----
Messages sorted by:
Reverse Date,
Date,
Thread,
Author