# omerfarukyagci/get_next_line architecture

> Architecture diagram of the GitHub repository omerfarukyagci/get_next_line, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/omerfarukyagci/get_next_line
- Repository: https://github.com/omerfarukyagci/get_next_line

## Overview

Get Next Line is a small C library that returns one line per call from a file descriptor, retaining unread bytes between calls. The standard implementation keeps one static pending buffer; the bonus implementation keeps separate pending buffers indexed by descriptor. Each entry point reads until a newline or EOF, returns the extracted line, and retains or frees the remainder. Utility functions support searching, joining, and freeing buffers. The README documents both variants; source excerpts show their read and helper calls.

Main entry points: [`get_next_line.c`](https://github.com/omerfarukyagci/get_next_line/blob/main/get_next_line.c) (Standard line reader), [`get_next_line_bonus.c`](https://github.com/omerfarukyagci/get_next_line/blob/main/get_next_line_bonus.c) (Multi-FD line reader), [`get_next_line_utils.c`](https://github.com/omerfarukyagci/get_next_line/blob/main/get_next_line_utils.c) (Standard string helpers), [`get_next_line_utils_bonus.c`](https://github.com/omerfarukyagci/get_next_line/blob/main/get_next_line_utils_bonus.c) (Multi-FD string helpers)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_caller(("Library caller"))
node_standard_api["Standard line reader<br/>[get_next_line.c]"]
node_standard_header["Standard interface<br/>[get_next_line.h]"]
node_standard_utils["Standard string helpers"]
node_bonus_api["Multi-FD line reader"]
node_bonus_header["Multi-FD interface"]
node_bonus_utils["Multi-FD string helpers"]
node_fd_reader["File descriptor"]

node_caller -->|"requests line"| node_standard_api
node_standard_api -->|"reads bytes"| node_fd_reader
node_standard_api -->|"uses helpers"| node_standard_utils
node_caller -->|"requests line"| node_bonus_api
node_bonus_api -->|"reads bytes"| node_fd_reader
node_bonus_api -->|"uses helpers"| node_bonus_utils

click node_standard_api "https://github.com/omerfarukyagci/get_next_line/blob/main/get_next_line.c"
click node_standard_header "https://github.com/omerfarukyagci/get_next_line/blob/main/get_next_line.h"
click node_standard_utils "https://github.com/omerfarukyagci/get_next_line/blob/main/get_next_line_utils.c"
click node_bonus_api "https://github.com/omerfarukyagci/get_next_line/blob/main/get_next_line_bonus.c"
click node_bonus_header "https://github.com/omerfarukyagci/get_next_line/blob/main/get_next_line_bonus.h"
click node_bonus_utils "https://github.com/omerfarukyagci/get_next_line/blob/main/get_next_line_utils_bonus.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_caller,node_fd_reader toneIndigo
class node_standard_api,node_standard_header,node_standard_utils,node_bonus_api,node_bonus_header,node_bonus_utils toneTeal
```

## Components

### Other components

- **Library caller**
- [Standard line reader](https://github.com/omerfarukyagci/get_next_line/blob/main/get_next_line.c): `get_next_line.c`
- [Standard interface](https://github.com/omerfarukyagci/get_next_line/blob/main/get_next_line.h): `get_next_line.h`
- [Standard string helpers](https://github.com/omerfarukyagci/get_next_line/blob/main/get_next_line_utils.c): `get_next_line_utils.c`
- [Multi-FD line reader](https://github.com/omerfarukyagci/get_next_line/blob/main/get_next_line_bonus.c): `get_next_line_bonus.c`
- [Multi-FD interface](https://github.com/omerfarukyagci/get_next_line/blob/main/get_next_line_bonus.h): `get_next_line_bonus.h`
- [Multi-FD string helpers](https://github.com/omerfarukyagci/get_next_line/blob/main/get_next_line_utils_bonus.c): `get_next_line_utils_bonus.c`
- **File descriptor**

## Connections

- Library caller → Standard line reader: requests line (evidence: `README.md`)
- Standard line reader → File descriptor: reads bytes (evidence: `get_next_line.c`)
- Standard line reader → Standard string helpers: uses helpers (evidence: `get_next_line.c`)
- Library caller → Multi-FD line reader: requests line (evidence: `README.md`)
- Multi-FD line reader → File descriptor: reads bytes (evidence: `get_next_line_bonus.c`)
- Multi-FD line reader → Multi-FD string helpers: uses helpers (evidence: `get_next_line_bonus.c`)
