Skip to content

Commit

Permalink
Merge branch 't/4f9d6407'
Browse files Browse the repository at this point in the history
  • Loading branch information
nickolasburr committed Nov 18, 2018
2 parents 4f9d640 + 4be887d commit a2656d7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main.c
Expand Up @@ -9,7 +9,7 @@
int main (int argc, char **argv) {
int i, n;
int start, end, count;
int sets, index, zindex;
int pairs, index, zindex;
int opt_value, long_opt_index;
size_t len;
ssize_t read;
Expand Down Expand Up @@ -72,7 +72,7 @@ int main (int argc, char **argv) {
}
}

sets = 0;
pairs = 0;
ranges = ALLOC(sizeof(*ranges) * n);

for (index = 1; index < argc; index += 1) {
Expand Down Expand Up @@ -124,7 +124,7 @@ int main (int argc, char **argv) {
zindex++;
}

ranges[sets++] = rng;
ranges[pairs++] = rng;
}

break;
Expand Down Expand Up @@ -153,7 +153,7 @@ int main (int argc, char **argv) {
count = 1;

while ((read = getline(&line, &len, stream)) != -1) {
for (index = 0; index < sets; index += 1) {
for (index = 0; index < pairs; index += 1) {
if (count >= ranges[index]->start && (count <= ranges[index]->end || !ranges[index]->end)) {
fwrite(line, read, 1, stdout);
}
Expand All @@ -165,7 +165,7 @@ int main (int argc, char **argv) {
/**
* Run clean-up tasks.
*/
for (index = 0; index < sets; index += 1) {
for (index = 0; index < pairs; index += 1) {
FREE(ranges[index]);
}

Expand All @@ -177,7 +177,7 @@ int main (int argc, char **argv) {
/**
* Run clean-up tasks.
*/
for (index = 0; index < sets; index += 1) {
for (index = 0; index < pairs; index += 1) {
FREE(ranges[index]);
}

Expand Down

0 comments on commit a2656d7

Please sign in to comment.