--- /dev/null
+noinst_PROGRAMS = propmerge
+
+propmerge_SOURCES = propmerge.cxx
+propmerge_LDADD = -lsgprops -lsgxml -lsgio -lsgmisc -lsgdebug -lsgstructure
--- /dev/null
+#include <iostream>
+#include <string>
+
+#include <simgear/props/props.hxx>
+#include <simgear/props/props_io.hxx>
+#include <simgear/structure/exception.hxx>
+
+using namespace std;
+
+
+void usage()
+{
+ cerr << "Usage: propmerge [-o <outfile>] <infiles>" << endl;
+}
+
+
+int main(int argc, char *argv[])
+{
+ if (argc < 2) {
+ usage();
+ return -1;
+ }
+
+ int numfiles = 0;
+ string out;
+ SGPropertyNode root;
+
+ for (int i = 1; i < argc; i++) {
+ string s = argv[i];
+ if (s == "-h" || s == "--help") {
+ usage();
+ return 0;
+ }
+
+ if (s == "-o" || s == "--output") {
+ if (i + 1 == argc)
+ break;
+ out = argv[++i];
+ continue;
+ }
+
+ try {
+ readProperties(s, &root);
+ numfiles++;
+ } catch (const sg_exception &e) {
+ cerr << "Error: " << e.getFormattedMessage() << endl;
+ return -2;
+ }
+ }
+
+ if (!numfiles) {
+ cerr << "Error: Nothing to merge." << endl;
+ return -3;
+ }
+
+ try {
+ if (out.empty())
+ writeProperties(cout, &root, true);
+ else
+ writeProperties(out, &root, true);
+
+ } catch (const sg_exception &e) {
+ cerr << "Error: " << e.getFormattedMessage() << endl;
+ return -4;
+ }
+
+ return 0;
+}
+
+