From: Jarkko Hietaniemi Date: Tue, 11 Sep 2001 11:50:48 +0000 (+0000) Subject: NetWare update from Ananth Kesari. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=78196db058807d48f2c755ea8e4fa61c11bee0cc;p=p5sagit%2Fp5-mst-13.2.git NetWare update from Ananth Kesari. p4raw-id: //depot/perl@12002 --- diff --git a/NetWare/NWUtil.c b/NetWare/NWUtil.c index 9cc5b5c..ea0e485 100644 --- a/NetWare/NWUtil.c +++ b/NetWare/NWUtil.c @@ -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; } diff --git a/NetWare/Nwmain.c b/NetWare/Nwmain.c index c6cea84..0e8bf0b 100644 --- a/NetWare/Nwmain.c +++ b/NetWare/Nwmain.c @@ -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. diff --git a/NetWare/Nwpipe.c b/NetWare/Nwpipe.c index 2da2b06..0deffe5 100644 --- a/NetWare/Nwpipe.c +++ b/NetWare/Nwpipe.c @@ -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)) diff --git a/NetWare/config.wc b/NetWare/config.wc index 9997483..ff6d3c9 100644 --- a/NetWare/config.wc +++ b/NetWare/config.wc @@ -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' diff --git a/NetWare/config_H.wc b/NetWare/config_H.wc index f10a798..b0ddd9e 100644 --- a/NetWare/config_H.wc +++ b/NetWare/config_H.wc @@ -1370,7 +1370,7 @@ * 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 diff --git a/NetWare/nwutil.h b/NetWare/nwutil.h index a2e35ec..2d5dd0f 100644 --- a/NetWare/nwutil.h +++ b/NetWare/nwutil.h @@ -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__