Commit | Line | Data |
2986a63f |
1 | |
2 | /* |
3 | * Copyright © 2001 Novell, Inc. All Rights Reserved. |
4 | * |
5 | * You may distribute under the terms of either the GNU General Public |
6 | * License or the Artistic License, as specified in the README file. |
7 | * |
8 | */ |
9 | |
10 | /* |
11 | * FILENAME : CLIBstuf.c |
12 | * DESCRIPTION : The purpose of clibstuf is to make sure that Perl, cgi2perl and |
13 | * all the perl extension nlm's (*.NLP) use the Novell Netware CLIB versions |
14 | * of standard functions. This code loads up a whole bunch of function pointers |
15 | * to point at the standard CLIB functions. |
16 | * Author : HYAK |
17 | * Date : January 2001. |
18 | * |
19 | */ |
20 | |
21 | |
22 | |
23 | #define DEFINE_GPF |
24 | #include "string.h" // Our version of string.h will include clibstr.h |
25 | #include "stdio.h" // Our version of stdio.h will include clibsdio.h |
26 | #include "clibstuf.h" |
27 | |
28 | #include <nwthread.h> |
29 | #include <nwadv.h> |
30 | #include <nwconio.h> |
31 | |
32 | |
33 | |
34 | void ImportFromCLIB (unsigned int nlmHandle, void** psymbol, char* symbolName) |
35 | { |
36 | *psymbol = ImportSymbol(nlmHandle, symbolName); |
37 | if (*psymbol == NULL) |
38 | { |
39 | ConsolePrintf("Symbol %s not found, unable to continue\n", symbolName); |
40 | exit(1); |
41 | } |
42 | } |
43 | |
44 | |
45 | void fnInitGpfGlobals(void) |
46 | { |
47 | unsigned int nlmHandle = GetNLMHandle(); |
48 | |
49 | ImportFromCLIB(nlmHandle, &gpf___get_stdin, "__get_stdin"); |
50 | ImportFromCLIB(nlmHandle, &gpf___get_stdout, "__get_stdout"); |
51 | ImportFromCLIB(nlmHandle, &gpf___get_stderr, "__get_stderr"); |
52 | ImportFromCLIB(nlmHandle, &gpf_clearerr, "clearerr"); |
53 | ImportFromCLIB(nlmHandle, &gpf_fclose, "fclose"); |
54 | ImportFromCLIB(nlmHandle, &gpf_feof, "feof"); |
55 | ImportFromCLIB(nlmHandle, &gpf_ferror, "ferror"); |
56 | ImportFromCLIB(nlmHandle, &gpf_fflush, "fflush"); |
57 | ImportFromCLIB(nlmHandle, &gpf_fgetc, "fgetc"); |
58 | ImportFromCLIB(nlmHandle, &gpf_fgetpos, "fgetpos"); |
59 | ImportFromCLIB(nlmHandle, &gpf_fgets, "fgets"); |
60 | ImportFromCLIB(nlmHandle, &gpf_fopen, "fopen"); |
61 | ImportFromCLIB(nlmHandle, &gpf_fputc, "fputc"); |
62 | ImportFromCLIB(nlmHandle, &gpf_fputs, "fputs"); |
63 | ImportFromCLIB(nlmHandle, &gpf_fread, "fread"); |
64 | ImportFromCLIB(nlmHandle, &gpf_freopen, "freopen"); |
65 | ImportFromCLIB(nlmHandle, &gpf_fscanf, "fscanf"); |
66 | ImportFromCLIB(nlmHandle, &gpf_fseek, "fseek"); |
67 | ImportFromCLIB(nlmHandle, &gpf_fsetpos, "fsetpos"); |
68 | ImportFromCLIB(nlmHandle, &gpf_ftell, "ftell"); |
69 | ImportFromCLIB(nlmHandle, &gpf_fwrite, "fwrite"); |
70 | ImportFromCLIB(nlmHandle, &gpf_getc, "getc"); |
71 | ImportFromCLIB(nlmHandle, &gpf_getchar, "getchar"); |
72 | ImportFromCLIB(nlmHandle, &gpf_gets, "gets"); |
73 | ImportFromCLIB(nlmHandle, &gpf_perror, "perror"); |
74 | ImportFromCLIB(nlmHandle, &gpf_putc, "putc"); |
75 | ImportFromCLIB(nlmHandle, &gpf_putchar, "putchar"); |
76 | ImportFromCLIB(nlmHandle, &gpf_puts, "puts"); |
77 | ImportFromCLIB(nlmHandle, &gpf_rename, "rename"); |
78 | ImportFromCLIB(nlmHandle, &gpf_rewind, "rewind"); |
79 | ImportFromCLIB(nlmHandle, &gpf_scanf, "scanf"); |
80 | ImportFromCLIB(nlmHandle, &gpf_setbuf, "setbuf"); |
81 | ImportFromCLIB(nlmHandle, &gpf_setvbuf, "setvbuf"); |
82 | ImportFromCLIB(nlmHandle, &gpf_sscanf, "sscanf"); |
83 | ImportFromCLIB(nlmHandle, &gpf_tmpfile, "tmpfile"); |
84 | ImportFromCLIB(nlmHandle, &gpf_tmpnam, "tmpnam"); |
85 | ImportFromCLIB(nlmHandle, &gpf_ungetc, "ungetc"); |
86 | ImportFromCLIB(nlmHandle, &gpf_vfscanf, "vfscanf"); |
87 | ImportFromCLIB(nlmHandle, &gpf_vscanf, "vscanf"); |
88 | ImportFromCLIB(nlmHandle, &gpf_vsscanf, "vsscanf"); |
89 | ImportFromCLIB(nlmHandle, &gpf_fdopen, "fdopen"); |
90 | ImportFromCLIB(nlmHandle, &gpf_fileno, "fileno"); |
91 | ImportFromCLIB(nlmHandle, &gpf_cgets, "cgets"); |
92 | ImportFromCLIB(nlmHandle, &gpf_cprintf, "cprintf"); |
93 | ImportFromCLIB(nlmHandle, &gpf_cputs, "cputs"); |
94 | ImportFromCLIB(nlmHandle, &gpf_cscanf, "cscanf"); |
95 | ImportFromCLIB(nlmHandle, &gpf_fcloseall, "fcloseall"); |
96 | ImportFromCLIB(nlmHandle, &gpf_fgetchar, "fgetchar"); |
97 | ImportFromCLIB(nlmHandle, &gpf_flushall, "flushall"); |
98 | ImportFromCLIB(nlmHandle, &gpf_fputchar, "fputchar"); |
99 | ImportFromCLIB(nlmHandle, &gpf_getch, "getch"); |
100 | ImportFromCLIB(nlmHandle, &gpf_getche, "getche"); |
101 | ImportFromCLIB(nlmHandle, &gpf_putch, "putch"); |
102 | ImportFromCLIB(nlmHandle, &gpf_ungetch, "ungetch"); |
103 | ImportFromCLIB(nlmHandle, &gpf_vcprintf, "vcprintf"); |
104 | ImportFromCLIB(nlmHandle, &gpf_vcscanf, "vcscanf"); |
105 | |
106 | ImportFromCLIB(nlmHandle, &gpf_memchr, "memchr"); |
107 | ImportFromCLIB(nlmHandle, &gpf_memcmp, "memcmp"); |
108 | ImportFromCLIB(nlmHandle, &gpf_memcpy, "memcpy"); |
109 | ImportFromCLIB(nlmHandle, &gpf_memmove, "memmove"); |
110 | ImportFromCLIB(nlmHandle, &gpf_memset, "memset"); |
111 | ImportFromCLIB(nlmHandle, &gpf_memicmp, "memicmp"); |
112 | |
113 | ImportFromCLIB(nlmHandle, &gpf_strerror, "strerror"); |
114 | ImportFromCLIB(nlmHandle, &gpf_strtok_r, "strtok_r"); |
115 | |
116 | ImportFromCLIB(nlmHandle, &gpf_strcpy, "strcpy"); |
117 | ImportFromCLIB(nlmHandle, &gpf_strcat, "strcat"); |
118 | ImportFromCLIB(nlmHandle, &gpf_strchr, "strchr"); |
119 | ImportFromCLIB(nlmHandle, &gpf_strstr, "strstr"); |
120 | ImportFromCLIB(nlmHandle, &gpf_strcoll, "strcoll"); |
121 | ImportFromCLIB(nlmHandle, &gpf_strcspn, "strcspn"); |
122 | ImportFromCLIB(nlmHandle, &gpf_strpbrk, "strpbrk"); |
123 | ImportFromCLIB(nlmHandle, &gpf_strrchr, "strrchr"); |
124 | ImportFromCLIB(nlmHandle, &gpf_strrev, "strrev"); |
125 | ImportFromCLIB(nlmHandle, &gpf_strspn, "strspn"); |
126 | ImportFromCLIB(nlmHandle, &gpf_strupr, "strupr"); |
127 | ImportFromCLIB(nlmHandle, &gpf_strxfrm, "strxfrm"); |
128 | ImportFromCLIB(nlmHandle, &gpf_strcmp, "strcmp"); |
129 | ImportFromCLIB(nlmHandle, &gpf_stricmp, "stricmp"); |
130 | ImportFromCLIB(nlmHandle, &gpf_strtok, "strtok"); |
131 | ImportFromCLIB(nlmHandle, &gpf_strlen, "strlen"); |
132 | ImportFromCLIB(nlmHandle, &gpf_strncpy, "strncpy"); |
133 | ImportFromCLIB(nlmHandle, &gpf_strncat, "strncat"); |
134 | ImportFromCLIB(nlmHandle, &gpf_strncmp, "strncmp"); |
135 | ImportFromCLIB(nlmHandle, &gpf_strcmpi, "strcmpi"); |
136 | ImportFromCLIB(nlmHandle, &gpf_strnicmp, "strnicmp"); |
137 | ImportFromCLIB(nlmHandle, &gpf_strdup, "strdup"); |
138 | ImportFromCLIB(nlmHandle, &gpf_strlist, "strlist"); |
139 | ImportFromCLIB(nlmHandle, &gpf_strlwr, "strlwr"); |
140 | ImportFromCLIB(nlmHandle, &gpf_strnset, "strnset"); |
141 | ImportFromCLIB(nlmHandle, &gpf_strset, "strset"); |
142 | ImportFromCLIB(nlmHandle, &gpf_strtok_r, "strtok_r"); |
143 | ImportFromCLIB(nlmHandle, &gpf_printf, "printf"); |
144 | ImportFromCLIB(nlmHandle, &gpf_fprintf, "fprintf"); |
145 | ImportFromCLIB(nlmHandle, &gpf_sprintf, "sprintf"); |
146 | ImportFromCLIB(nlmHandle, &gpf_vprintf, "vprintf"); |
147 | ImportFromCLIB(nlmHandle, &gpf_vfprintf, "vfprintf"); |
148 | ImportFromCLIB(nlmHandle, &gpf_vsprintf, "vsprintf"); |
149 | |
150 | } |
151 | |