char termchar = '\0';
char letter = 'a';
+ char letter1 = 'a';
if (templatestr && (pXs = strstr(templatestr, (char *)"XXXXXX")))
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
{
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;
}
// 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.
// 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))
d_fstatvfs='undef'
d_ftello='undef'
d_ftime='define'
-d_getcwd='undef'
+d_getcwd='define'
d_getfsstat='undef'
d_getgrent='undef'
d_getgrps='undef'
* 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
*/
#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__