This is a live mirror of the Perl 5 development currently hosted at
https://github.com/perl/perl5
https://perl5.git.perl.org
/
perl5.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Correct ambiguous regex capture syntax.
[perl5.git]
/
NetWare
/
Nwmain.c
diff --git
a/NetWare/Nwmain.c
b/NetWare/Nwmain.c
index
0e8bf0b
..
a64534e
100644
(file)
--- a/
NetWare/Nwmain.c
+++ b/
NetWare/Nwmain.c
@@
-119,7
+119,11
@@
int fnFpSetMode(FILE* fp, int mode, int *err);
void fnGetPerlScreenName(char *sPerlScreenName);
void fnGetPerlScreenName(char *sPerlScreenName);
-
+void fnGetPerlScreenName(char *sPerlScreenName);
+void fnSetupNamespace(void);
+char *getcwd(char [], int);
+void fnRunScript(ScriptData* psdata);
+void nw_freeenviron();
/*============================================================================================
/*============================================================================================
@@
-160,12
+164,12
@@
void main(int argc, char *argv[])
// Ensure that we have a "temp" directory
fnSetupNamespace();
// Ensure that we have a "temp" directory
fnSetupNamespace();
- if (access(DEFPERLTEMP, 0) != 0)
- mkdir(DEFPERLTEMP);
+ if (access(
NW
DEFPERLTEMP, 0) != 0)
+ mkdir(
NW
DEFPERLTEMP);
// Create the file NUL if not present. This is done only once per NLM load.
// This is required for -e.
// Create the file NUL if not present. This is done only once per NLM load.
// This is required for -e.
- // Earlier verions were creating temporary files (in perl.c file) for -e.
+ // Earlier ver
s
ions were creating temporary files (in perl.c file) for -e.
// Now, the technique of creating temporary files are removed since they were
// fragile or insecure or slow. It now uses the memory by setting
// the BIT_BUCKET to "nul" on Win32, which is equivalent to /dev/nul of Unix.
// Now, the technique of creating temporary files are removed since they were
// fragile or insecure or slow. It now uses the memory by setting
// the BIT_BUCKET to "nul" on Win32, which is equivalent to /dev/nul of Unix.
@@
-176,8
+180,8
@@
void main(int argc, char *argv[])
{
char sNUL[MAX_DN_BYTES] = {'\0'};
{
char sNUL[MAX_DN_BYTES] = {'\0'};
- strcpy(sNUL, DEFPERLROOT);
- strcat(sNUL, "\\nul");
+ strcpy(sNUL,
NW
DEFPERLROOT);
+ strcat(sNUL, "\\n
wn
ul");
if (access((const char *)sNUL, 0) != 0)
{
// The file, "nul" is not found and so create the file.
if (access((const char *)sNUL, 0) != 0)
{
// The file, "nul" is not found and so create the file.
@@
-299,7
+303,7
@@
void fnSigTermHandler(int sig)
//
while (!fnTerminateThreadInfo() && k < 5)
{
//
while (!fnTerminateThreadInfo() && k < 5)
{
- sleep(1);
+
nw_
sleep(1);
k++;
}
}
k++;
}
}
@@
-308,8
+312,8
@@
void fnSigTermHandler(int sig)
{
char sNUL[MAX_DN_BYTES] = {'\0'};
{
char sNUL[MAX_DN_BYTES] = {'\0'};
- strcpy(sNUL, DEFPERLROOT);
- strcat(sNUL, "\\nul");
+ strcpy(sNUL,
NW
DEFPERLROOT);
+ strcat(sNUL, "\\n
wn
ul");
if (access((const char *)sNUL, 0) == 0)
{
// The file, "nul" is found and so delete it.
if (access((const char *)sNUL, 0) == 0)
{
// The file, "nul" is found and so delete it.
@@
-525,12
+529,11
@@
void fnLaunchPerl(void* context)
errno = 0;
errno = 0;
-
if (psdata->m_fromConsole)
{
// get the default working directory name
//
if (psdata->m_fromConsole)
{
// get the default working directory name
//
- defaultDir = fnNwGetEnvironmentStr("PERL_ROOT", DEFPERLROOT);
+ defaultDir = fnNwGetEnvironmentStr("PERL_ROOT",
NW
DEFPERLROOT);
}
else
defaultDir = getcwd(curdir, sizeof(curdir)-1);
}
else
defaultDir = getcwd(curdir, sizeof(curdir)-1);
@@
-544,12
+547,10
@@
void fnLaunchPerl(void* context)
if (psdata->m_fromConsole)
chdir(defaultDir);
if (psdata->m_fromConsole)
chdir(defaultDir);
-
// run the script
//
fnRunScript(psdata);
// 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
// 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
@@
-561,7
+562,6
@@
void fnLaunchPerl(void* context)
(*ucsterminate)();
}
(*ucsterminate)();
}
-
if (psdata->m_fromConsole)
{
// change thread groups for the call to free the memory
if (psdata->m_fromConsole)
{
// change thread groups for the call to free the memory
@@
-603,7
+603,6
@@
void fnLaunchPerl(void* context)
// ExitThread(EXIT_THREAD, 0);
#endif
// ExitThread(EXIT_THREAD, 0);
#endif
-
return;
}
return;
}
@@
-650,13
+649,11
@@
void fnRunScript(ScriptData* psdata)
int stderr_fd=-1, stderr_fd_dup=-1;
int stderr_fd=-1, stderr_fd_dup=-1;
-
// Main callback instance
//
if (fnRegisterWithThreadTable() == FALSE)
return;
// Main callback instance
//
if (fnRegisterWithThreadTable() == FALSE)
return;
-
// parse the command line into argc/argv style:
// number of params and char array of params
//
// parse the command line into argc/argv style:
// number of params and char array of params
//
@@
-667,7
+664,6
@@
void fnRunScript(ScriptData* psdata)
return;
}
return;
}
-
// Initialise the variables
pclp->m_isValid = TRUE;
pclp->m_redirInName = NULL;
// Initialise the variables
pclp->m_isValid = TRUE;
pclp->m_redirInName = NULL;
@@
-690,7
+686,6
@@
void fnRunScript(ScriptData* psdata)
pclp->m_argc = 0;
pclp->m_argv_len = 1;
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)
// Allocate memory
pclp->m_argv = (char **) malloc(pclp->m_argv_len * sizeof(char *));
if (pclp->m_argv == NULL)
@@
-715,7
+710,6
@@
void fnRunScript(ScriptData* psdata)
return;
}
return;
}
-
// Parse the command line
fnCommandLineParser(pclp, (char *)psdata->m_commandLine, FALSE);
if (!pclp->m_isValid)
// Parse the command line
fnCommandLineParser(pclp, (char *)psdata->m_commandLine, FALSE);
if (!pclp->m_isValid)
@@
-767,7
+761,6
@@
void fnRunScript(ScriptData* psdata)
pclp->m_redirBothName = NULL;
}
pclp->m_redirBothName = NULL;
}
-
// Signal a semaphore, if indicated by "-{" option, to indicate that
// the script has terminated and files are closed
//
// Signal a semaphore, if indicated by "-{" option, to indicate that
// the script has terminated and files are closed
//
@@
-787,7
+780,6
@@
void fnRunScript(ScriptData* psdata)
return;
}
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,
// 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,
@@
-836,7
+828,6
@@
void fnRunScript(ScriptData* psdata)
else if (use_system_console)
CreateScreen((char *)"System Console", 0);
else if (use_system_console)
CreateScreen((char *)"System Console", 0);
-
if (pclp->m_redirInName)
{
if ((stdin_fd = fileno(stdin)) != -1)
if (pclp->m_redirInName)
{
if ((stdin_fd = fileno(stdin)) != -1)
@@
-938,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);
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)
// clean up any redirection
//
if (pclp->m_redirInName && redirIn)
@@
-1000,9
+989,14
@@
void fnRunScript(ScriptData* psdata)
DestroyScreen(newscreenhandle);
}
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);
// 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)
// Cleanup
if(pclp->m_argv)
@@
-1052,7
+1046,6
@@
void fnRunScript(ScriptData* psdata)
pclp->m_redirBothName = NULL;
}
pclp->m_redirBothName = NULL;
}
-
// Signal a semaphore, if indicated by -{ option, to indicate that
// the script has terminated and files are closed
//
// Signal a semaphore, if indicated by -{ option, to indicate that
// the script has terminated and files are closed
//
@@
-1072,12
+1065,15
@@
void fnRunScript(ScriptData* psdata)
}
if(env)
}
if(env)
+ {
fnDestroyEnvBlock(env);
fnDestroyEnvBlock(env);
+ env = NULL;
+ }
+
fnUnregisterWithThreadTable();
// Remove the thread context set during Perl_set_context
Remove_Thread_Ctx();
fnUnregisterWithThreadTable();
// Remove the thread context set during Perl_set_context
Remove_Thread_Ctx();
-
return;
}
return;
}
@@
-1114,7
+1110,6
@@
void fnSetUpEnvBlock(char*** penv)
// add one for null termination
totalcnt++;
// add one for null termination
totalcnt++;
-
env = (char **) malloc (totalcnt * sizeof(char *));
if (env)
{
env = (char **) malloc (totalcnt * sizeof(char *));
if (env)
{
@@
-1223,7
+1218,6
@@
int fnFpSetMode(FILE* fp, int mode, int *err)
PFFSETMODE pf_fsetmode;
PFFSETMODE pf_fsetmode;
-
if (mode == O_BINARY || mode == O_TEXT)
{
if (fp)
if (mode == O_BINARY || mode == O_TEXT)
{
if (fp)
@@
-1244,7
+1238,6
@@
int fnFpSetMode(FILE* fp, int mode, int *err)
}
if (errno)
err = &errno;
}
if (errno)
err = &errno;
-
}
else
{
}
else
{
@@
-1258,7
+1251,6
@@
int fnFpSetMode(FILE* fp, int mode, int *err)
err = &errno;
}
err = &errno;
}
-
return ret;
}
return ret;
}
@@
-1282,7
+1274,6
@@
void fnInternalPerlLaunchHandler(char* cmdLine)
ScriptData* psdata=NULL;
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.
// 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.