*/
#ifndef lint
-static char sccsid[] = "@(#)func.c 5.22 (Berkeley) %G%";
+static char sccsid[] = "@(#)func.c 5.25 (Berkeley) %G%";
#endif /* not lint */
#include <sys/types.h>
*/
zlast = T_GOTO;
for (wp = whyles; wp; wp = wp->w_next)
- if (wp->w_end == 0) {
+ if (wp->w_end.type == I_SEEK) {
search(T_BREAK, 0, NULL);
- wp->w_end = fseekp;
+ btell(&wp->w_end);
}
else
- bseek(wp->w_end);
+ bseek(&wp->w_end);
search(T_GOTO, 0, lp = globone(v[1], G_ERROR));
xfree((ptr_t) lp);
/*
nwp = (struct whyle *) xcalloc(1, sizeof *nwp);
nwp->w_fe = nwp->w_fe0 = v;
gargv = 0;
- nwp->w_start = fseekp;
+ btell(&nwp->w_start);
nwp->w_fename = Strsave(cp);
nwp->w_next = whyles;
whyles = nwp;
struct command *t;
{
register int status;
- register bool again = whyles != 0 && whyles->w_start == lineloc &&
+ register bool again = whyles != 0 && SEEKEQ(&whyles->w_start, &lineloc) &&
whyles->w_fename == 0;
v++;
(struct whyle *) xcalloc(1, sizeof(*nwp));
nwp->w_start = lineloc;
- nwp->w_end = 0;
+ nwp->w_end.type = I_SEEK;
nwp->w_next = whyles;
whyles = nwp;
zlast = T_WHILE;
static void
preread()
{
- whyles->w_end = -1;
+ whyles->w_end.type = I_SEEK;
if (setintr)
(void) sigsetmask(sigblock((sigset_t) 0) & ~sigmask(SIGINT));
search(T_BREAK, 0, NULL); /* read the expression in */
if (setintr)
(void) sigblock(sigmask(SIGINT));
- whyles->w_end = fseekp;
+ btell(&whyles->w_end);
}
void
{
if (!whyles)
stderror(ERR_NAME | ERR_NOTWHILE);
- whyles->w_end = fseekp;
+ btell(&whyles->w_end);
doagain();
}
{
/* Repeating a while is simple */
if (whyles->w_fename == 0) {
- bseek(whyles->w_start);
+ bseek(&whyles->w_start);
return;
}
/*
return;
}
set(whyles->w_fename, Strsave(*whyles->w_fe++));
- bseek(whyles->w_start);
+ bseek(&whyles->w_start);
}
void
Stype = type;
Sgoal = goal;
- if (type == T_GOTO)
- bseek((off_t) 0);
+ if (type == T_GOTO) {
+ struct Ain a;
+ a.type = F_SEEK;
+ a.f_seek = 0;
+ bseek(&a);
+ }
do {
- if (intty && fseekp == feobp)
+ if (intty && fseekp == feobp && aret == F_SEEK)
(void) fprintf(cshout, "? "), (void) fflush(cshout);
aword[0] = 0;
(void) getword(aword);
static void
toend()
{
- if (whyles->w_end == 0) {
+ if (whyles->w_end.type == I_SEEK) {
search(T_BREAK, 0, NULL);
- whyles->w_end = fseekp - 1;
+ btell(&whyles->w_end);
+ whyles->w_end.f_seek--;
}
else
- bseek(whyles->w_end);
+ bseek(&whyles->w_end);
wfree();
}
void
wfree()
{
- long o = fseekp;
+ struct Ain o;
+ struct whyle *nwp;
+ btell(&o);
+
+ if (o.type != F_SEEK)
+ return;
- while (whyles) {
+ for (; whyles; whyles = nwp) {
register struct whyle *wp = whyles;
- register struct whyle *nwp = wp->w_next;
+ nwp = wp->w_next;
+ if (wp->w_start.type != F_SEEK || wp->w_end.type != F_SEEK)
+ continue;
- if (o >= wp->w_start && (wp->w_end == 0 || o < wp->w_end))
+ if (o.f_seek >= wp->w_start.f_seek &&
+ (wp->w_end.f_seek == 0 || o.f_seek < wp->w_end.f_seek))
break;
if (wp->w_fe0)
blkfree(wp->w_fe0);
if (wp->w_fename)
xfree((ptr_t) wp->w_fename);
xfree((ptr_t) wp);
- whyles = nwp;
}
}
}
if ((lp = *v++) == 0)
lp = STRNULL;
- Setenv(vp, lp = globone(lp, G_ERROR));
+ Setenv(vp, lp = globone(lp, G_APPEND));
if (eq(vp, STRPATH)) {
importpath(lp);
dohash(NULL, NULL);
Unsetenv(name);
break;
}
- xfree((ptr_t) name), name = NULL;
+ xfree((ptr_t) name);
+ name = NULL;
}
void
badscal:
stderror(ERR_NAME | ERR_SCALEF);
}
+ if ((f + 0.5) >= (float) 0x7fffffff || (f + 0.5) < (float) 0x80000000)
+ stderror(ERR_NAME | ERR_SCALEF);
return ((RLIM_TYPE) (f + 0.5));
}