X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=NetWare%2FNwmain.c;h=b49fc80f70b38350614779edff2daae867bbf60c;hb=953f6acfa20ec275ec39a552dfac8124bd93ebdf;hp=029c24948d61dd24e5538f1b5ab303089d85f4ed;hpb=011f1a1a00b94fe919083a224d5df636f05ae32a;p=p5sagit%2Fp5-mst-13.2.git diff --git a/NetWare/Nwmain.c b/NetWare/Nwmain.c index 029c249..b49fc80 100644 --- a/NetWare/Nwmain.c +++ b/NetWare/Nwmain.c @@ -181,7 +181,7 @@ void main(int argc, char *argv[]) char sNUL[MAX_DN_BYTES] = {'\0'}; strcpy(sNUL, NWDEFPERLROOT); - strcat(sNUL, "\\nul"); + strcat(sNUL, "\\nwnul"); if (access((const char *)sNUL, 0) != 0) { // The file, "nul" is not found and so create the file. @@ -313,7 +313,7 @@ void fnSigTermHandler(int sig) char sNUL[MAX_DN_BYTES] = {'\0'}; strcpy(sNUL, NWDEFPERLROOT); - strcat(sNUL, "\\nul"); + strcat(sNUL, "\\nwnul"); if (access((const char *)sNUL, 0) == 0) { // The file, "nul" is found and so delete it. @@ -529,7 +529,6 @@ void fnLaunchPerl(void* context) errno = 0; - if (psdata->m_fromConsole) { // get the default working directory name @@ -548,12 +547,10 @@ void fnLaunchPerl(void* context) if (psdata->m_fromConsole) chdir(defaultDir); - // run the script // fnRunScript(psdata); - // May have to check this, I am blindly calling UCSTerminate, irrespective of // whether it is initialized or not // Copied from the previous Perl - sgp - 31st Oct 2000 @@ -565,7 +562,6 @@ void fnLaunchPerl(void* context) (*ucsterminate)(); } - if (psdata->m_fromConsole) { // change thread groups for the call to free the memory @@ -607,7 +603,6 @@ void fnLaunchPerl(void* context) // ExitThread(EXIT_THREAD, 0); #endif - return; } @@ -654,13 +649,11 @@ void fnRunScript(ScriptData* psdata) int stderr_fd=-1, stderr_fd_dup=-1; - // Main callback instance // if (fnRegisterWithThreadTable() == FALSE) return; - // parse the command line into argc/argv style: // number of params and char array of params // @@ -671,7 +664,6 @@ void fnRunScript(ScriptData* psdata) return; } - // Initialise the variables pclp->m_isValid = TRUE; pclp->m_redirInName = NULL; @@ -694,7 +686,6 @@ void fnRunScript(ScriptData* psdata) pclp->m_argc = 0; pclp->m_argv_len = 1; - // Allocate memory pclp->m_argv = (char **) malloc(pclp->m_argv_len * sizeof(char *)); if (pclp->m_argv == NULL) @@ -719,7 +710,6 @@ void fnRunScript(ScriptData* psdata) return; } - // Parse the command line fnCommandLineParser(pclp, (char *)psdata->m_commandLine, FALSE); if (!pclp->m_isValid) @@ -771,7 +761,6 @@ void fnRunScript(ScriptData* psdata) pclp->m_redirBothName = NULL; } - // Signal a semaphore, if indicated by "-{" option, to indicate that // the script has terminated and files are closed // @@ -791,7 +780,6 @@ void fnRunScript(ScriptData* psdata) return; } - // Simulating a shell on NetWare can be difficult. If you don't // create a new screen for the script to run in, you can output to // the console but you can't get any input from the console. Therefore, @@ -840,7 +828,6 @@ void fnRunScript(ScriptData* psdata) else if (use_system_console) CreateScreen((char *)"System Console", 0); - if (pclp->m_redirInName) { if ((stdin_fd = fileno(stdin)) != -1) @@ -942,14 +929,12 @@ void fnRunScript(ScriptData* psdata) } } - env = NULL; fnSetUpEnvBlock(&env); // Set up the ENV block // Run the Perl script exitstatus = RunPerl(pclp->m_argc, pclp->m_argv, env); - // clean up any redirection // if (pclp->m_redirInName && redirIn) @@ -1004,9 +989,14 @@ void fnRunScript(ScriptData* psdata) DestroyScreen(newscreenhandle); } +/** + // Commented since a few abends were happening in fnFpSetMode // Set the mode for stdin and stdout fnFpSetMode(stdin, O_TEXT, dummy); fnFpSetMode(stdout, O_TEXT, dummy); +**/ + setmode(stdin, O_TEXT); + setmode(stdout, O_TEXT); // Cleanup if(pclp->m_argv) @@ -1056,7 +1046,6 @@ void fnRunScript(ScriptData* psdata) pclp->m_redirBothName = NULL; } - // Signal a semaphore, if indicated by -{ option, to indicate that // the script has terminated and files are closed // @@ -1076,12 +1065,15 @@ void fnRunScript(ScriptData* psdata) } if(env) + { fnDestroyEnvBlock(env); + env = NULL; + } + fnUnregisterWithThreadTable(); // Remove the thread context set during Perl_set_context Remove_Thread_Ctx(); - return; } @@ -1118,7 +1110,6 @@ void fnSetUpEnvBlock(char*** penv) // add one for null termination totalcnt++; - env = (char **) malloc (totalcnt * sizeof(char *)); if (env) { @@ -1227,7 +1218,6 @@ int fnFpSetMode(FILE* fp, int mode, int *err) PFFSETMODE pf_fsetmode; - if (mode == O_BINARY || mode == O_TEXT) { if (fp) @@ -1248,7 +1238,6 @@ int fnFpSetMode(FILE* fp, int mode, int *err) } if (errno) err = &errno; - } else { @@ -1262,7 +1251,6 @@ int fnFpSetMode(FILE* fp, int mode, int *err) err = &errno; } - return ret; } @@ -1286,7 +1274,6 @@ void fnInternalPerlLaunchHandler(char* cmdLine) ScriptData* psdata=NULL; - // Create a safe copy of the command line and pass it to the // new thread for parsing. The new thread will be responsible // to delete it when it is finished with it.