Changeset 985 for trunk/dll/pathutil.c
- Timestamp:
- Mar 1, 2008, 2:37:14 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/pathutil.c
r928 r985 11 11 05 Jan 08 SHL Move from arccnrs.c and comp.c to here 12 12 06 Jan 08 GKY Add NormalizeCmdLine to check program strings on entry 13 29 Feb 08 GKY Use xfree where appropriate 14 29 Feb 08 GKY Changes to enable user settable command line length 13 15 14 16 ***********************************************************************/ … … 25 27 #include "errutil.h" // Dos_Error... 26 28 #include "strutil.h" // GetPString 29 30 static PSZ pszSrcFile = __FILE__; 27 31 28 32 // #pragma data_seg(DATA1) … … 105 109 * no space between exe and args etc) 106 110 * Command line passed as pszCmdLine_ 107 * A pointer to a buffer of the size M AXCOMLINESTRGshould be supplied in111 * A pointer to a buffer of the size MaxComLineStrg should be supplied in 108 112 * pszWorkBuf. This is where the quoted etc as necessary command 109 113 * line string will be returned. … … 112 116 PCSZ NormalizeCmdLine(PSZ pszWorkBuf, PSZ pszCmdLine_) 113 117 { 114 char szCmdLine[MAXCOMLINESTRG], szArgs[MAXCOMLINESTRG];118 char *szCmdLine, *szArgs; 115 119 char *offset = '\0', *offsetexe, *offsetcom, *offsetcmd, *offsetbtm, *offsetbat; 116 120 APIRET ret; … … 123 127 PSZ pszNewCmdLine = pszWorkBuf; 124 128 129 szCmdLine = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 130 if (!szCmdLine) 131 return pszCmdLine_; //already complained 132 szArgs = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 133 if (!szArgs) { 134 xfree(szCmdLine); 135 return pszCmdLine_; //already complained 136 } 125 137 bstrip(pszCmdLine_); 126 memset(pszWorkBuf, 0, M AXCOMLINESTRG);138 memset(pszWorkBuf, 0, MaxComLineStrg); 127 139 strcpy(szCmdLine, pszCmdLine_); 128 140 if (szCmdLine[0] != '\0') { … … 317 329 } 318 330 } 331 xfree(szArgs); 332 xfree(szCmdLine); 319 333 return pszWorkBuf; 320 334 }
Note:
See TracChangeset
for help on using the changeset viewer.