@@ -19,7 +19,7 @@ void find_files(const std::string &file_pattern, std::vector<std::string> &files
1919 exit (EXIT_FAILURE);
2020 return ;
2121 }
22- files.insert (files.begin (), glob_result.gl_pathv , glob_result.gl_pathv + glob_result.gl_pathc );
22+ files.insert (files.end (), glob_result.gl_pathv , glob_result.gl_pathv + glob_result.gl_pathc );
2323 globfree (&glob_result);
2424}
2525
@@ -53,8 +53,8 @@ Countable get_countable(const std::string &arg) {
5353
5454void parse_args_counter (int argc, char *argv[], Language &lang, Countable &countable, std::string &feature,
5555 std::vector<std::string> &files) {
56- std::string usage_format = " Usage: submitty_count_ts -l <language> <countable> <feature> <files>" ;
57- if (argc != 6 ) {
56+ std::string usage_format = " Usage: submitty_count_ts -l <language> <countable> <feature> <files>... " ;
57+ if (argc < 6 ) {
5858 std::cerr << " Error: require more arguments" << std::endl;
5959 std::cerr << usage_format << std::endl;
6060 exit (EXIT_FAILURE);
@@ -71,7 +71,7 @@ void parse_args_counter(int argc, char *argv[], Language &lang, Countable &count
7171 } else if (i == 4 ) {
7272 feature = argv[i];
7373 continue ;
74- } else if (i = = 5 ) {
74+ } else if (i > = 5 ) {
7575 find_files (argv[i], files);
7676 continue ;
7777 }
@@ -82,8 +82,8 @@ void parse_args_counter(int argc, char *argv[], Language &lang, Countable &count
8282}
8383
8484void parse_args_diagnoser (int argc, char *argv[], Language &lang, std::vector<std::string> &files) {
85- std::string usage_format = " Usage: submitty_diagnostics_ts -l <language> <files>" ;
86- if (argc != 4 ) {
85+ std::string usage_format = " Usage: submitty_diagnostics_ts -l <language> <files>... " ;
86+ if (argc < 4 ) {
8787 std::cerr << " Error: require more arguments" << std::endl;
8888 std::cerr << usage_format << std::endl;
8989 exit (EXIT_FAILURE);
@@ -94,7 +94,7 @@ void parse_args_diagnoser(int argc, char *argv[], Language &lang, std::vector<st
9494 } else if (i == 2 ) {
9595 lang = get_language (argv[i]);
9696 continue ;
97- } else if (i = = 3 ) {
97+ } else if (i > = 3 ) {
9898 find_files (argv[i], files);
9999 continue ;
100100 }
0 commit comments