Deleted Added
full compact
input.c (199629) input.c (199647)
1/*-
2 * Copyright (c) 1991, 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[] = "@(#)input.c 8.3 (Berkeley) 6/9/95";
36#endif
37#endif /* not lint */
38#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1991, 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[] = "@(#)input.c 8.3 (Berkeley) 6/9/95";
36#endif
37#endif /* not lint */
38#include <sys/cdefs.h>
39__FBSDID("$FreeBSD: head/bin/sh/input.c 199629 2009-11-21 14:28:32Z jilles $");
39__FBSDID("$FreeBSD: head/bin/sh/input.c 199647 2009-11-22 14:04:20Z jilles $");
40
41#include <stdio.h> /* defines BUFSIZ */
42#include <fcntl.h>
43#include <errno.h>
44#include <unistd.h>
45#include <stdlib.h>
46#include <string.h>
47

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

504 parselleft = parsefile->lleft;
505 parsenextc = parsefile->nextc;
506 plinno = parsefile->linno;
507 INTON;
508}
509
510
511/*
40
41#include <stdio.h> /* defines BUFSIZ */
42#include <fcntl.h>
43#include <errno.h>
44#include <unistd.h>
45#include <stdlib.h>
46#include <string.h>
47

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

504 parselleft = parsefile->lleft;
505 parsenextc = parsefile->nextc;
506 plinno = parsefile->linno;
507 INTON;
508}
509
510
511/*
512 * Return current file (to go back to it later using popfilesupto()).
513 */
514
515struct parsefile *
516getcurrentfile(void)
517{
518 return parsefile;
519}
520
521
522/*
523 * Pop files until the given file is on top again. Useful for regular
524 * builtins that read shell commands from files or strings.
525 * If the given file is not an active file, an error is raised.
526 */
527
528void
529popfilesupto(struct parsefile *file)
530{
531 while (parsefile != file && parsefile != &basepf)
532 popfile();
533 if (parsefile != file)
534 error("popfilesupto() misused");
535}
536
537/*
512 * Return to top level.
513 */
514
515void
516popallfiles(void)
517{
518 while (parsefile != &basepf)
519 popfile();

--- 18 unchanged lines hidden ---
538 * Return to top level.
539 */
540
541void
542popallfiles(void)
543{
544 while (parsefile != &basepf)
545 popfile();

--- 18 unchanged lines hidden ---