| 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");
|
|---|
|
|---|