Advertisement
rfmonk

error_report.c

Jul 23rd, 2014
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.71 KB | None | 0 0
  1.  1 {
  2.  2     char *line = NULL;
  3.  3     size_t len = 0;
  4.  4     unsigned int lineno = 0;
  5.  5    
  6.  6     error_message_count = 0;
  7.  7     while (! feof_unlocked (fp))
  8.  8     {    
  9.  9         ssize_t n = getline (&line, &len, fp);
  10. 10         if (n <= 0)
  11. 11             /* End of file or error. */
  12. 12             break;
  13. 13         ++lineno;
  14. 14        
  15. 15         /* Process the line. */
  16. 16         ***
  17. 17            
  18. 18         if (Detect error in line)
  19. 19             error_at_line (0, errval, fileno, lineno,
  20. 20                     "some error text %s", some_variable);
  21. 21     }  
  22. 22     if (error_message_count != 0)
  23. 23         error (EXIT_FAILURE, 0, "%u errors found", error_message_count);
  24. 24 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement