void fnGetPerlScreenName(char *sPerlScreenName);
-
+void fnGetPerlScreenName(char *sPerlScreenName);
+void fnSetupNamespace(void);
+char *getcwd(char [], int);
+void fnRunScript(ScriptData* psdata);
+void nw_freeenviron();
/*============================================================================================
// Ensure that we have a "temp" directory
fnSetupNamespace();
- if (access(DEFTEMP, 0) != 0)
- mkdir(DEFTEMP);
+ if (access(NWDEFPERLTEMP, 0) != 0)
+ mkdir(NWDEFPERLTEMP);
// Create the file NUL if not present. This is done only once per NLM load.
// This is required for -e.
{
char sNUL[MAX_DN_BYTES] = {'\0'};
- strcpy(sNUL, DEFPERLROOT);
- strcat(sNUL, "\\nul");
+ strcpy(sNUL, NWDEFPERLROOT);
+ strcat(sNUL, "\\nwnul");
if (access((const char *)sNUL, 0) != 0)
{
// The file, "nul" is not found and so create the file.
//
while (!fnTerminateThreadInfo() && k < 5)
{
- sleep(1);
+ nw_sleep(1);
k++;
}
}
{
char sNUL[MAX_DN_BYTES] = {'\0'};
- strcpy(sNUL, DEFPERLROOT);
- strcat(sNUL, "\\nul");
+ strcpy(sNUL, NWDEFPERLROOT);
+ strcat(sNUL, "\\nwnul");
if (access((const char *)sNUL, 0) == 0)
{
// The file, "nul" is found and so delete it.
errno = 0;
-
if (psdata->m_fromConsole)
{
// get the default working directory name
//
- defaultDir = fnNwGetEnvironmentStr("PERL_ROOT", DEFPERLROOT);
+ defaultDir = fnNwGetEnvironmentStr("PERL_ROOT", NWDEFPERLROOT);
}
else
defaultDir = getcwd(curdir, sizeof(curdir)-1);
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
(*ucsterminate)();
}
-
if (psdata->m_fromConsole)
{
// change thread groups for the call to free the memory
// ExitThread(EXIT_THREAD, 0);
#endif
-
return;
}
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
//
return;
}
-
// Initialise the variables
pclp->m_isValid = TRUE;
pclp->m_redirInName = NULL;
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)
return;
}
-
// Parse the command line
fnCommandLineParser(pclp, (char *)psdata->m_commandLine, FALSE);
if (!pclp->m_isValid)
pclp->m_redirBothName = NULL;
}
-
// Signal a semaphore, if indicated by "-{" option, to indicate that
// the script has terminated and files are closed
//
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,
else if (use_system_console)
CreateScreen((char *)"System Console", 0);
-
if (pclp->m_redirInName)
{
if ((stdin_fd = fileno(stdin)) != -1)
}
}
-
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)
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)
pclp->m_redirBothName = NULL;
}
-
// Signal a semaphore, if indicated by -{ option, to indicate that
// the script has terminated and files are closed
//
}
if(env)
+ {
fnDestroyEnvBlock(env);
+ env = NULL;
+ }
+
fnUnregisterWithThreadTable();
// Remove the thread context set during Perl_set_context
Remove_Thread_Ctx();
-
return;
}
// add one for null termination
totalcnt++;
-
env = (char **) malloc (totalcnt * sizeof(char *));
if (env)
{
PFFSETMODE pf_fsetmode;
-
if (mode == O_BINARY || mode == O_TEXT)
{
if (fp)
}
if (errno)
err = &errno;
-
}
else
{
err = &errno;
}
-
return ret;
}
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.
nw_getenviron()
{
if (genviron)
- // This (and not the next line) is the correct operation since it matches with the return type.
- // But it is leaking memory upto 11736 bytes!! So it is commented.
-// return (&genviron);
- return genviron;
+ return (&genviron); // This might leak memory upto 11736 bytes on some versions of NetWare.
+// return genviron; // Abending on some versions of NetWare.
else
fnSetUpEnvBlock(&genviron);