OSDN Git Service

Updated SVN properties of added files from patch 1598194 (rev 3812).
authorGal Hammer <galh@users.sourceforge.net>
Fri, 17 Nov 2006 17:46:59 +0000 (17:46 +0000)
committerGal Hammer <galh@users.sourceforge.net>
Fri, 17 Nov 2006 17:46:59 +0000 (17:46 +0000)
Src/ClearCaseCmdLineParser.cpp
Src/ClearCaseCmdLineParser.h
Src/CmdLineParser.h
Src/MergeCmdLineInfo.cpp
Src/MergeCmdLineInfo.h
Src/WinMergeCmdLineParser.cpp
Src/WinMergeCmdLineParser.h

index 1cc7f6e..6e21db3 100644 (file)
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-//    WinMerge: An interactive diff/merge utility\r
-//    Copyright (C) 1997 Dean P. Grimm\r
-//\r
-//    This program is free software; you can redistribute it and/or modify\r
-//    it under the terms of the GNU General Public License as published by\r
-//    the Free Software Foundation; either version 2 of the License, or\r
-//    (at your option) any later version.\r
-//\r
-//    This program is distributed in the hope that it will be useful,\r
-//    but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-//    GNU General Public License for more details.\r
-//\r
-//    You should have received a copy of the GNU General Public License\r
-//    along with this program; if not, write to the Free Software\r
-//    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
-//\r
-/////////////////////////////////////////////////////////////////////////////\r
-\r
-/** \r
- * @file  ClearCaseCmdLineParser.cpp\r
- *\r
- * @brief ClearCaseCmdLineParser class implemantation.\r
- *\r
- */\r
-\r
-// RCS ID line follows -- this is updated by CVS\r
-// $Id: CmdLineParser.cpp $\r
-\r
-#include "StdAfx.h"\r
-\r
-#include "ClearCaseCmdLineParser.h"\r
-#include "MainFrm.h"\r
-#include "MergeCmdLineInfo.h"\r
-#include "Paths.h"\r
-\r
-ClearCaseCmdLineParser::ClearCaseCmdLineParser(MergeCmdLineInfo& CmdLineInfo, const TCHAR *szFileName) :\r
-       CmdLineParser(CmdLineInfo),\r
-       m_bDesc(false),\r
-       m_bBaseFile(false),\r
-       m_bOutFile(false)\r
-{\r
-       m_CmdLineInfo.m_bEscShutdown = true;\r
-\r
-       m_CmdLineInfo.m_dwLeftFlags |= FFILEOPEN_READONLY | FFILEOPEN_NOMRU;\r
-       m_CmdLineInfo.m_dwRightFlags |= FFILEOPEN_NOMRU;\r
-\r
-       // szFileName is either "xmerge" or "xcompare".\r
-       if (lstrcmpi(szFileName, _T("xmerge")))\r
-       {\r
-               m_CmdLineInfo.m_dwRightFlags |= FFILEOPEN_READONLY;\r
-\r
-               // Compare tool doesn't have a common ancestor file description. We\r
-               // put a phony description so the command line parser will skip it.\r
-               m_sBaseDesc = _T("<No Base>");\r
-       }\r
-}\r
-\r
-void ClearCaseCmdLineParser::ParseParam(const TCHAR* pszParam, BOOL bFlag, BOOL bLast)\r
-{\r
-       if (TRUE == bFlag)\r
-       {\r
-               if (!lstrcmpi(pszParam, _T("base")))\r
-               {\r
-                       // -base is followed by common ancestor file description.\r
-                       m_bBaseFile = true;\r
-               }\r
-               else if (!lstrcmpi(pszParam, _T("out")))\r
-               {\r
-                       // -out is followed by merge's output file name.\r
-                       m_bOutFile = true;\r
-               }\r
-               else if (!lstrcmpi(pszParam, _T("fname")))\r
-               {\r
-                       // -fname is followed by file description.\r
-                       m_bDesc = true;\r
-               }\r
-       }\r
-       else\r
-       {\r
-               if ((m_bBaseFile == true) && m_sBaseFile.IsEmpty())\r
-               {\r
-                       m_sBaseFile = pszParam;\r
-               }\r
-               else if ((m_bOutFile == true) && m_sOutFile.IsEmpty())\r
-               {\r
-                       m_sOutFile = pszParam;\r
-               }\r
-               else if ((m_bDesc == true) && m_sBaseDesc.IsEmpty())\r
-               {\r
-                       m_sBaseDesc = pszParam;\r
-                       m_bDesc = false;\r
-               }\r
-               else if ((m_bDesc == true) && m_CmdLineInfo.m_sLeftDesc.IsEmpty())\r
-               {\r
-                       m_CmdLineInfo.m_sLeftDesc = pszParam;\r
-                       m_bDesc = false;\r
-               }\r
-               else if ((m_bDesc == true) && m_CmdLineInfo.m_sRightDesc.IsEmpty())\r
-               {\r
-                       m_CmdLineInfo.m_sRightDesc = pszParam;\r
-               }\r
-               else\r
-               {\r
-                       CString sFile = paths_GetLongPath(pszParam);\r
-                       m_CmdLineInfo.m_Files.SetAtGrow(m_CmdLineInfo.m_nFiles, sFile);\r
-                       m_CmdLineInfo.m_nFiles += 1;\r
-               }\r
-       }\r
-\r
-       if (TRUE == bLast)\r
-       {\r
-               if (FALSE == m_sOutFile.IsEmpty())\r
-               {\r
-                       CString sFile = paths_GetLongPath(m_sOutFile);\r
-                       m_CmdLineInfo.m_Files.SetAtGrow(m_CmdLineInfo.m_nFiles, sFile);\r
-                       m_CmdLineInfo.m_nFiles += 1;\r
-               }\r
-       }\r
-}\r
+/////////////////////////////////////////////////////////////////////////////
+//
+//    WinMerge: An interactive diff/merge utility
+//    Copyright (C) 1997 Dean P. Grimm
+//
+//    This program is free software; you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation; either version 2 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program; if not, write to the Free Software
+//    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/** 
+ * @file  ClearCaseCmdLineParser.cpp
+ *
+ * @brief ClearCaseCmdLineParser class implemantation.
+ *
+ */
+
+// RCS ID line follows -- this is updated by CVS
+// $Id$
+
+#include "StdAfx.h"
+
+#include "ClearCaseCmdLineParser.h"
+#include "MainFrm.h"
+#include "MergeCmdLineInfo.h"
+#include "Paths.h"
+
+ClearCaseCmdLineParser::ClearCaseCmdLineParser(MergeCmdLineInfo& CmdLineInfo, const TCHAR *szFileName) :
+       CmdLineParser(CmdLineInfo),
+       m_bDesc(false),
+       m_bBaseFile(false),
+       m_bOutFile(false)
+{
+       m_CmdLineInfo.m_bEscShutdown = true;
+
+       m_CmdLineInfo.m_dwLeftFlags |= FFILEOPEN_READONLY | FFILEOPEN_NOMRU;
+       m_CmdLineInfo.m_dwRightFlags |= FFILEOPEN_NOMRU;
+
+       // szFileName is either "xmerge" or "xcompare".
+       if (lstrcmpi(szFileName, _T("xmerge")))
+       {
+               m_CmdLineInfo.m_dwRightFlags |= FFILEOPEN_READONLY;
+
+               // Compare tool doesn't have a common ancestor file description. We
+               // put a phony description so the command line parser will skip it.
+               m_sBaseDesc = _T("<No Base>");
+       }
+}
+
+void ClearCaseCmdLineParser::ParseParam(const TCHAR* pszParam, BOOL bFlag, BOOL bLast)
+{
+       if (TRUE == bFlag)
+       {
+               if (!lstrcmpi(pszParam, _T("base")))
+               {
+                       // -base is followed by common ancestor file description.
+                       m_bBaseFile = true;
+               }
+               else if (!lstrcmpi(pszParam, _T("out")))
+               {
+                       // -out is followed by merge's output file name.
+                       m_bOutFile = true;
+               }
+               else if (!lstrcmpi(pszParam, _T("fname")))
+               {
+                       // -fname is followed by file description.
+                       m_bDesc = true;
+               }
+       }
+       else
+       {
+               if ((m_bBaseFile == true) && m_sBaseFile.IsEmpty())
+               {
+                       m_sBaseFile = pszParam;
+               }
+               else if ((m_bOutFile == true) && m_sOutFile.IsEmpty())
+               {
+                       m_sOutFile = pszParam;
+               }
+               else if ((m_bDesc == true) && m_sBaseDesc.IsEmpty())
+               {
+                       m_sBaseDesc = pszParam;
+                       m_bDesc = false;
+               }
+               else if ((m_bDesc == true) && m_CmdLineInfo.m_sLeftDesc.IsEmpty())
+               {
+                       m_CmdLineInfo.m_sLeftDesc = pszParam;
+                       m_bDesc = false;
+               }
+               else if ((m_bDesc == true) && m_CmdLineInfo.m_sRightDesc.IsEmpty())
+               {
+                       m_CmdLineInfo.m_sRightDesc = pszParam;
+               }
+               else
+               {
+                       CString sFile = paths_GetLongPath(pszParam);
+                       m_CmdLineInfo.m_Files.SetAtGrow(m_CmdLineInfo.m_nFiles, sFile);
+                       m_CmdLineInfo.m_nFiles += 1;
+               }
+       }
+
+       if (TRUE == bLast)
+       {
+               if (FALSE == m_sOutFile.IsEmpty())
+               {
+                       CString sFile = paths_GetLongPath(m_sOutFile);
+                       m_CmdLineInfo.m_Files.SetAtGrow(m_CmdLineInfo.m_nFiles, sFile);
+                       m_CmdLineInfo.m_nFiles += 1;
+               }
+       }
+}
index b0691dc..10368a1 100644 (file)
@@ -1,71 +1,71 @@
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-//    WinMerge: An interactive diff/merge utility\r
-//    Copyright (C) 1997 Dean P. Grimm\r
-//\r
-//    This program is free software; you can redistribute it and/or modify\r
-//    it under the terms of the GNU General Public License as published by\r
-//    the Free Software Foundation; either version 2 of the License, or\r
-//    (at your option) any later version.\r
-//\r
-//    This program is distributed in the hope that it will be useful,\r
-//    but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-//    GNU General Public License for more details.\r
-//\r
-//    You should have received a copy of the GNU General Public License\r
-//    along with this program; if not, write to the Free Software\r
-//    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
-//\r
-/////////////////////////////////////////////////////////////////////////////\r
-\r
-#ifndef _CLEAR_CASE_CMD_LINE_PARSER_INCLUDED_\r
-#define _CLEAR_CASE_CMD_LINE_PARSER_INCLUDED_\r
-\r
-/** \r
- * @file  ClearCaseCmdLineParser.h\r
- *\r
- * @brief ClearCaseCmdLineParser class decleration.\r
- *\r
- */\r
-\r
-// RCS ID line follows -- this is updated by CVS\r
-// $Id: CmdLineParser.h $\r
-\r
-#include "CmdLineParser.h"\r
-\r
-/**\r
- * @brief Rational ClearCase's command line parser.\r
- *\r
- * This parser is able to parse ClearCase external tools' command line, both\r
- * compare and merge.\r
- *\r
- */\r
-class ClearCaseCmdLineParser : public CmdLineParser\r
-{\r
-public:\r
-\r
-       /** @brief ClearCaseCmdLineParser's constructor.\r
-        *\r
-        * @param [in] szFileName Executable file name. Required in order to\r
-        *      know which external tool was executed.\r
-        *\r
-        */\r
-       ClearCaseCmdLineParser(MergeCmdLineInfo& CmdLineInfo, const TCHAR *szFileName);\r
-\r
-       virtual ~ClearCaseCmdLineParser() { }\r
-\r
-       virtual void ParseParam(const TCHAR* pszParam, BOOL bFlag, BOOL bLast);\r
-\r
-private:\r
-\r
-       bool m_bDesc;\r
-       bool m_bBaseFile; /**< Files' common ancestor. Used till we'll have a 3-ways merge. */\r
-       bool m_bOutFile;\r
-\r
-       CString m_sBaseFile;\r
-       CString m_sBaseDesc;\r
-       CString m_sOutFile;\r
-};\r
-\r
-#endif // _CLEAR_CASE_CMD_LINE_PARSER_INCLUDED_\r
+/////////////////////////////////////////////////////////////////////////////
+//
+//    WinMerge: An interactive diff/merge utility
+//    Copyright (C) 1997 Dean P. Grimm
+//
+//    This program is free software; you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation; either version 2 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program; if not, write to the Free Software
+//    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _CLEAR_CASE_CMD_LINE_PARSER_INCLUDED_
+#define _CLEAR_CASE_CMD_LINE_PARSER_INCLUDED_
+
+/** 
+ * @file  ClearCaseCmdLineParser.h
+ *
+ * @brief ClearCaseCmdLineParser class decleration.
+ *
+ */
+
+// RCS ID line follows -- this is updated by CVS
+// $Id$
+
+#include "CmdLineParser.h"
+
+/**
+ * @brief Rational ClearCase's command line parser.
+ *
+ * This parser is able to parse ClearCase external tools' command line, both
+ * compare and merge.
+ *
+ */
+class ClearCaseCmdLineParser : public CmdLineParser
+{
+public:
+
+       /** @brief ClearCaseCmdLineParser's constructor.
+        *
+        * @param [in] szFileName Executable file name. Required in order to
+        *      know which external tool was executed.
+        *
+        */
+       ClearCaseCmdLineParser(MergeCmdLineInfo& CmdLineInfo, const TCHAR *szFileName);
+
+       virtual ~ClearCaseCmdLineParser() { }
+
+       virtual void ParseParam(const TCHAR* pszParam, BOOL bFlag, BOOL bLast);
+
+private:
+
+       bool m_bDesc;
+       bool m_bBaseFile; /**< Files' common ancestor. Used till we'll have a 3-ways merge. */
+       bool m_bOutFile;
+
+       CString m_sBaseFile;
+       CString m_sBaseDesc;
+       CString m_sOutFile;
+};
+
+#endif // _CLEAR_CASE_CMD_LINE_PARSER_INCLUDED_
index a6fc7b5..0fbefa9 100644 (file)
@@ -1,84 +1,84 @@
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-//    WinMerge: An interactive diff/merge utility\r
-//    Copyright (C) 1997 Dean P. Grimm\r
-//\r
-//    This program is free software; you can redistribute it and/or modify\r
-//    it under the terms of the GNU General Public License as published by\r
-//    the Free Software Foundation; either version 2 of the License, or\r
-//    (at your option) any later version.\r
-//\r
-//    This program is distributed in the hope that it will be useful,\r
-//    but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-//    GNU General Public License for more details.\r
-//\r
-//    You should have received a copy of the GNU General Public License\r
-//    along with this program; if not, write to the Free Software\r
-//    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
-//\r
-/////////////////////////////////////////////////////////////////////////////\r
-\r
-#ifndef _CMD_LINE_PARSER_INCLUDED_\r
-#define _CMD_LINE_PARSER_INCLUDED_\r
-\r
-/** \r
- * @file  CmdLineParser.h\r
- *\r
- * @brief CmdLineParser class declaration.\r
- *\r
- */\r
-\r
-// RCS ID line follows -- this is updated by CVS\r
-// $Id: CmdLineParser.h $\r
-\r
-class MergeCmdLineInfo;\r
-\r
-/**\r
- * @brief Base command line parser interface.\r
- *\r
- * WinMerge is able to parse command line arguments other than its own. In\r
- * order to add this capability, a developer should inherit this class and\r
- * implement the ParseParam method.\r
- *\r
- */\r
-class CmdLineParser\r
-{\r
-public:\r
-\r
-       /** @brief CmdLineParser's constructor.\r
-        *\r
-        * @param [in] CmdLineInfo A class which hold the information obtained\r
-        *      from the command line arguments.\r
-        *\r
-        */\r
-       CmdLineParser(MergeCmdLineInfo& CmdLineInfo) :\r
-               m_CmdLineInfo(CmdLineInfo)\r
-       {\r
-\r
-       }\r
-\r
-       /** @brief CmdLineParser's destructor. */\r
-       virtual ~CmdLineParser() { }\r
-\r
-\r
-       /** @brief The command line argument parser.\r
-        *\r
-        * This method should be implemented by the derived class and do the\r
-        * actual parsing.\r
-        *\r
-        * @param [in] pszParam The parameter or flag.\r
-        * @bFlag [in] bFlag Indicates whether pszParam is a parameter or a\r
-        *      flag.\r
-        * @bLast [in] bLast Indicates if this is the last parameter or flag\r
-        *      on the command line.\r
-        *\r
-        */\r
-       virtual void ParseParam(const TCHAR* pszParam, BOOL bFlag, BOOL bLast) = 0;\r
-\r
-protected:\r
-\r
-       MergeCmdLineInfo& m_CmdLineInfo;\r
-};\r
-\r
-#endif // _CMD_LINE_PARSER_INCLUDED_\r
+/////////////////////////////////////////////////////////////////////////////
+//
+//    WinMerge: An interactive diff/merge utility
+//    Copyright (C) 1997 Dean P. Grimm
+//
+//    This program is free software; you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation; either version 2 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program; if not, write to the Free Software
+//    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _CMD_LINE_PARSER_INCLUDED_
+#define _CMD_LINE_PARSER_INCLUDED_
+
+/** 
+ * @file  CmdLineParser.h
+ *
+ * @brief CmdLineParser class declaration.
+ *
+ */
+
+// RCS ID line follows -- this is updated by CVS
+// $Id$
+
+class MergeCmdLineInfo;
+
+/**
+ * @brief Base command line parser interface.
+ *
+ * WinMerge is able to parse command line arguments other than its own. In
+ * order to add this capability, a developer should inherit this class and
+ * implement the ParseParam method.
+ *
+ */
+class CmdLineParser
+{
+public:
+
+       /** @brief CmdLineParser's constructor.
+        *
+        * @param [in] CmdLineInfo A class which hold the information obtained
+        *      from the command line arguments.
+        *
+        */
+       CmdLineParser(MergeCmdLineInfo& CmdLineInfo) :
+               m_CmdLineInfo(CmdLineInfo)
+       {
+
+       }
+
+       /** @brief CmdLineParser's destructor. */
+       virtual ~CmdLineParser() { }
+
+
+       /** @brief The command line argument parser.
+        *
+        * This method should be implemented by the derived class and do the
+        * actual parsing.
+        *
+        * @param [in] pszParam The parameter or flag.
+        * @bFlag [in] bFlag Indicates whether pszParam is a parameter or a
+        *      flag.
+        * @bLast [in] bLast Indicates if this is the last parameter or flag
+        *      on the command line.
+        *
+        */
+       virtual void ParseParam(const TCHAR* pszParam, BOOL bFlag, BOOL bLast) = 0;
+
+protected:
+
+       MergeCmdLineInfo& m_CmdLineInfo;
+};
+
+#endif // _CMD_LINE_PARSER_INCLUDED_
index 85e07da..8255d60 100644 (file)
@@ -1,93 +1,93 @@
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-//    WinMerge: An interactive diff/merge utility\r
-//    Copyright (C) 1997 Dean P. Grimm\r
-//\r
-//    This program is free software; you can redistribute it and/or modify\r
-//    it under the terms of the GNU General Public License as published by\r
-//    the Free Software Foundation; either version 2 of the License, or\r
-//    (at your option) any later version.\r
-//\r
-//    This program is distributed in the hope that it will be useful,\r
-//    but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-//    GNU General Public License for more details.\r
-//\r
-//    You should have received a copy of the GNU General Public License\r
-//    along with this program; if not, write to the Free Software\r
-//    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
-//\r
-/////////////////////////////////////////////////////////////////////////////\r
-\r
-/** \r
- * @file  CmdLineParser.h\r
- *\r
- * @brief CmdLineParser class implementation.\r
- *\r
- */\r
-\r
-// RCS ID line follows -- this is updated by CVS\r
-// $Id: CmdLineParser.h $\r
-\r
-#include "StdAfx.h"\r
-\r
-#include <shlwapi.h> // Required for PathFindFileName\r
-\r
-#include "MainFrm.h"\r
-#include "MergeCmdLineInfo.h"\r
-#include "ClearCaseCmdLineParser.h"\r
-#include "WinMergeCmdLineParser.h"\r
-\r
-// MergeCmdLineInfo\r
-\r
-MergeCmdLineInfo::MergeCmdLineInfo(const TCHAR *szExeName) : CCommandLineInfo(),\r
-       m_nCmdShow(SW_SHOWNORMAL),\r
-       m_bClearCaseTool(false),\r
-       m_bEscShutdown(false),\r
-       m_bExitIfNoDiff(false),\r
-       m_bRecurse(false),\r
-       m_bNonInteractive(false),\r
-       m_bNoPrefs(false),\r
-       m_bSingleInstance(false),\r
-       m_bShowUsage(false),\r
-       m_dwLeftFlags(FFILEOPEN_CMDLINE),\r
-       m_dwRightFlags(FFILEOPEN_CMDLINE),\r
-       m_nFiles(0)\r
-{\r
-       m_Files.SetSize(2);\r
-\r
-       // Rational ClearCase has a weird way of executing external\r
-       // tools which replace the build-in ones. It also doesn't allow\r
-       // you to define which parameters to send to the executable.\r
-       // So, in order to run as an external tool, WinMerge should do:\r
-       // if argv[0] is "xcompare" then it "knows" that it was\r
-       // executed from ClearCase. In this case, it should read and\r
-       // parse ClearCase's command line parameters and not the\r
-       // "regular" parameters. More information can be found in\r
-       // C:\Program Files\Rational\ClearCase\lib\mgrs\mgr_info.h file.\r
-\r
-       LPTSTR szFileName = ::PathFindFileName(szExeName);\r
-\r
-       if (lstrcmpi(szFileName, _T("xcompare")) && lstrcmpi(szFileName, _T("xmerge")))\r
-       {\r
-               m_pCmdLineParser = new WinMergeCmdLineParser(*this);\r
-       }\r
-       else\r
-       {\r
-               m_bClearCaseTool = true;\r
-               m_pCmdLineParser = new ClearCaseCmdLineParser(*this, szFileName);               \r
-       }\r
-}\r
-\r
-MergeCmdLineInfo::~MergeCmdLineInfo()\r
-{\r
-       delete m_pCmdLineParser;\r
-}\r
-\r
-void MergeCmdLineInfo::ParseParam(const TCHAR* pszParam, BOOL bFlag, BOOL bLast)\r
-{\r
-       // Give our base class a chance to figure out what is the parameter.\r
-       CCommandLineInfo::ParseParam(pszParam, bFlag, bLast);\r
-\r
-       m_pCmdLineParser->ParseParam(pszParam, bFlag, bLast);\r
-}\r
+/////////////////////////////////////////////////////////////////////////////
+//
+//    WinMerge: An interactive diff/merge utility
+//    Copyright (C) 1997 Dean P. Grimm
+//
+//    This program is free software; you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation; either version 2 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program; if not, write to the Free Software
+//    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/** 
+ * @file  CmdLineParser.h
+ *
+ * @brief CmdLineParser class implementation.
+ *
+ */
+
+// RCS ID line follows -- this is updated by CVS
+// $Id$
+
+#include "StdAfx.h"
+
+#include <shlwapi.h> // Required for PathFindFileName
+
+#include "MainFrm.h"
+#include "MergeCmdLineInfo.h"
+#include "ClearCaseCmdLineParser.h"
+#include "WinMergeCmdLineParser.h"
+
+// MergeCmdLineInfo
+
+MergeCmdLineInfo::MergeCmdLineInfo(const TCHAR *szExeName) : CCommandLineInfo(),
+       m_nCmdShow(SW_SHOWNORMAL),
+       m_bClearCaseTool(false),
+       m_bEscShutdown(false),
+       m_bExitIfNoDiff(false),
+       m_bRecurse(false),
+       m_bNonInteractive(false),
+       m_bNoPrefs(false),
+       m_bSingleInstance(false),
+       m_bShowUsage(false),
+       m_dwLeftFlags(FFILEOPEN_CMDLINE),
+       m_dwRightFlags(FFILEOPEN_CMDLINE),
+       m_nFiles(0)
+{
+       m_Files.SetSize(2);
+
+       // Rational ClearCase has a weird way of executing external
+       // tools which replace the build-in ones. It also doesn't allow
+       // you to define which parameters to send to the executable.
+       // So, in order to run as an external tool, WinMerge should do:
+       // if argv[0] is "xcompare" then it "knows" that it was
+       // executed from ClearCase. In this case, it should read and
+       // parse ClearCase's command line parameters and not the
+       // "regular" parameters. More information can be found in
+       // C:\Program Files\Rational\ClearCase\lib\mgrs\mgr_info.h file.
+
+       LPTSTR szFileName = ::PathFindFileName(szExeName);
+
+       if (lstrcmpi(szFileName, _T("xcompare")) && lstrcmpi(szFileName, _T("xmerge")))
+       {
+               m_pCmdLineParser = new WinMergeCmdLineParser(*this);
+       }
+       else
+       {
+               m_bClearCaseTool = true;
+               m_pCmdLineParser = new ClearCaseCmdLineParser(*this, szFileName);               
+       }
+}
+
+MergeCmdLineInfo::~MergeCmdLineInfo()
+{
+       delete m_pCmdLineParser;
+}
+
+void MergeCmdLineInfo::ParseParam(const TCHAR* pszParam, BOOL bFlag, BOOL bLast)
+{
+       // Give our base class a chance to figure out what is the parameter.
+       CCommandLineInfo::ParseParam(pszParam, bFlag, bLast);
+
+       m_pCmdLineParser->ParseParam(pszParam, bFlag, bLast);
+}
index 5ae8ee7..9c44a24 100644 (file)
@@ -1,95 +1,95 @@
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-//    WinMerge: An interactive diff/merge utility\r
-//    Copyright (C) 1997 Dean P. Grimm\r
-//\r
-//    This program is free software; you can redistribute it and/or modify\r
-//    it under the terms of the GNU General Public License as published by\r
-//    the Free Software Foundation; either version 2 of the License, or\r
-//    (at your option) any later version.\r
-//\r
-//    This program is distributed in the hope that it will be useful,\r
-//    but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-//    GNU General Public License for more details.\r
-//\r
-//    You should have received a copy of the GNU General Public License\r
-//    along with this program; if not, write to the Free Software\r
-//    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
-//\r
-/////////////////////////////////////////////////////////////////////////////\r
-\r
-#ifndef _MERGE_CMD_LINE_INFO_INCLUDED_\r
-#define _MERGE_CMD_LINE_INFO_INCLUDED_\r
-\r
-/** \r
- * @file  MergeCmdLineInfo.h\r
- *\r
- * @brief MergeCmdLineInfo class declaration.\r
- *\r
- */\r
-\r
-// RCS ID line follows -- this is updated by CVS\r
-// $Id: MergeCmdLineInfo.h $\r
-\r
-class CmdLineParser;\r
-\r
-/** \r
- * @brief WinMerge's command line handler.\r
- *\r
- */\r
-class MergeCmdLineInfo : public CCommandLineInfo\r
-{\r
-public:\r
-\r
-       /** @brief ClearCaseCmdLineParser's constructor.\r
-        *\r
-        * @param [in] szFileName Executable file name. Required in order to\r
-        *      know which command line parser to create and use.\r
-        *\r
-        */\r
-       MergeCmdLineInfo(const TCHAR *szExeName);\r
-\r
-       ~MergeCmdLineInfo();\r
-\r
-       /** @brief Override CCommandLineInfo's method. */\r
-       virtual void ParseParam(const TCHAR* pszParam, BOOL bFlag, BOOL bLast);\r
-\r
-public:\r
-\r
-       int m_nCmdShow; /**< Initial state of the application's window. */\r
-\r
-       bool m_bClearCaseTool; /**< Running as Rational ClearCase external tool. */\r
-       bool m_bEscShutdown; /**< Pressing ESC will close the application */\r
-       bool m_bExitIfNoDiff; /**< Exit after telling the user that files are identical. */\r
-       bool m_bRecurse; /**< Include sub folder in directories compare. */\r
-       bool m_bNonInteractive; /**< Suppress user's notifications. */\r
-       bool m_bNoPrefs; /**< Do not load or remember preferences. */\r
-       bool m_bSingleInstance; /**< Allow only one instance of WinMerge executable. */\r
-       bool m_bShowUsage; /**< Show a brief reminder to command line arguments. */\r
-\r
-       DWORD m_dwLeftFlags; /**< Left side file's behavior options. */\r
-       DWORD m_dwRightFlags; /**< Right side file's behavior options. */\r
-\r
-       CString m_sLeftDesc; /**< Left side file's description. */\r
-       CString m_sRightDesc; /**< Right side file's description. */\r
-\r
-       CString m_sFileFilter; /**< File filter mask. */\r
-       CString m_sPreDiffer;\r
-\r
-       /**< Command line arguments which are mapped to WinMerge's preferences. */\r
-       CMapStringToString m_Settings;\r
-\r
-       CStringArray m_Files; /**< Files (or directories) to compare. */\r
-\r
-       int m_nFiles; /**< Number of files (or directories) in m_Files. */\r
-\r
-private:\r
-\r
-       /**< operator= is not implemented. */\r
-       MergeCmdLineInfo& operator=(const MergeCmdLineInfo& rhs);\r
-\r
-       CmdLineParser *m_pCmdLineParser; /**< The command line parser instance. */\r
-};\r
-\r
-#endif // _MERGE_CMD_LINE_INFO_INCLUDED_\r
+/////////////////////////////////////////////////////////////////////////////
+//
+//    WinMerge: An interactive diff/merge utility
+//    Copyright (C) 1997 Dean P. Grimm
+//
+//    This program is free software; you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation; either version 2 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program; if not, write to the Free Software
+//    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _MERGE_CMD_LINE_INFO_INCLUDED_
+#define _MERGE_CMD_LINE_INFO_INCLUDED_
+
+/** 
+ * @file  MergeCmdLineInfo.h
+ *
+ * @brief MergeCmdLineInfo class declaration.
+ *
+ */
+
+// RCS ID line follows -- this is updated by CVS
+// $Id$
+
+class CmdLineParser;
+
+/** 
+ * @brief WinMerge's command line handler.
+ *
+ */
+class MergeCmdLineInfo : public CCommandLineInfo
+{
+public:
+
+       /** @brief ClearCaseCmdLineParser's constructor.
+        *
+        * @param [in] szFileName Executable file name. Required in order to
+        *      know which command line parser to create and use.
+        *
+        */
+       MergeCmdLineInfo(const TCHAR *szExeName);
+
+       ~MergeCmdLineInfo();
+
+       /** @brief Override CCommandLineInfo's method. */
+       virtual void ParseParam(const TCHAR* pszParam, BOOL bFlag, BOOL bLast);
+
+public:
+
+       int m_nCmdShow; /**< Initial state of the application's window. */
+
+       bool m_bClearCaseTool; /**< Running as Rational ClearCase external tool. */
+       bool m_bEscShutdown; /**< Pressing ESC will close the application */
+       bool m_bExitIfNoDiff; /**< Exit after telling the user that files are identical. */
+       bool m_bRecurse; /**< Include sub folder in directories compare. */
+       bool m_bNonInteractive; /**< Suppress user's notifications. */
+       bool m_bNoPrefs; /**< Do not load or remember preferences. */
+       bool m_bSingleInstance; /**< Allow only one instance of WinMerge executable. */
+       bool m_bShowUsage; /**< Show a brief reminder to command line arguments. */
+
+       DWORD m_dwLeftFlags; /**< Left side file's behavior options. */
+       DWORD m_dwRightFlags; /**< Right side file's behavior options. */
+
+       CString m_sLeftDesc; /**< Left side file's description. */
+       CString m_sRightDesc; /**< Right side file's description. */
+
+       CString m_sFileFilter; /**< File filter mask. */
+       CString m_sPreDiffer;
+
+       /**< Command line arguments which are mapped to WinMerge's preferences. */
+       CMapStringToString m_Settings;
+
+       CStringArray m_Files; /**< Files (or directories) to compare. */
+
+       int m_nFiles; /**< Number of files (or directories) in m_Files. */
+
+private:
+
+       /**< operator= is not implemented. */
+       MergeCmdLineInfo& operator=(const MergeCmdLineInfo& rhs);
+
+       CmdLineParser *m_pCmdLineParser; /**< The command line parser instance. */
+};
+
+#endif // _MERGE_CMD_LINE_INFO_INCLUDED_
index 4ae8177..1764a41 100644 (file)
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-//    WinMerge: An interactive diff/merge utility\r
-//    Copyright (C) 1997 Dean P. Grimm\r
-//\r
-//    This program is free software; you can redistribute it and/or modify\r
-//    it under the terms of the GNU General Public License as published by\r
-//    the Free Software Foundation; either version 2 of the License, or\r
-//    (at your option) any later version.\r
-//\r
-//    This program is distributed in the hope that it will be useful,\r
-//    but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-//    GNU General Public License for more details.\r
-//\r
-//    You should have received a copy of the GNU General Public License\r
-//    along with this program; if not, write to the Free Software\r
-//    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
-//\r
-/////////////////////////////////////////////////////////////////////////////\r
-\r
-/** \r
-* @file  WinMergeCmdLineParser.h\r
-*\r
-* @brief WinMergeCmdLineParser class implementation.\r
-*\r
-*/\r
-\r
-// RCS ID line follows -- this is updated by CVS\r
-// $Id: WinMergeCmdLineParser.cpp $\r
-\r
-#include "StdAfx.h"\r
-\r
-#include "MainFrm.h"\r
-#include "MergeCmdLineInfo.h"\r
-#include "WinMergeCmdLineParser.h"\r
-#include "Paths.h"\r
-\r
-WinMergeCmdLineParser::WinMergeCmdLineParser(MergeCmdLineInfo& CmdLineInfo) :\r
-       CmdLineParser(CmdLineInfo),\r
-       m_bPreDiff(false),\r
-       m_bFileFilter(false),\r
-       m_bLeftDesc(false),\r
-       m_bRightDesc(false)\r
-{\r
-\r
-}\r
-\r
-void WinMergeCmdLineParser::ParseParam(const TCHAR* pszParam, BOOL bFlag, BOOL bLast)\r
-{\r
-       if (TRUE == bFlag)\r
-       {\r
-               if (!lstrcmp(pszParam, _T("?")))\r
-               {\r
-                       // -? to show common command line arguments.\r
-                       m_CmdLineInfo.m_bShowUsage = true;\r
-               }\r
-               else if (!lstrcmpi(pszParam, _T("dl")))\r
-               {\r
-                       // -dl "desc" - description for left file\r
-                       m_bLeftDesc = true;\r
-               }\r
-               else if (!lstrcmpi(pszParam, _T("dr")))\r
-               {\r
-                       // -dr "desc" - description for right file\r
-                       m_bRightDesc = true;\r
-               }\r
-               else if (!lstrcmpi(pszParam, _T("e")))\r
-               {\r
-                       // -e to allow closing with single esc press\r
-                       m_CmdLineInfo.m_bEscShutdown = true;\r
-               }\r
-               else if (!lstrcmpi(pszParam, _T("f")))\r
-               {\r
-                       // -f "mask" - file filter mask ("*.h *.cpp")\r
-                       m_bFileFilter = true;\r
-               }\r
-               else if (!lstrcmpi(pszParam, _T("r")))\r
-               {\r
-                       // -r to compare recursively\r
-                       m_CmdLineInfo.m_bRecurse = true;\r
-               }\r
-               else if (!lstrcmpi(pszParam, _T("s")))\r
-               {\r
-                       // -s to allow only one instance\r
-                       m_CmdLineInfo.m_bSingleInstance = true;\r
-               }\r
-               else if (!lstrcmpi(pszParam, _T("noninteractive")))\r
-               {\r
-                       // -noninteractive to suppress message boxes & close with result code\r
-                       m_CmdLineInfo.m_bNonInteractive = true;\r
-               }\r
-               else if (!lstrcmpi(pszParam, _T("noprefs")))\r
-               {\r
-                       // -noprefs means do not load or remember options (preferences)\r
-                       m_CmdLineInfo.m_bNoPrefs = true;\r
-               }\r
-               else if (!lstrcmpi(pszParam, _T("minimize")))\r
-               {\r
-                       // -minimize means minimize the main window.\r
-                       m_CmdLineInfo.m_nCmdShow = SW_MINIMIZE;\r
-               }\r
-               else if (!lstrcmpi(pszParam, _T("maximize")))\r
-               {\r
-                       // -maximize means maximize the main window.\r
-                       m_CmdLineInfo.m_nCmdShow = SW_MAXIMIZE;\r
-               }\r
-               else if (!lstrcmpi(pszParam, _T("prediffer")))\r
-               {\r
-                       // Get prediffer if specified (otherwise prediffer will be blank, which is default)\r
-                       m_bPreDiff = true;\r
-               }\r
-               else if (!lstrcmpi(pszParam, _T("wl")))\r
-               {\r
-                       // -wl to open left path as read-only\r
-                       m_CmdLineInfo.m_dwLeftFlags |= FFILEOPEN_READONLY;\r
-               }\r
-               else if (!lstrcmpi(pszParam, _T("wr")))\r
-               {\r
-                       // -wr to open right path as read-only\r
-                       m_CmdLineInfo.m_dwRightFlags |= FFILEOPEN_READONLY;\r
-               }\r
-               else if (!lstrcmpi(pszParam, _T("ul")))\r
-               {\r
-                       // -ul to not add left path to MRU\r
-                       m_CmdLineInfo.m_dwLeftFlags |= FFILEOPEN_NOMRU;\r
-               }\r
-               else if (!lstrcmpi(pszParam, _T("ur")))\r
-               {\r
-                       // -ur to not add right path to MRU\r
-                       m_CmdLineInfo.m_dwRightFlags |= FFILEOPEN_NOMRU;\r
-               }\r
-               else if (!lstrcmpi(pszParam, _T("ub")))\r
-               {\r
-                       // -ub to add neither right nor left path to MRU\r
-                       m_CmdLineInfo.m_dwLeftFlags |= FFILEOPEN_NOMRU;\r
-                       m_CmdLineInfo.m_dwRightFlags |= FFILEOPEN_NOMRU;\r
-               }\r
-               else if (!lstrcmpi(pszParam, _T("x")))\r
-               {\r
-                       // -x to close application if files are identical.\r
-                       m_CmdLineInfo.m_bExitIfNoDiff = true;\r
-               }\r
-               else\r
-               {\r
-                       CString sParam = pszParam;\r
-                       CString sValue;\r
-\r
-                       int nPos = sParam.ReverseFind(_T(':'));\r
-                       if (nPos >= 0)\r
-                       {\r
-                               sParam = sParam.Left(nPos);\r
-                               sValue = sParam.Mid(nPos + 1);\r
-                       }\r
-                       else\r
-                       {\r
-                               // Treat "/ignorews" as "/ignorews:1".\r
-                               sValue = _T("1");\r
-                       }\r
-\r
-                       m_CmdLineInfo.m_Settings[sParam] = sValue;\r
-               }\r
-       }\r
-       else\r
-       {\r
-               if ((m_bPreDiff == true) && m_CmdLineInfo.m_sPreDiffer.IsEmpty())\r
-               {\r
-                       m_CmdLineInfo.m_sPreDiffer = pszParam;\r
-               }\r
-               else if ((m_bFileFilter == true) && m_CmdLineInfo.m_sFileFilter.IsEmpty())\r
-               {\r
-                       m_CmdLineInfo.m_sFileFilter = pszParam;\r
-               }\r
-               else if ((m_bRightDesc == true) && m_CmdLineInfo.m_sRightDesc.IsEmpty())\r
-               {\r
-                       m_CmdLineInfo.m_sRightDesc = pszParam;\r
-               }\r
-               else if ((m_bLeftDesc == true) && m_CmdLineInfo.m_sLeftDesc.IsEmpty())\r
-               {\r
-                       m_CmdLineInfo.m_sLeftDesc = pszParam;\r
-               }\r
-               else\r
-               {\r
-                       CString sFile = paths_GetLongPath(pszParam);\r
-                       m_CmdLineInfo.m_Files.SetAtGrow(m_CmdLineInfo.m_nFiles, sFile);\r
-                       m_CmdLineInfo.m_nFiles += 1;\r
-               }\r
-       }\r
-\r
-       if (TRUE == bLast)\r
-       {\r
-               // If "compare file dir" make it "compare file dir\file".\r
-               if (m_CmdLineInfo.m_nFiles >= 2)\r
-               {\r
-                       PATH_EXISTENCE p1 = paths_DoesPathExist(m_CmdLineInfo.m_Files[0]);\r
-                       PATH_EXISTENCE p2 = paths_DoesPathExist(m_CmdLineInfo.m_Files[1]);\r
-\r
-                       if ((p1 == IS_EXISTING_FILE) && (p2 == IS_EXISTING_DIR))\r
-                       {\r
-                               TCHAR fname[_MAX_PATH];\r
-                               TCHAR fext[_MAX_PATH];\r
-\r
-                               _tsplitpath(m_CmdLineInfo.m_Files[0], NULL, NULL, fname, fext);\r
-\r
-                               if (m_CmdLineInfo.m_Files[1].Right(1) != _T('\\'))\r
-                               {\r
-                                       m_CmdLineInfo.m_Files[1] += _T('\\');\r
-                               }\r
-\r
-                               m_CmdLineInfo.m_Files[1] = m_CmdLineInfo.m_Files[1] + fname + fext;\r
-                       }\r
-               }\r
-\r
-               if (m_CmdLineInfo.m_bShowUsage)\r
-               {\r
-                       m_CmdLineInfo.m_bNonInteractive = false;\r
-               }\r
-       }\r
-}\r
+/////////////////////////////////////////////////////////////////////////////
+//
+//    WinMerge: An interactive diff/merge utility
+//    Copyright (C) 1997 Dean P. Grimm
+//
+//    This program is free software; you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation; either version 2 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program; if not, write to the Free Software
+//    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/** 
+* @file  WinMergeCmdLineParser.h
+*
+* @brief WinMergeCmdLineParser class implementation.
+*
+*/
+
+// RCS ID line follows -- this is updated by CVS
+// $Id$
+
+#include "StdAfx.h"
+
+#include "MainFrm.h"
+#include "MergeCmdLineInfo.h"
+#include "WinMergeCmdLineParser.h"
+#include "Paths.h"
+
+WinMergeCmdLineParser::WinMergeCmdLineParser(MergeCmdLineInfo& CmdLineInfo) :
+       CmdLineParser(CmdLineInfo),
+       m_bPreDiff(false),
+       m_bFileFilter(false),
+       m_bLeftDesc(false),
+       m_bRightDesc(false)
+{
+
+}
+
+void WinMergeCmdLineParser::ParseParam(const TCHAR* pszParam, BOOL bFlag, BOOL bLast)
+{
+       if (TRUE == bFlag)
+       {
+               if (!lstrcmp(pszParam, _T("?")))
+               {
+                       // -? to show common command line arguments.
+                       m_CmdLineInfo.m_bShowUsage = true;
+               }
+               else if (!lstrcmpi(pszParam, _T("dl")))
+               {
+                       // -dl "desc" - description for left file
+                       m_bLeftDesc = true;
+               }
+               else if (!lstrcmpi(pszParam, _T("dr")))
+               {
+                       // -dr "desc" - description for right file
+                       m_bRightDesc = true;
+               }
+               else if (!lstrcmpi(pszParam, _T("e")))
+               {
+                       // -e to allow closing with single esc press
+                       m_CmdLineInfo.m_bEscShutdown = true;
+               }
+               else if (!lstrcmpi(pszParam, _T("f")))
+               {
+                       // -f "mask" - file filter mask ("*.h *.cpp")
+                       m_bFileFilter = true;
+               }
+               else if (!lstrcmpi(pszParam, _T("r")))
+               {
+                       // -r to compare recursively
+                       m_CmdLineInfo.m_bRecurse = true;
+               }
+               else if (!lstrcmpi(pszParam, _T("s")))
+               {
+                       // -s to allow only one instance
+                       m_CmdLineInfo.m_bSingleInstance = true;
+               }
+               else if (!lstrcmpi(pszParam, _T("noninteractive")))
+               {
+                       // -noninteractive to suppress message boxes & close with result code
+                       m_CmdLineInfo.m_bNonInteractive = true;
+               }
+               else if (!lstrcmpi(pszParam, _T("noprefs")))
+               {
+                       // -noprefs means do not load or remember options (preferences)
+                       m_CmdLineInfo.m_bNoPrefs = true;
+               }
+               else if (!lstrcmpi(pszParam, _T("minimize")))
+               {
+                       // -minimize means minimize the main window.
+                       m_CmdLineInfo.m_nCmdShow = SW_MINIMIZE;
+               }
+               else if (!lstrcmpi(pszParam, _T("maximize")))
+               {
+                       // -maximize means maximize the main window.
+                       m_CmdLineInfo.m_nCmdShow = SW_MAXIMIZE;
+               }
+               else if (!lstrcmpi(pszParam, _T("prediffer")))
+               {
+                       // Get prediffer if specified (otherwise prediffer will be blank, which is default)
+                       m_bPreDiff = true;
+               }
+               else if (!lstrcmpi(pszParam, _T("wl")))
+               {
+                       // -wl to open left path as read-only
+                       m_CmdLineInfo.m_dwLeftFlags |= FFILEOPEN_READONLY;
+               }
+               else if (!lstrcmpi(pszParam, _T("wr")))
+               {
+                       // -wr to open right path as read-only
+                       m_CmdLineInfo.m_dwRightFlags |= FFILEOPEN_READONLY;
+               }
+               else if (!lstrcmpi(pszParam, _T("ul")))
+               {
+                       // -ul to not add left path to MRU
+                       m_CmdLineInfo.m_dwLeftFlags |= FFILEOPEN_NOMRU;
+               }
+               else if (!lstrcmpi(pszParam, _T("ur")))
+               {
+                       // -ur to not add right path to MRU
+                       m_CmdLineInfo.m_dwRightFlags |= FFILEOPEN_NOMRU;
+               }
+               else if (!lstrcmpi(pszParam, _T("ub")))
+               {
+                       // -ub to add neither right nor left path to MRU
+                       m_CmdLineInfo.m_dwLeftFlags |= FFILEOPEN_NOMRU;
+                       m_CmdLineInfo.m_dwRightFlags |= FFILEOPEN_NOMRU;
+               }
+               else if (!lstrcmpi(pszParam, _T("x")))
+               {
+                       // -x to close application if files are identical.
+                       m_CmdLineInfo.m_bExitIfNoDiff = true;
+               }
+               else
+               {
+                       CString sParam = pszParam;
+                       CString sValue;
+
+                       int nPos = sParam.ReverseFind(_T(':'));
+                       if (nPos >= 0)
+                       {
+                               sParam = sParam.Left(nPos);
+                               sValue = sParam.Mid(nPos + 1);
+                       }
+                       else
+                       {
+                               // Treat "/ignorews" as "/ignorews:1".
+                               sValue = _T("1");
+                       }
+
+                       m_CmdLineInfo.m_Settings[sParam] = sValue;
+               }
+       }
+       else
+       {
+               if ((m_bPreDiff == true) && m_CmdLineInfo.m_sPreDiffer.IsEmpty())
+               {
+                       m_CmdLineInfo.m_sPreDiffer = pszParam;
+               }
+               else if ((m_bFileFilter == true) && m_CmdLineInfo.m_sFileFilter.IsEmpty())
+               {
+                       m_CmdLineInfo.m_sFileFilter = pszParam;
+               }
+               else if ((m_bRightDesc == true) && m_CmdLineInfo.m_sRightDesc.IsEmpty())
+               {
+                       m_CmdLineInfo.m_sRightDesc = pszParam;
+               }
+               else if ((m_bLeftDesc == true) && m_CmdLineInfo.m_sLeftDesc.IsEmpty())
+               {
+                       m_CmdLineInfo.m_sLeftDesc = pszParam;
+               }
+               else
+               {
+                       CString sFile = paths_GetLongPath(pszParam);
+                       m_CmdLineInfo.m_Files.SetAtGrow(m_CmdLineInfo.m_nFiles, sFile);
+                       m_CmdLineInfo.m_nFiles += 1;
+               }
+       }
+
+       if (TRUE == bLast)
+       {
+               // If "compare file dir" make it "compare file dir\file".
+               if (m_CmdLineInfo.m_nFiles >= 2)
+               {
+                       PATH_EXISTENCE p1 = paths_DoesPathExist(m_CmdLineInfo.m_Files[0]);
+                       PATH_EXISTENCE p2 = paths_DoesPathExist(m_CmdLineInfo.m_Files[1]);
+
+                       if ((p1 == IS_EXISTING_FILE) && (p2 == IS_EXISTING_DIR))
+                       {
+                               TCHAR fname[_MAX_PATH];
+                               TCHAR fext[_MAX_PATH];
+
+                               _tsplitpath(m_CmdLineInfo.m_Files[0], NULL, NULL, fname, fext);
+
+                               if (m_CmdLineInfo.m_Files[1].Right(1) != _T('\\'))
+                               {
+                                       m_CmdLineInfo.m_Files[1] += _T('\\');
+                               }
+
+                               m_CmdLineInfo.m_Files[1] = m_CmdLineInfo.m_Files[1] + fname + fext;
+                       }
+               }
+
+               if (m_CmdLineInfo.m_bShowUsage)
+               {
+                       m_CmdLineInfo.m_bNonInteractive = false;
+               }
+       }
+}
index a5abd15..16dd665 100644 (file)
@@ -1,56 +1,56 @@
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-//    WinMerge: An interactive diff/merge utility\r
-//    Copyright (C) 1997 Dean P. Grimm\r
-//\r
-//    This program is free software; you can redistribute it and/or modify\r
-//    it under the terms of the GNU General Public License as published by\r
-//    the Free Software Foundation; either version 2 of the License, or\r
-//    (at your option) any later version.\r
-//\r
-//    This program is distributed in the hope that it will be useful,\r
-//    but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-//    GNU General Public License for more details.\r
-//\r
-//    You should have received a copy of the GNU General Public License\r
-//    along with this program; if not, write to the Free Software\r
-//    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
-//\r
-/////////////////////////////////////////////////////////////////////////////\r
-\r
-/** \r
-* @file  WinMergeCmdLineParser.h\r
-*\r
-* @brief WinMergeCmdLineParser class decleration.\r
-*\r
-*/\r
-\r
-// RCS ID line follows -- this is updated by CVS\r
-// $Id: WinMergeCmdLineParser.h $\r
-\r
-#pragma once\r
-\r
-#include "CmdLineParser.h"\r
-\r
-/**\r
-* @brief WinMerge's default command line parser.\r
-*\r
-*/\r
-class WinMergeCmdLineParser : public CmdLineParser\r
-{\r
-       public:\r
-\r
-               WinMergeCmdLineParser(MergeCmdLineInfo& CmdLineInfo);\r
-\r
-               virtual ~WinMergeCmdLineParser() { }\r
-\r
-               virtual void ParseParam(const TCHAR* pszParam, BOOL bFlag, BOOL bLast);\r
-\r
-       private:\r
-\r
-               bool m_bPreDiff;\r
-               bool m_bFileFilter;\r
-               bool m_bLeftDesc;\r
-               bool m_bRightDesc;\r
-};\r
+/////////////////////////////////////////////////////////////////////////////
+//
+//    WinMerge: An interactive diff/merge utility
+//    Copyright (C) 1997 Dean P. Grimm
+//
+//    This program is free software; you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation; either version 2 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program; if not, write to the Free Software
+//    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/** 
+* @file  WinMergeCmdLineParser.h
+*
+* @brief WinMergeCmdLineParser class decleration.
+*
+*/
+
+// RCS ID line follows -- this is updated by CVS
+// $Id$
+
+#pragma once
+
+#include "CmdLineParser.h"
+
+/**
+* @brief WinMerge's default command line parser.
+*
+*/
+class WinMergeCmdLineParser : public CmdLineParser
+{
+       public:
+
+               WinMergeCmdLineParser(MergeCmdLineInfo& CmdLineInfo);
+
+               virtual ~WinMergeCmdLineParser() { }
+
+               virtual void ParseParam(const TCHAR* pszParam, BOOL bFlag, BOOL bLast);
+
+       private:
+
+               bool m_bPreDiff;
+               bool m_bFileFilter;
+               bool m_bLeftDesc;
+               bool m_bRightDesc;
+};