@@ -102,6 +102,7 @@ int main(int argc, char **argv) {
102102 infile.open (optarg);
103103 if (infile.bad ()) {
104104 cerr << " Error: file not found" << endl;
105+ cerr << " Run countwin -h to see usage." << endl;
105106 exit (EXIT_FAILURE);
106107 }
107108 has_file = true ;
@@ -112,6 +113,7 @@ int main(int argc, char **argv) {
112113 outfile.open (optarg);
113114 if (outfile.bad ()) {
114115 cerr << " Error: could not create outfile" << endl;
116+ cerr << " Run countwin -h to see usage." << endl;
115117 exit (EXIT_FAILURE);
116118 }
117119 has_out = true ;
@@ -150,12 +152,14 @@ int main(int argc, char **argv) {
150152
151153 if (k < 1 ) {
152154 cerr << " Error: k must be greater than 0" << endl;
155+ cerr << " Run countwin -h to see usage." << endl;
153156 exit (EXIT_FAILURE);
154157 }
155158
156159 if (!has_file) {
157160 if (isatty (STDIN_FILENO)) {
158161 cerr << " Error: missing input" << endl;
162+ cerr << " Run countwin -h to see usage." << endl;
159163 exit (EXIT_FAILURE);
160164 }
161165 }
@@ -170,6 +174,7 @@ int main(int argc, char **argv) {
170174 } else {
171175 if (window < k) {
172176 cerr << " Error: window size must be equal to or greater than k" << endl;
177+ cerr << " Run countwin -h to see usage." << endl;
173178 exit (EXIT_FAILURE);
174179 }
175180 }
@@ -178,6 +183,7 @@ int main(int argc, char **argv) {
178183
179184 if (step < 1 || step > window) {
180185 cerr << " Error: step size must be between 1 and window size" << endl;
186+ cerr << " Run countwin -h to see usage." << endl;
181187 exit (EXIT_FAILURE);
182188 }
183189
@@ -204,6 +210,7 @@ int main(int argc, char **argv) {
204210 STOP = START + seq.length () - 1 ;
205211 if (seq.length () < k) {
206212 cerr << " Error: sequence cannot be smaller than k" << endl;
213+ cerr << " Run countwin -h to see usage." << endl;
207214 exit (EXIT_FAILURE);
208215 }
209216 counts = count_klets (vector<char >(seq.begin (), seq.end ()), klets, lets_uniq, k, alphlen);
0 commit comments