1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-27 04:40:59 +01:00

21890: fix segmentation error in left prompt truncation and a couple of minor

inconsistencies
This commit is contained in:
Peter Stephenson 2005-10-19 21:59:34 +00:00
parent 26e60b1f3a
commit 2ddaeb605f
4 changed files with 12 additions and 6 deletions

View file

@ -3368,7 +3368,7 @@ bin_print(char *name, char **args, Options ops, int func)
*/
char *str = unmetafy(promptexpand(metafy(args[n], len[n],
META_NOALLOC), 0, NULL, NULL), &len[n]);
args[n] = dupstring(str);
args[n] = dupstrpfx(str, len[n]);
free(str);
}
/* -D option -- interpret as a directory, and use ~ */
@ -3378,9 +3378,9 @@ bin_print(char *name, char **args, Options ops, int func)
queue_signals();
d = finddir(args[n]);
if(d) {
char *arg = zhalloc(strlen(args[n]) + 1);
sprintf(arg, "~%s%s", d->nam,
args[n] + strlen(d->dir));
int dirlen = strlen(d->dir);
char *arg = zhalloc(len[n] - dirlen + strlen(d->nam) + 2);
sprintf(arg, "~%s%s", d->nam, args[n] + dirlen);
args[n] = arg;
len[n] = strlen(args[n]);
}