aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCalvin Morrison <mutantturkey@gmail.com>2013-12-06 17:19:00 -0500
committerCalvin Morrison <mutantturkey@gmail.com>2013-12-06 17:19:00 -0500
commitbce70ffa642198d593680cb672e39b7b646ed0bd (patch)
treed2d4a3f42e00287575527ac435e3a364b4ddc12d
parent781b0d0be0863cff7ac8a382aba9765e61b5558d (diff)
exit fail if fail
-rwxr-xr-xcount_nucleobases.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/count_nucleobases.c b/count_nucleobases.c
index fbf4ce2..1b432da 100755
--- a/count_nucleobases.c
+++ b/count_nucleobases.c
@@ -6,7 +6,7 @@
#include <stdbool.h>
int main() {
- ssize_t len = 0;
+ size_t len = 0;
unsigned long long counts[256] = {0};
@@ -32,8 +32,15 @@ int main() {
}
}
}
- } else { fprintf(stderr, "this does not look like a fasta file\n"); }
- } else { fprintf(stderr, "could not read file\n"); }
+ }
+ else {
+ fprintf(stderr, "this does not look like a fasta file\n");
+ exit(EXIT_FAILURE);
+ }
+ } else {
+ fprintf(stderr, "could not read file\n");
+ exit(EXIT_FAILURE);
+ }
printf("A:%llu\nC:%llu\nG:%llu\nT:%llu\n",
counts['a'] + counts['A'],