comparison kdiff3/src/main.cpp @ 8:86d21651c8db

KDiff3 version 0.9.70
author joachim99
date Mon, 06 Oct 2003 18:50:45 +0000
parents
children 14900b5bf88c
comparison
equal deleted inserted replaced
7:ff98a43bbfea 8:86d21651c8db
1 /***************************************************************************
2 main.cpp - Where everything starts.
3 -------------------
4 begin : Don Jul 11 12:31:29 CEST 2002
5 copyright : (C) 2002 by Joachim Eibl
6 email : joachim.eibl@gmx.de
7 ***************************************************************************/
8
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18 /***************************************************************************
19 * $Log$
20 * Revision 1.1 2003/10/06 18:38:48 joachim99
21 * KDiff3 version 0.9.70
22 * *
23 ***************************************************************************/
24
25 #include <kcmdlineargs.h>
26 #include <kaboutdata.h>
27 #include <klocale.h>
28
29 #include "kdiff3_shell.h"
30
31
32 static const char *description =
33 I18N_NOOP("Text Diff and Merge Tool");
34
35 static KCmdLineOptions options[] =
36 {
37 { "m", 0, 0 },
38 { "merge", I18N_NOOP("Merge the input."), 0 },
39 { "b", 0, 0 },
40 { "base file", I18N_NOOP("Explicit base file. For compatibility with certain tools."), 0 },
41 { "o", 0, 0 },
42 { "output file", I18N_NOOP("Output file. Implies -m. E.g.: -o newfile.txt"), 0 },
43 { "out file", I18N_NOOP("Output file, again. (For compatibility with certain tools.)"), 0 },
44 { "auto", I18N_NOOP("No GUI if all conflicts are auto-solvable. (Needs -o file)"), 0 },
45 { "qall", I18N_NOOP("Don't solve conflicts automatically. (For compatibility...)"), 0 },
46 { "fname alias", I18N_NOOP("Visible name replacement. Supply this once for every input."), 0 },
47 #ifdef _WIN32
48 { "query", I18N_NOOP("For compatibility with certain tools."), 0 },
49 #endif
50 { "+[File1]", I18N_NOOP("file1 to open (base, if not specified via --base)"), 0 },
51 { "+[File2]", I18N_NOOP("file2 to open"), 0 },
52 { "+[File3]", I18N_NOOP("file3 to open"), 0 },
53 { 0, 0, 0 }
54 };
55
56 #undef VERSION
57 #define VERSION "0.9.70"
58
59 #ifdef _WIN32
60 #include <process.h>
61 // This command checks the comm
62 static bool isOptionUsed(const QString& s, int argc, char* argv[])
63 {
64 for(int j=0; j<argc; ++j )
65 {
66 if( "-"+s == argv[j] || "--"+s==argv[j] )
67 {
68 return true;
69 }
70 }
71 return false;
72 }
73 #endif
74
75 int main(int argc, char *argv[])
76 {
77 #ifdef _WIN32
78 /* KDiff3 can be used as replacement for the text-diff and merge tool provided by
79 Clearcase. This is experimental and so far has only been tested under Windows.
80
81 The installation is very simple:
82 1. In the Clearcase "bin"-directory rename "cleardiffmrg.exe" to "cleardiffmrg_orig.exe".
83 2. Copy kdiff3.exe into that "bin"-directory and rename it to "cleardiffmrg.exe".
84 (Also copy the other files that are needed by KDiff3 there.)
85
86 Now when a file comparison or merge is done by Clearcase then of course KDiff3 will be
87 run instead.
88 If the commandline contains the option "-directory" then KDiff3 can't do it but will
89 run "cleardiffmrg_orig.exe" instead.
90 */
91
92 /* // Write all args into a temporary file. Uncomment this for debugging purposes.
93 FILE* f = fopen("c:\\t.txt","w");
94 for(int i=0; i< argc; ++i)
95 fprintf(f,"Arg %d: %s\n", i, argv[i]);
96 fclose(f);
97 */
98
99 // KDiff3 can replace cleardiffmrg from clearcase. But not all functions.
100 if ( isOptionUsed( "directory", argc,argv ) )
101 {
102 return ::_spawnvp(_P_WAIT , "cleardiffmrg_orig", argv );
103 }
104 #endif
105 QApplication::setColorSpec( QApplication::ManyColor ); // Grab all 216 colors
106
107 KAboutData aboutData( "kdiff3", I18N_NOOP("KDiff3"),
108 VERSION, description, KAboutData::License_GPL,
109 "(c) 2002-2003 Joachim Eibl", 0, "http://kdiff3.sourceforge.net/", "joachim.eibl@gmx.de");
110 aboutData.addAuthor("Joachim Eibl",0, "joachim.eibl@gmx.de");
111 KCmdLineArgs::init( argc, argv, &aboutData );
112 KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
113
114 KApplication app;
115
116 if (app.isRestored())
117 {
118 RESTORE(KDiff3Shell);
119 }
120 else
121 {
122 new KDiff3Shell();
123 }
124
125 return app.exec();
126 }