1.1 --- a/test_files/programs/clip.c Mon Mar 04 22:32:42 2024 +0100
1.2 +++ b/test_files/programs/clip.c Tue Mar 05 00:15:15 2024 +0100
1.3 @@ -148,13 +148,25 @@
1.4
1.5 while (lineno < startline + numlines)
1.6 {
1.7 + /* Read a line, updating the current line number. */
1.8 +
1.9 if (!readline(file, &lineno, &start, &end))
1.10 {
1.11 + /* If the last line was passed, an empty line is an acceptable end-of-file
1.12 + condition. */
1.13 +
1.14 + if (lineno >= startline + numlines)
1.15 + break;
1.16 +
1.17 + /* Otherwise, indicate that end-of-file occurred. */
1.18 +
1.19 _fprintf(output, "EOF error at line %d.\n", lineno);
1.20 client_flush(output);
1.21 return 1;
1.22 }
1.23
1.24 + /* Emit line content while within the desired range of lines. */
1.25 +
1.26 if ((lineno >= startline) && (lineno < startline + numlines))
1.27 client_write(output, start, end - start);
1.28 }