@@ -19,7 +19,7 @@ void find_files(const std::string &file_pattern, std::vector<std::string> &files
19
19
exit (EXIT_FAILURE);
20
20
return ;
21
21
}
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 );
23
23
globfree (&glob_result);
24
24
}
25
25
@@ -53,8 +53,8 @@ Countable get_countable(const std::string &arg) {
53
53
54
54
void parse_args_counter (int argc, char *argv[], Language &lang, Countable &countable, std::string &feature,
55
55
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 ) {
58
58
std::cerr << " Error: require more arguments" << std::endl;
59
59
std::cerr << usage_format << std::endl;
60
60
exit (EXIT_FAILURE);
@@ -71,7 +71,7 @@ void parse_args_counter(int argc, char *argv[], Language &lang, Countable &count
71
71
} else if (i == 4 ) {
72
72
feature = argv[i];
73
73
continue ;
74
- } else if (i = = 5 ) {
74
+ } else if (i > = 5 ) {
75
75
find_files (argv[i], files);
76
76
continue ;
77
77
}
@@ -82,8 +82,8 @@ void parse_args_counter(int argc, char *argv[], Language &lang, Countable &count
82
82
}
83
83
84
84
void 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 ) {
87
87
std::cerr << " Error: require more arguments" << std::endl;
88
88
std::cerr << usage_format << std::endl;
89
89
exit (EXIT_FAILURE);
@@ -94,7 +94,7 @@ void parse_args_diagnoser(int argc, char *argv[], Language &lang, std::vector<st
94
94
} else if (i == 2 ) {
95
95
lang = get_language (argv[i]);
96
96
continue ;
97
- } else if (i = = 3 ) {
97
+ } else if (i > = 3 ) {
98
98
find_files (argv[i], files);
99
99
continue ;
100
100
}
0 commit comments