]>
Commit | Line | Data |
---|---|---|
726f6388 JA |
1 | This file is inlib.def, from which is created inlib.c. |
2 | It implements the Apollo-specific builtin "inlib" in Bash. | |
3 | ||
7117c2d2 | 4 | Copyright (C) 1987-2002 Free Software Foundation, Inc. |
726f6388 JA |
5 | |
6 | This file is part of GNU Bash, the Bourne Again SHell. | |
7 | ||
3185942a JA |
8 | Bash is free software: you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by | |
10 | the Free Software Foundation, either version 3 of the License, or | |
11 | (at your option) any later version. | |
726f6388 | 12 | |
3185942a JA |
13 | Bash is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
726f6388 | 17 | |
3185942a JA |
18 | You should have received a copy of the GNU General Public License |
19 | along with Bash. If not, see <http://www.gnu.org/licenses/>. | |
726f6388 JA |
20 | |
21 | $PRODUCES inlib.c | |
ccc6cda3 JA |
22 | #include <config.h> |
23 | ||
726f6388 JA |
24 | #include <stdio.h> |
25 | #include "../shell.h" | |
26 | ||
27 | $BUILTIN inlib | |
28 | $FUNCTION inlib_builtin | |
29 | $DEPENDS_ON apollo | |
30 | $SHORT_DOC inlib pathname [pathname...] | |
3185942a JA |
31 | Install user-supplied library. |
32 | ||
726f6388 JA |
33 | Install a user-supplied library specified by pathname in the current |
34 | shell process. The library is used to resolve external references | |
35 | in programs and libraries loaded after its installation. Note | |
36 | that the library is not loaded into the address space unless it is | |
37 | needed to resolve an external reference. The list of inlibed | |
38 | libraries is passed to all children of the current shell. | |
3185942a JA |
39 | |
40 | Exit Status: | |
41 | Returns success unless PATHNAME is not found or an error occurs. | |
726f6388 JA |
42 | $END |
43 | ||
44 | #if defined (apollo) | |
45 | ||
46 | #include <apollo/base.h> | |
47 | #include <apollo/loader.h> | |
48 | ||
49 | inlib_builtin (list) | |
50 | WORD_LIST *list; | |
51 | { | |
52 | status_$t status; | |
53 | int return_value; | |
54 | short len; | |
55 | ||
56 | if (!list) | |
57 | { | |
7117c2d2 | 58 | builtin_usage (); |
726f6388 JA |
59 | return (EX_USAGE); |
60 | } | |
61 | ||
62 | return_value = EXECUTION_SUCCESS; | |
63 | ||
64 | while (list) | |
65 | { | |
66 | len = (short)strlen (list->word->word); | |
67 | loader_$inlib (list->word->word, len, &status); | |
68 | ||
69 | if (status.all != status_$ok) | |
70 | { | |
3185942a | 71 | builtin_error (_("%s: inlib failed"), list->word->word); |
726f6388 JA |
72 | return_value = EXECUTION_FAILURE; |
73 | } | |
74 | ||
75 | list = list->next; | |
76 | } | |
77 | ||
78 | return (return_value); | |
79 | } | |
80 | #endif /* apollo */ |