1
0
Fork 0

positive error return values, variable name change

This commit is contained in:
mfranz 2008-11-12 14:41:01 +00:00
parent b4d6485cfc
commit 7fb8c28ac6

View file

@ -18,13 +18,13 @@ int main(int argc, char *argv[])
{ {
if (argc < 2) { if (argc < 2) {
usage(); usage();
return -1; return 1;
} }
sglog().setLogLevels(SG_ALL, SG_ALERT); sglog().setLogLevels(SG_ALL, SG_ALERT);
int numfiles = 0; int numfiles = 0;
string out; string outfile;
SGPropertyNode root; SGPropertyNode root;
for (int i = 1; i < argc; i++) { for (int i = 1; i < argc; i++) {
@ -37,7 +37,7 @@ int main(int argc, char *argv[])
if (s == "-o" || s == "--output") { if (s == "-o" || s == "--output") {
if (i + 1 == argc) if (i + 1 == argc)
break; break;
out = argv[++i]; outfile = argv[++i];
continue; continue;
} }
@ -46,24 +46,24 @@ int main(int argc, char *argv[])
numfiles++; numfiles++;
} catch (const sg_exception &e) { } catch (const sg_exception &e) {
cerr << "Error: " << e.getFormattedMessage() << endl; cerr << "Error: " << e.getFormattedMessage() << endl;
return -2; return 2;
} }
} }
if (!numfiles) { if (!numfiles) {
cerr << "Error: Nothing to merge." << endl; cerr << "Error: Nothing to merge." << endl;
return -3; return 3;
} }
try { try {
if (out.empty()) if (outfile.empty())
writeProperties(cout, &root, true); writeProperties(cout, &root, true);
else else
writeProperties(out, &root, true); writeProperties(outfile, &root, true);
} catch (const sg_exception &e) { } catch (const sg_exception &e) {
cerr << "Error: " << e.getFormattedMessage() << endl; cerr << "Error: " << e.getFormattedMessage() << endl;
return -4; return 4;
} }
return 0; return 0;