# HG changeset patch # User Paul Boddie # Date 1680810436 -7200 # Node ID d3c01405b62d524336f4ec7ad89a37ab97ca803a # Parent f4bc1512b0907d45bc709e566928d97a38246939 Introduced error handling when the desired lines cannot be located. diff -r f4bc1512b090 -r d3c01405b62d test_files/programs/clip.c --- a/test_files/programs/clip.c Tue Apr 04 23:11:00 2023 +0200 +++ b/test_files/programs/clip.c Thu Apr 06 21:47:16 2023 +0200 @@ -135,14 +135,22 @@ i = 1; while (i < startline) + { if (!readline(file, &i, &start, &end)) - break; + { + printf("EOF error at line %d.\n", i); + return 1; + } + } while (i < startline + numlines) { fwrite(start, sizeof(char), end - start, stdout); if (!readline(file, &i, &start, &end)) - break; + { + printf("EOF error at line %d.\n", i); + return 1; + } } fputs("\n\n", stdout);