NetWare update from Ananth Kesari.
authorJarkko Hietaniemi <jhi@iki.fi>
Tue, 11 Sep 2001 11:50:48 +0000 (11:50 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Tue, 11 Sep 2001 11:50:48 +0000 (11:50 +0000)
p4raw-id: //depot/perl@12002

NetWare/NWUtil.c
NetWare/Nwmain.c
NetWare/Nwpipe.c
NetWare/config.wc
NetWare/config_H.wc
NetWare/nwutil.h

index 9cc5b5c..ea0e485 100644 (file)
@@ -735,6 +735,7 @@ char* fnMy_MkTemp(char* templatestr)
 
        char termchar = '\0';
        char letter = 'a';
+       char letter1 = 'a';
 
 
        if (templatestr && (pXs = strstr(templatestr, (char *)"XXXXXX")))
@@ -753,6 +754,14 @@ char* fnMy_MkTemp(char* templatestr)
                else
                        pPid = numbuf;
 
+/**
+               Backtick operation uses temp files that are stored under DEFPERLTEMP directory.
+               They are temporarily used and then cleaned up after usage.
+               In the process of operation to allow for more temp files, the below logic is used.
+               This allows 26 files (like, pla00015.tmp through plz00015.tmp) plus
+               26x26=676 (like, plaa0015.tmp through plzz0015.tmp)
+**/
+
                letter = 'a';
                do
                {
@@ -765,6 +774,23 @@ char* fnMy_MkTemp(char* templatestr)
                        letter++;
                } while (letter <= 'z');
 
+               letter1 = 'a';
+               do
+               {
+                       letter = 'a';
+                       do
+                       {
+                               sprintf(pXs, (char *)"%c%c%04.5s", letter1, letter, pPid);
+                               pXs[6] = termchar;
+                               if (access(templatestr, 0) != 0)        // File does not exist
+                               {
+                                       return templatestr;
+                               }
+                               letter++;
+                       } while (letter <= 'z');
+                       letter1++;
+               } while (letter1 <= 'z');
+
                errno = ENOENT;
                return NULL;
        }
index c6cea84..0e8bf0b 100644 (file)
@@ -160,8 +160,8 @@ void main(int argc, char *argv[])
 
 //     Ensure that we have a "temp" directory
        fnSetupNamespace();
-       if (access(DEFTEMP, 0) != 0)
-               mkdir(DEFTEMP);
+       if (access(DEFPERLTEMP, 0) != 0)
+               mkdir(DEFPERLTEMP);
 
        // Create the file NUL if not present. This is done only once per NLM load.
        // This is required for -e.
index 2da2b06..0deffe5 100644 (file)
@@ -344,7 +344,7 @@ FILE* fnPipeFileOpen(PTEMPPIPEFILE ptpf, char* command, char* mode)
 
        // Create a temporary file name
        //
-       strncpy ( tempName, fnNwGetEnvironmentStr((char *)"TEMP", DEFTEMP), (_MAX_PATH - 20) );
+       strncpy ( tempName, fnNwGetEnvironmentStr((char *)"TEMP", DEFPERLTEMP), (_MAX_PATH - 20) );
        tempName[_MAX_PATH-20] = '\0';
        strcat(tempName, (char *)"\\plXXXXXX.tmp");
        if (!fnMy_MkTemp(tempName))
index 9997483..ff6d3c9 100644 (file)
@@ -157,7 +157,7 @@ d_fstatfs='undef'
 d_fstatvfs='undef'
 d_ftello='undef'
 d_ftime='define'
-d_getcwd='undef'
+d_getcwd='define'
 d_getfsstat='undef'
 d_getgrent='undef'
 d_getgrps='undef'
index f10a798..b0ddd9e 100644 (file)
  *     This symbol, if defined, indicates that the getcwd routine is
  *     available to get the current working directory.
  */
-/*#define HAS_GETCWD           /**/
+#define HAS_GETCWD             /**/
 
 /* HAS_GETESPWNAM:
  *     This symbol, if defined, indicates that the getespwnam system call is
index a2e35ec..2d5dd0f 100644 (file)
@@ -89,10 +89,10 @@ char* fnMy_MkTemp(char* templatestr);
  */
 #define DEFPERLROOT "sys:\\perl\\scripts"
 
-/* DEFTEMP:
+/* DEFPERLTEMP:
  *  This symbol contains the name of the default temp files directory.
  */
-#define DEFTEMP "sys:\\perl\\temp"
+#define DEFPERLTEMP "sys:\\perl\\temp"
 
 
 #endif // __NWUtil_H__