| 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 : NWUtil.h |
| 12 | * DESCRIPTION : Utility functions for NetWare implementation of Perl. |
| 13 | * Author : HYAK, SGP |
| 14 | * Date : January 2001. |
| 15 | * |
| 16 | */ |
| 17 | |
| 18 | |
| 19 | |
| 20 | #ifndef __NWUtil_H__ |
| 21 | #define __NWUtil_H__ |
| 22 | |
| 23 | |
| 24 | #include "stdio.h" |
| 25 | #include <stdlib.h> |
| 26 | #include "win32ish.h" // For "BOOL", "TRUE" and "FALSE" |
| 27 | |
| 28 | |
| 29 | #ifdef MPK_ON |
| 30 | #include <mpktypes.h> |
| 31 | #include <mpkapis.h> |
| 32 | #else |
| 33 | #include <nwsemaph.h> |
| 34 | #endif //MPK_ON |
| 35 | |
| 36 | |
| 37 | // Name of console command to invoke perl |
| 38 | #define PERL_COMMAND_NAME "perl" |
| 39 | |
| 40 | // Name of console command to load an NLM |
| 41 | #define LOAD_COMMAND "load" |
| 42 | |
| 43 | |
| 44 | typedef struct tagCommandLineParser |
| 45 | { |
| 46 | BOOL m_noScreen; |
| 47 | BOOL m_AutoDestroy; |
| 48 | BOOL m_isValid; |
| 49 | |
| 50 | int m_argc; |
| 51 | int m_argv_len; |
| 52 | |
| 53 | #ifdef MPK_ON |
| 54 | SEMAPHORE m_qSemaphore; |
| 55 | #else |
| 56 | long m_qSemaphore; |
| 57 | #endif |
| 58 | |
| 59 | char* m_redirInName; |
| 60 | char* m_redirOutName; |
| 61 | char* m_redirErrName; |
| 62 | char* m_redirBothName; |
| 63 | char* nextarg; |
| 64 | char* sSkippedToken; |
| 65 | |
| 66 | char** m_argv; |
| 67 | char** new_argv; |
| 68 | |
| 69 | }COMMANDLINEPARSER, *PCOMMANDLINEPARSER; |
| 70 | |
| 71 | |
| 72 | |
| 73 | char* fnSkipWhite(char* cptr); |
| 74 | char* fnNwGetEnvironmentStr(char *name, char *defaultvalue); |
| 75 | char* fnSkipToken(char *s, char *r); |
| 76 | char* fnScanToken(char* x, char *r); |
| 77 | char* fnStashString(char *s, char *r, int length); |
| 78 | void fnAppendArgument(PCOMMANDLINEPARSER pclp, char * new_arg); |
| 79 | void fnDeleteArgument(PCOMMANDLINEPARSER pclp, int index); |
| 80 | void fnCommandLineParser(PCOMMANDLINEPARSER pclp, char * commandLine, BOOL preserveQuotes); |
| 81 | void fnSystemCommand (char** argv, int argc); |
| 82 | void fnInternalPerlLaunchHandler(char* cmdLine); |
| 83 | char* fnMy_MkTemp(char* templatestr); |
| 84 | |
| 85 | |
| 86 | /* NWDEFPERLROOT: |
| 87 | * This symbol contains the name of the starting default directory to search |
| 88 | * for scripts to run. |
| 89 | */ |
| 90 | #define NWDEFPERLROOT "sys:\\perl\\scripts" |
| 91 | |
| 92 | /* NWDEFPERLTEMP: |
| 93 | * This symbol contains the name of the default temp files directory. |
| 94 | */ |
| 95 | #define NWDEFPERLTEMP "sys:\\perl\\temp" |
| 96 | |
| 97 | |
| 98 | #endif // __NWUtil_H__ |
| 99 | |