Deleted Added
full compact
eval.c (230212) eval.c (230463)
1/*-
2 * Copyright (c) 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Kenneth Almquist.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 22 unchanged lines hidden (view full) ---

31 */
32
33#ifndef lint
34#if 0
35static char sccsid[] = "@(#)eval.c 8.9 (Berkeley) 6/8/95";
36#endif
37#endif /* not lint */
38#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Kenneth Almquist.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 22 unchanged lines hidden (view full) ---

31 */
32
33#ifndef lint
34#if 0
35static char sccsid[] = "@(#)eval.c 8.9 (Berkeley) 6/8/95";
36#endif
37#endif /* not lint */
38#include <sys/cdefs.h>
39__FBSDID("$FreeBSD: head/bin/sh/eval.c 230212 2012-01-16 11:07:46Z dumbbell $");
39__FBSDID("$FreeBSD: head/bin/sh/eval.c 230463 2012-01-22 14:00:33Z jilles $");
40
41#include <paths.h>
42#include <signal.h>
43#include <stdlib.h>
44#include <unistd.h>
45#include <sys/resource.h>
46#include <sys/wait.h> /* For WIFSIGNALED(status) */
47#include <errno.h>

--- 295 unchanged lines hidden (view full) ---

343
344static void
345evalfor(union node *n, int flags)
346{
347 struct arglist arglist;
348 union node *argp;
349 struct strlist *sp;
350 struct stackmark smark;
40
41#include <paths.h>
42#include <signal.h>
43#include <stdlib.h>
44#include <unistd.h>
45#include <sys/resource.h>
46#include <sys/wait.h> /* For WIFSIGNALED(status) */
47#include <errno.h>

--- 295 unchanged lines hidden (view full) ---

343
344static void
345evalfor(union node *n, int flags)
346{
347 struct arglist arglist;
348 union node *argp;
349 struct strlist *sp;
350 struct stackmark smark;
351 int status;
351
352 setstackmark(&smark);
353 arglist.lastp = &arglist.list;
354 for (argp = n->nfor.args ; argp ; argp = argp->narg.next) {
355 oexitstatus = exitstatus;
356 expandarg(argp, &arglist, EXP_FULL | EXP_TILDE);
357 }
358 *arglist.lastp = NULL;
359
352
353 setstackmark(&smark);
354 arglist.lastp = &arglist.list;
355 for (argp = n->nfor.args ; argp ; argp = argp->narg.next) {
356 oexitstatus = exitstatus;
357 expandarg(argp, &arglist, EXP_FULL | EXP_TILDE);
358 }
359 *arglist.lastp = NULL;
360
360 exitstatus = 0;
361 loopnest++;
361 loopnest++;
362 status = 0;
362 for (sp = arglist.list ; sp ; sp = sp->next) {
363 setvar(n->nfor.var, sp->text, 0);
364 evaltree(n->nfor.body, flags);
363 for (sp = arglist.list ; sp ; sp = sp->next) {
364 setvar(n->nfor.var, sp->text, 0);
365 evaltree(n->nfor.body, flags);
366 status = exitstatus;
365 if (evalskip) {
366 if (evalskip == SKIPCONT && --skipcount <= 0) {
367 evalskip = 0;
368 continue;
369 }
370 if (evalskip == SKIPBREAK && --skipcount <= 0)
371 evalskip = 0;
372 break;
373 }
374 }
375 loopnest--;
376 popstackmark(&smark);
367 if (evalskip) {
368 if (evalskip == SKIPCONT && --skipcount <= 0) {
369 evalskip = 0;
370 continue;
371 }
372 if (evalskip == SKIPBREAK && --skipcount <= 0)
373 evalskip = 0;
374 break;
375 }
376 }
377 loopnest--;
378 popstackmark(&smark);
379 exitstatus = status;
377}
378
379
380/*
381 * Evaluate a case statement, returning the selected tree.
382 *
383 * The exit status needs care to get right.
384 */

--- 909 unchanged lines hidden ---
380}
381
382
383/*
384 * Evaluate a case statement, returning the selected tree.
385 *
386 * The exit status needs care to get right.
387 */

--- 909 unchanged lines hidden ---