- and --help works now correctly too default tip

Thu, 24 Jul 2014 17:01:23 +0300

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Thu, 24 Jul 2014 17:01:23 +0300
changeset 142
1f5518dd8146
parent 141
68d60e2cfa76

- and --help works now correctly too

src/commandline.cpp file | annotate | diff | comparison | revisions
src/list.h file | annotate | diff | comparison | revisions
src/main.cpp file | annotate | diff | comparison | revisions
--- a/src/commandline.cpp	Thu Jul 24 16:54:45 2014 +0300
+++ b/src/commandline.cpp	Thu Jul 24 17:01:23 2014 +0300
@@ -41,9 +41,8 @@
 StringList CommandLine::process (int const argc, char* argv[])
 {
 	StringList args;
-	int const trueargc = argc;
 
-	for (int argn = 1; argn < trueargc; ++argn)
+	for (int argn = 1; argn < argc; ++argn)
 	{
 		String const arg (argv[argn]);
 
--- a/src/list.h	Thu Jul 24 16:54:45 2014 +0300
+++ b/src/list.h	Thu Jul 24 17:01:23 2014 +0300
@@ -184,8 +184,9 @@
 template<typename T>
 void List<T>::merge (const List<T>& other)
 {
+	int oldsize = size();
 	resize (size() + other.size());
-	std::copy (other.begin(), other.end(), begin() + other.size());
+	std::copy (other.begin(), other.end(), begin() + oldsize);
 }
 
 template<typename T>
--- a/src/main.cpp	Thu Jul 24 16:54:45 2014 +0300
+++ b/src/main.cpp	Thu Jul 24 17:01:23 2014 +0300
@@ -50,12 +50,10 @@
 		Verbosity verboselevel (Verbosity::None);
 		bool listcommands (false);
 		bool sendhelp (false);
-		bool test (true);
 
 		CommandLine cmdline;
 		cmdline.addOption (listcommands, 'l', "listfunctions", "List available functions");
 		cmdline.addOption (sendhelp, 'h', "help", "Print help text");
-		cmdline.addOption (test, 'x', "test", "testy test");
 		cmdline.addEnumeratedOption (verboselevel, 'V', "verbose", "Output more information");
 		StringList args = cmdline.process (argc, argv);
 
@@ -68,7 +66,7 @@
 #endif
 			printTo (stderr, "%1\n", header);
 			printTo (stderr, "usage: %1 [OPTIONS] SOURCE [OUTPUT]\n\n", argv[0]);
-			printTo (stderr, "Options:\n" + cmdline.describeOptions());
+			printTo (stderr, "Options:\n" + cmdline.describeOptions() + "\n");
 			return EXIT_SUCCESS;
 		}
 

mercurial