]> git.ipfire.org Git - thirdparty/bash.git/blob - builtins/inlib.def
Imported from ../bash-1.14.7.tar.gz.
[thirdparty/bash.git] / builtins / inlib.def
1 This file is inlib.def, from which is created inlib.c.
2 It implements the Apollo-specific builtin "inlib" in Bash.
3
4 Copyright (C) 1987, 1989, 1991 Free Software Foundation, Inc.
5
6 This file is part of GNU Bash, the Bourne Again SHell.
7
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 1, or (at your option) any later
11 version.
12
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.
17
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, 675 Mass Ave, Cambridge, MA 02139, USA.
21
22 $PRODUCES inlib.c
23 #include <stdio.h>
24 #include "../shell.h"
25
26 $BUILTIN inlib
27 $FUNCTION inlib_builtin
28 $DEPENDS_ON apollo
29 $SHORT_DOC inlib pathname [pathname...]
30 Install a user-supplied library specified by pathname in the current
31 shell process. The library is used to resolve external references
32 in programs and libraries loaded after its installation. Note
33 that the library is not loaded into the address space unless it is
34 needed to resolve an external reference. The list of inlibed
35 libraries is passed to all children of the current shell.
36 $END
37
38 #if defined (apollo)
39
40 #include <apollo/base.h>
41 #include <apollo/loader.h>
42
43 inlib_builtin (list)
44 WORD_LIST *list;
45 {
46 status_$t status;
47 int return_value;
48 short len;
49
50 if (!list)
51 {
52 builtin_error ("usage: inlib pathname [pathname...]");
53 return (EX_USAGE);
54 }
55
56 return_value = EXECUTION_SUCCESS;
57
58 while (list)
59 {
60 len = (short)strlen (list->word->word);
61 loader_$inlib (list->word->word, len, &status);
62
63 if (status.all != status_$ok)
64 {
65 builtin_error ("inlib failed for %s", list->word->word);
66 return_value = EXECUTION_FAILURE;
67 }
68
69 list = list->next;
70 }
71
72 return (return_value);
73 }
74 #endif /* apollo */