3 * Copyright © 2001 Novell, Inc. All Rights Reserved.
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.
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.
17 * Date : January 2001.
29 #include "string.h" // Our version of string.h will include clibstr.h
30 #include "stdio.h" // Our version of stdio.h will include clibsdio.h
41 /*============================================================================================
45 Description : This is called as the first step in an extension.
51 ==============================================================================================*/
55 fnInitGpfGlobals(); // For importing the CLIB calls in place of the Watcom calls
56 SynchronizeStart(); // Don't allow anything else to happen until all the symbols are imported
58 ExitThread(TSR_THREAD, 0);
60 ExitThread(TSR_THREAD, 0);
65 void ImportFromCLIB (unsigned int nlmHandle, void** psymbol, char* symbolName)
67 *psymbol = ImportSymbol(nlmHandle, symbolName);
70 ConsolePrintf("Symbol %s not found, unable to continue\n", symbolName);
76 void fnInitGpfGlobals(void)
78 unsigned int nlmHandle = GetNLMHandle();
80 ImportFromCLIB(nlmHandle, &gpf___get_stdin, "__get_stdin");
81 ImportFromCLIB(nlmHandle, &gpf___get_stdout, "__get_stdout");
82 ImportFromCLIB(nlmHandle, &gpf___get_stderr, "__get_stderr");
83 ImportFromCLIB(nlmHandle, &gpf_clearerr, "clearerr");
84 ImportFromCLIB(nlmHandle, &gpf_fclose, "fclose");
85 ImportFromCLIB(nlmHandle, &gpf_feof, "feof");
86 ImportFromCLIB(nlmHandle, &gpf_ferror, "ferror");
87 ImportFromCLIB(nlmHandle, &gpf_fflush, "fflush");
88 ImportFromCLIB(nlmHandle, &gpf_fgetc, "fgetc");
89 ImportFromCLIB(nlmHandle, &gpf_fgetpos, "fgetpos");
90 ImportFromCLIB(nlmHandle, &gpf_fgets, "fgets");
91 ImportFromCLIB(nlmHandle, &gpf_fopen, "fopen");
92 ImportFromCLIB(nlmHandle, &gpf_fputc, "fputc");
93 ImportFromCLIB(nlmHandle, &gpf_fputs, "fputs");
94 ImportFromCLIB(nlmHandle, &gpf_fread, "fread");
95 ImportFromCLIB(nlmHandle, &gpf_freopen, "freopen");
96 ImportFromCLIB(nlmHandle, &gpf_fscanf, "fscanf");
97 ImportFromCLIB(nlmHandle, &gpf_fseek, "fseek");
98 ImportFromCLIB(nlmHandle, &gpf_fsetpos, "fsetpos");
99 ImportFromCLIB(nlmHandle, &gpf_ftell, "ftell");
100 ImportFromCLIB(nlmHandle, &gpf_fwrite, "fwrite");
101 ImportFromCLIB(nlmHandle, &gpf_getc, "getc");
102 ImportFromCLIB(nlmHandle, &gpf_getchar, "getchar");
103 ImportFromCLIB(nlmHandle, &gpf_gets, "gets");
104 ImportFromCLIB(nlmHandle, &gpf_perror, "perror");
105 ImportFromCLIB(nlmHandle, &gpf_putc, "putc");
106 ImportFromCLIB(nlmHandle, &gpf_putchar, "putchar");
107 ImportFromCLIB(nlmHandle, &gpf_puts, "puts");
108 ImportFromCLIB(nlmHandle, &gpf_rename, "rename");
109 ImportFromCLIB(nlmHandle, &gpf_rewind, "rewind");
110 ImportFromCLIB(nlmHandle, &gpf_scanf, "scanf");
111 ImportFromCLIB(nlmHandle, &gpf_setbuf, "setbuf");
112 ImportFromCLIB(nlmHandle, &gpf_setvbuf, "setvbuf");
113 ImportFromCLIB(nlmHandle, &gpf_sscanf, "sscanf");
114 ImportFromCLIB(nlmHandle, &gpf_tmpfile, "tmpfile");
115 ImportFromCLIB(nlmHandle, &gpf_tmpnam, "tmpnam");
116 ImportFromCLIB(nlmHandle, &gpf_ungetc, "ungetc");
117 ImportFromCLIB(nlmHandle, &gpf_vfscanf, "vfscanf");
118 ImportFromCLIB(nlmHandle, &gpf_vscanf, "vscanf");
119 ImportFromCLIB(nlmHandle, &gpf_vsscanf, "vsscanf");
120 ImportFromCLIB(nlmHandle, &gpf_fdopen, "fdopen");
121 ImportFromCLIB(nlmHandle, &gpf_fileno, "fileno");
122 ImportFromCLIB(nlmHandle, &gpf_cgets, "cgets");
123 ImportFromCLIB(nlmHandle, &gpf_cprintf, "cprintf");
124 ImportFromCLIB(nlmHandle, &gpf_cputs, "cputs");
125 ImportFromCLIB(nlmHandle, &gpf_cscanf, "cscanf");
126 ImportFromCLIB(nlmHandle, &gpf_fcloseall, "fcloseall");
127 ImportFromCLIB(nlmHandle, &gpf_fgetchar, "fgetchar");
128 ImportFromCLIB(nlmHandle, &gpf_flushall, "flushall");
129 ImportFromCLIB(nlmHandle, &gpf_fputchar, "fputchar");
130 ImportFromCLIB(nlmHandle, &gpf_getch, "getch");
131 ImportFromCLIB(nlmHandle, &gpf_getche, "getche");
132 ImportFromCLIB(nlmHandle, &gpf_putch, "putch");
133 ImportFromCLIB(nlmHandle, &gpf_ungetch, "ungetch");
134 ImportFromCLIB(nlmHandle, &gpf_vcprintf, "vcprintf");
135 ImportFromCLIB(nlmHandle, &gpf_vcscanf, "vcscanf");
137 ImportFromCLIB(nlmHandle, &gpf_memchr, "memchr");
138 ImportFromCLIB(nlmHandle, &gpf_memcmp, "memcmp");
139 ImportFromCLIB(nlmHandle, &gpf_memcpy, "memcpy");
140 ImportFromCLIB(nlmHandle, &gpf_memmove, "memmove");
141 ImportFromCLIB(nlmHandle, &gpf_memset, "memset");
142 ImportFromCLIB(nlmHandle, &gpf_memicmp, "memicmp");
144 ImportFromCLIB(nlmHandle, &gpf_strerror, "strerror");
145 ImportFromCLIB(nlmHandle, &gpf_strtok_r, "strtok_r");
147 ImportFromCLIB(nlmHandle, &gpf_strcpy, "strcpy");
148 ImportFromCLIB(nlmHandle, &gpf_strcat, "strcat");
149 ImportFromCLIB(nlmHandle, &gpf_strchr, "strchr");
150 ImportFromCLIB(nlmHandle, &gpf_strstr, "strstr");
151 ImportFromCLIB(nlmHandle, &gpf_strcoll, "strcoll");
152 ImportFromCLIB(nlmHandle, &gpf_strcspn, "strcspn");
153 ImportFromCLIB(nlmHandle, &gpf_strpbrk, "strpbrk");
154 ImportFromCLIB(nlmHandle, &gpf_strrchr, "strrchr");
155 ImportFromCLIB(nlmHandle, &gpf_strrev, "strrev");
156 ImportFromCLIB(nlmHandle, &gpf_strspn, "strspn");
157 ImportFromCLIB(nlmHandle, &gpf_strupr, "strupr");
158 ImportFromCLIB(nlmHandle, &gpf_strxfrm, "strxfrm");
159 ImportFromCLIB(nlmHandle, &gpf_strcmp, "strcmp");
160 ImportFromCLIB(nlmHandle, &gpf_stricmp, "stricmp");
161 ImportFromCLIB(nlmHandle, &gpf_strtok, "strtok");
162 ImportFromCLIB(nlmHandle, &gpf_strlen, "strlen");
163 ImportFromCLIB(nlmHandle, &gpf_strncpy, "strncpy");
164 ImportFromCLIB(nlmHandle, &gpf_strncat, "strncat");
165 ImportFromCLIB(nlmHandle, &gpf_strncmp, "strncmp");
166 ImportFromCLIB(nlmHandle, &gpf_strcmpi, "strcmpi");
167 ImportFromCLIB(nlmHandle, &gpf_strnicmp, "strnicmp");
168 ImportFromCLIB(nlmHandle, &gpf_strdup, "strdup");
169 ImportFromCLIB(nlmHandle, &gpf_strlist, "strlist");
170 ImportFromCLIB(nlmHandle, &gpf_strlwr, "strlwr");
171 ImportFromCLIB(nlmHandle, &gpf_strnset, "strnset");
172 ImportFromCLIB(nlmHandle, &gpf_strset, "strset");
173 ImportFromCLIB(nlmHandle, &gpf_strtok_r, "strtok_r");
174 ImportFromCLIB(nlmHandle, &gpf_printf, "printf");
175 ImportFromCLIB(nlmHandle, &gpf_fprintf, "fprintf");
176 ImportFromCLIB(nlmHandle, &gpf_sprintf, "sprintf");
177 ImportFromCLIB(nlmHandle, &gpf_vprintf, "vprintf");
178 ImportFromCLIB(nlmHandle, &gpf_vfprintf, "vfprintf");
179 ImportFromCLIB(nlmHandle, &gpf_vsprintf, "vsprintf");