Patch-ID: bash32-017
[bash.git] / builtins / inlib.def
blob094c4b949a89126eebce89701526bc44c41c4a19
1 This file is inlib.def, from which is created inlib.c.
2 It implements the Apollo-specific builtin "inlib" in Bash.
4 Copyright (C) 1987-2002 Free Software Foundation, Inc.
6 This file is part of GNU Bash, the Bourne Again SHell.
8 Bash is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 2, or (at your option) any later
11 version.
13 Bash is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License along
19 with Bash; see the file COPYING. If not, write to the Free Software
20 Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
22 $PRODUCES inlib.c
23 #include <config.h>
25 #include <stdio.h>
26 #include "../shell.h"
28 $BUILTIN inlib
29 $FUNCTION inlib_builtin
30 $DEPENDS_ON apollo
31 $SHORT_DOC inlib pathname [pathname...]
32 Install a user-supplied library specified by pathname in the current
33 shell process. The library is used to resolve external references
34 in programs and libraries loaded after its installation. Note
35 that the library is not loaded into the address space unless it is
36 needed to resolve an external reference. The list of inlibed
37 libraries is passed to all children of the current shell.
38 $END
40 #if defined (apollo)
42 #include <apollo/base.h>
43 #include <apollo/loader.h>
45 inlib_builtin (list)
46 WORD_LIST *list;
48 status_$t status;
49 int return_value;
50 short len;
52 if (!list)
54 builtin_usage ();
55 return (EX_USAGE);
58 return_value = EXECUTION_SUCCESS;
60 while (list)
62 len = (short)strlen (list->word->word);
63 loader_$inlib (list->word->word, len, &status);
65 if (status.all != status_$ok)
67 builtin_error ("%s: inlib failed", list->word->word);
68 return_value = EXECUTION_FAILURE;
71 list = list->next;
74 return (return_value);
76 #endif /* apollo */