This commit is contained in:
Miloslav Trmac 2005-07-07 13:53:22 +00:00
parent e22ce2bdea
commit edfb6dba38
2 changed files with 157 additions and 1 deletions

151
tcsh-6.14.00-dashn.patch Normal file
View File

@ -0,0 +1,151 @@
Index: tcsh/sh.func.c
===================================================================
--- tcsh.orig/sh.func.c
+++ tcsh/sh.func.c
@@ -386,7 +386,7 @@ doif(Char **v, struct command *kp)
Char **vv;
v++;
- i = expr(&v);
+ i = noexec ? 1 : expr(&v);
vv = v;
if (*vv == NULL)
stderror(ERR_NAME | ERR_EMPTYIF);
@@ -436,7 +436,8 @@ doelse (Char **v, struct command *c)
{
USE(c);
USE(v);
- search(TC_ELSE, 0, NULL);
+ if (!noexec)
+ search(TC_ELSE, 0, NULL);
}
/*ARGSUSED*/
@@ -446,7 +447,9 @@ dogoto(Char **v, struct command *c)
Char *lp;
USE(c);
- gotolab(lp = globone(v[1], G_ERROR));
+ lp = globone(v[1], G_ERROR);
+ if (!noexec)
+ gotolab(lp);
xfree((ptr_t) lp);
}
@@ -489,7 +492,9 @@ doswitch(Char **v, struct command *c)
v--;
if (*v)
stderror(ERR_SYNTAX);
- search(TC_SWITCH, 0, lp = globone(cp, G_ERROR));
+ lp = globone(cp, G_ERROR);
+ if (!noexec)
+ search(TC_SWITCH, 0, lp);
xfree((ptr_t) lp);
}
@@ -499,10 +504,10 @@ dobreak(Char **v, struct command *c)
{
USE(v);
USE(c);
- if (whyles)
- toend();
- else
+ if (whyles == NULL)
stderror(ERR_NAME | ERR_NOTWHILE);
+ if (!noexec)
+ toend();
}
/*ARGSUSED*/
@@ -555,7 +560,7 @@ doforeach(Char **v, struct command *c)
gflag = 0, tglob(v);
if (gflag) {
v = globall(v);
- if (v == 0)
+ if (v == 0 && !noexec)
stderror(ERR_NAME | ERR_NOMATCH);
}
else {
@@ -576,7 +581,8 @@ doforeach(Char **v, struct command *c)
zlast = TC_FOREACH;
if (intty)
preread();
- doagain();
+ if (!noexec)
+ doagain();
}
/*ARGSUSED*/
@@ -594,11 +600,13 @@ dowhile(Char **v, struct command *c)
* Implement prereading here also, taking care not to evaluate the
* expression before the loop has been read up from a terminal.
*/
- if (intty && !again)
+ if (noexec)
+ status = 0;
+ else if (intty && !again)
status = !exp0(&v, 1);
else
status = !expr(&v);
- if (*v)
+ if (*v && !noexec)
stderror(ERR_NAME | ERR_EXPRESSION);
if (!again) {
struct whyle *nwp =
@@ -653,7 +661,8 @@ doend(Char **v, struct command *c)
if (!whyles)
stderror(ERR_NAME | ERR_NOTWHILE);
btell(&whyles->w_end);
- doagain();
+ if (!noexec)
+ doagain();
}
/*ARGSUSED*/
@@ -664,7 +673,8 @@ docontin(Char **v, struct command *c)
USE(c);
if (!whyles)
stderror(ERR_NAME | ERR_NOTWHILE);
- doagain();
+ if (!noexec)
+ doagain();
}
static void
@@ -701,6 +711,8 @@ dorepeat(Char **v, struct command *kp)
i *= getn(v[1]);
lshift(v, 2);
} while (v[0] != NULL && Strcmp(v[0], STRrepeat) == 0);
+ if (noexec)
+ i = 1;
if (setintr)
#ifdef BSDSIGS
@@ -733,7 +745,8 @@ doswbrk(Char **v, struct command *c)
{
USE(v);
USE(c);
- search(TC_BRKSW, 0, NULL);
+ if (!noexec)
+ search(TC_BRKSW, 0, NULL);
}
int
Index: tcsh/sh.sem.c
===================================================================
--- tcsh.orig/sh.sem.c
+++ tcsh/sh.sem.c
@@ -283,10 +283,12 @@ execute(struct command *t, int wanttty,
* Check if we have a builtin function and remember which one.
*/
bifunc = isbfunc(t);
- if (noexec && bifunc) {
+ if (noexec) {
/*
* Continue for builtins that are part of the scripting language
*/
+ if (bifunc == NULL)
+ break;
if (bifunc->bfunct != (bfunc_t)dobreak &&
bifunc->bfunct != (bfunc_t)docontin &&
bifunc->bfunct != (bfunc_t)doelse &&

View File

@ -3,7 +3,7 @@
Summary: An enhanced version of csh, the C shell.
Name: tcsh
Version: 6.14
Release: 2
Release: 3
License: distributable
Group: System Environment/Shells
Source: ftp://ftp.astron.com/pub/tcsh/tcsh-%{version}.00.tar.gz
@ -11,6 +11,7 @@ Patch0: tcsh-6.14.00-config.patch
Patch1: tcsh-6.14.00-closem.patch
Patch2: tcsh-6.14.00-iconv.patch
Patch3: tcsh-6.14.00-lsF.patch
Patch4: tcsh-6.14.00-dashn.patch
Provides: csh = %{version}
Prereq: fileutils, grep
URL: http://www.tcsh.org/
@ -31,6 +32,7 @@ like syntax.
%patch1 -p1 -b .closem
%patch2 -p1 -b .iconv
%patch3 -p1 -b .lsF
%patch4 -p1 -b .dashn
nroff -me eight-bit.me > eight-bit.txt
@ -98,6 +100,9 @@ fi
%{_mandir}/*/*
%changelog
* Thu Jul 7 2005 Miloslav Trmac <mitr@redhat.com> - 6.14-3
- Fix -n (#162187)
* Mon Jun 20 2005 Miloslav Trmac <mitr@redhat.com> - 6.14-2
- Backport a column width calculation bugfix (#160760)