source: vendor/bash/3.1/builtins/source.def@ 3228

Last change on this file since 3228 was 3228, checked in by bird, 19 years ago

bash 3.1

File size: 5.0 KB
Line 
1This file is source.def, from which is created source.c.
2It implements the builtins "." and "source" in Bash.
3
4Copyright (C) 1987-2003 Free Software Foundation, Inc.
5
6This file is part of GNU Bash, the Bourne Again SHell.
7
8Bash is free software; you can redistribute it and/or modify it under
9the terms of the GNU General Public License as published by the Free
10Software Foundation; either version 2, or (at your option) any later
11version.
12
13Bash is distributed in the hope that it will be useful, but WITHOUT ANY
14WARRANTY; without even the implied warranty of MERCHANTABILITY or
15FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16for more details.
17
18You should have received a copy of the GNU General Public License along
19with Bash; see the file COPYING. If not, write to the Free Software
20Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
21
22$PRODUCES source.c
23
24$BUILTIN source
25$FUNCTION source_builtin
26$SHORT_DOC source filename [arguments]
27Read and execute commands from FILENAME and return. The pathnames
28in $PATH are used to find the directory containing FILENAME. If any
29ARGUMENTS are supplied, they become the positional parameters when
30FILENAME is executed.
31$END
32$BUILTIN .
33$DOCNAME dot
34$FUNCTION source_builtin
35$SHORT_DOC . filename [arguments]
36Read and execute commands from FILENAME and return. The pathnames
37in $PATH are used to find the directory containing FILENAME. If any
38ARGUMENTS are supplied, they become the positional parameters when
39FILENAME is executed.
40$END
41/* source.c - Implements the `.' and `source' builtins. */
42
43#include <config.h>
44
45#include "../bashtypes.h"
46#include "posixstat.h"
47#include "filecntl.h"
48#if ! defined(_MINIX) && defined (HAVE_SYS_FILE_H)
49# include <sys/file.h>
50#endif
51#include <errno.h>
52
53#if defined (HAVE_UNISTD_H)
54# include <unistd.h>
55#endif
56
57#include "../bashansi.h"
58#include "../bashintl.h"
59
60#include "../shell.h"
61#include "../flags.h"
62#include "../findcmd.h"
63#include "common.h"
64#include "bashgetopt.h"
65#include "../trap.h"
66
67#if !defined (errno)
68extern int errno;
69#endif /* !errno */
70
71#if defined (RESTRICTED_SHELL)
72extern int restricted;
73#endif
74
75/* If non-zero, `.' uses $PATH to look up the script to be sourced. */
76int source_uses_path = 1;
77
78/* If non-zero, `.' looks in the current directory if the filename argument
79 is not found in the $PATH. */
80int source_searches_cwd = 1;
81