How ikardi69/get_next_line works
Project type and purpose
• This is a small C library (“Get Next Line”) designed to be linked into any C program.
• Purpose: Provide a reusable function, get_next_line(), that reads a file descriptor line-by-line, handling arbitrary BUFFER_SIZE and multiple FDs.
File structure
• Top-level files:
• get_next_line.c / _utils.c / .h – mandatory implementation
• get_next_line_bonus.c / _utils_bonus.c / .h – bonus version with multi-FD support
• README.md – description, usage, testing notes
• No “frontend” or “backend”; instead it’s a library with two feature sets (mandatory vs. bonus).
• No build scripts; compilation via cc command line.
README for additional insights
• Core flow: allocate buffer → read() calls → accumulate until newline or EOF → return line → maintain leftover state
• Bonus: separate states per FD via one static variable (likely a linked list or array internally).
Detailed suggestions
• Static variable usage in bonus module to show “per-FD state list”
• Loop: repeated calls until NULL → end of file
• How the user program depends on the GNL library
• The internal flow of data (read → accumulate → return)
• The bonus multi‐FD state management
• The boundary between user code, library code, and OS