Changeset 985 for trunk/dll/pathutil.c


Ignore:
Timestamp:
Mar 1, 2008, 2:37:14 AM (17 years ago)
Author:
Gregg Young
Message:

Update sizes dialog (ticket 44); Make max command line length user settable (ticket 199); use xfree for free in most cases (ticket 212); initial code to check for valid ini file (ticket 102); Some additional refactoring and structure rework; Some documentation updates;

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/pathutil.c

    r928 r985  
    1111  05 Jan 08 SHL Move from arccnrs.c and comp.c to here
    1212  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
    1315
    1416***********************************************************************/
     
    2527#include "errutil.h"                    // Dos_Error...
    2628#include "strutil.h"                    // GetPString
     29
     30static PSZ pszSrcFile = __FILE__;
    2731
    2832// #pragma data_seg(DATA1)
     
    105109 * no space between exe and args etc)
    106110 * Command line passed as pszCmdLine_
    107  * A pointer to a buffer of the size MAXCOMLINESTRG should be supplied in
     111 * A pointer to a buffer of the size MaxComLineStrg should be supplied in
    108112 * pszWorkBuf. This is where the quoted etc as necessary command
    109113 * line string will be returned.
     
    112116PCSZ NormalizeCmdLine(PSZ pszWorkBuf, PSZ pszCmdLine_)
    113117{
    114   char szCmdLine[MAXCOMLINESTRG], szArgs[MAXCOMLINESTRG];
     118  char *szCmdLine, *szArgs;
    115119  char *offset = '\0', *offsetexe, *offsetcom, *offsetcmd, *offsetbtm, *offsetbat;
    116120  APIRET ret;
     
    123127  PSZ pszNewCmdLine = pszWorkBuf;
    124128
     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  }
    125137  bstrip(pszCmdLine_);
    126   memset(pszWorkBuf, 0, MAXCOMLINESTRG);
     138  memset(pszWorkBuf, 0, MaxComLineStrg);
    127139  strcpy(szCmdLine, pszCmdLine_);
    128140  if (szCmdLine[0] != '\0') {
     
    317329    }
    318330  }
     331  xfree(szArgs);
     332  xfree(szCmdLine);
    319333  return pszWorkBuf;
    320334}
Note: See TracChangeset for help on using the changeset viewer.