From: Zefram <A.Main@dcs.warwick.ac.uk>
To: zsh-workers@math.gatech.edu (Z Shell workers mailing list)
Subject: 8-bit output fixes
Date: Sat, 18 May 1996 12:52:03 +0100 (BST) [thread overview]
Message-ID: <29410.199605181152@stone.dcs.warwick.ac.uk> (raw)
-----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-----
reply other threads:[~1996-05-18 12:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=29410.199605181152@stone.dcs.warwick.ac.uk \
--to=a.main@dcs.warwick.ac.uk \
--cc=zsh-workers@math.gatech.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).