# taha-asm/get_next_line architecture

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

- Interactive diagram: https://gitdiagram.com/taha-asm/get_next_line
- Repository: https://github.com/taha-asm/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 for later calls. Its mandatory implementation keeps one static buffer; the bonus implementation keeps a separate buffer slot per descriptor. Both read and accumulate data, use shared-style string/line helpers, then split the current line from the remainder. Source excerpts show these calls; the README documents the API and behavior. The graph omits unshown low-level helper call details beyond those visible in the excerpts.

Main entry points: [`get_next_line.c`](https://github.com/taha-asm/get_next_line/blob/main/get_next_line.c) (Line reader), [`get_next_line_bonus.c`](https://github.com/taha-asm/get_next_line/blob/main/get_next_line_bonus.c) (Multi-FD reader), [`get_next_line_utils.c`](https://github.com/taha-asm/get_next_line/blob/main/get_next_line_utils.c) (String and line helpers), [`get_next_line_utils_bonus.c`](https://github.com/taha-asm/get_next_line/blob/main/get_next_line_utils_bonus.c) (Bonus helpers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mandatory["Mandatory implementation"]
  node_mandatory_api["GNL interface<br/>[get_next_line.h]"]
  node_mandatory_entry["Line reader<br/>[get_next_line.c]"]
  node_mandatory_utils["String and line helpers"]
end

subgraph group_bonus["Bonus implementation"]
  node_bonus_api["Bonus interface"]
  node_bonus_entry["Multi-FD reader"]
  node_bonus_utils["Bonus helpers"]
end

node_caller(("Library caller"))
node_fd(("File descriptor"))

node_caller -->|"calls"| node_mandatory_entry
node_mandatory_entry -->|"reads bytes"| node_fd
node_mandatory_entry -->|"splits line"| node_mandatory_utils
node_caller -->|"calls"| node_bonus_entry
node_bonus_entry -->|"reads bytes"| node_fd
node_bonus_entry -->|"splits line"| node_bonus_utils

click node_mandatory_api "https://github.com/taha-asm/get_next_line/blob/main/get_next_line.h"
click node_mandatory_entry "https://github.com/taha-asm/get_next_line/blob/main/get_next_line.c"
click node_mandatory_utils "https://github.com/taha-asm/get_next_line/blob/main/get_next_line_utils.c"
click node_bonus_api "https://github.com/taha-asm/get_next_line/blob/main/get_next_line_bonus.h"
click node_bonus_entry "https://github.com/taha-asm/get_next_line/blob/main/get_next_line_bonus.c"
click node_bonus_utils "https://github.com/taha-asm/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_mandatory_api,node_mandatory_entry,node_mandatory_utils toneBlue
class node_bonus_api,node_bonus_entry,node_bonus_utils toneAmber
class node_caller,node_fd toneIndigo
```

## Components

### Mandatory implementation

- [GNL interface](https://github.com/taha-asm/get_next_line/blob/main/get_next_line.h): `get_next_line.h`
- [Line reader](https://github.com/taha-asm/get_next_line/blob/main/get_next_line.c): `get_next_line.c`
- [String and line helpers](https://github.com/taha-asm/get_next_line/blob/main/get_next_line_utils.c): `get_next_line_utils.c`

### Bonus implementation

- [Bonus interface](https://github.com/taha-asm/get_next_line/blob/main/get_next_line_bonus.h): `get_next_line_bonus.h`
- [Multi-FD reader](https://github.com/taha-asm/get_next_line/blob/main/get_next_line_bonus.c): `get_next_line_bonus.c`
- [Bonus helpers](https://github.com/taha-asm/get_next_line/blob/main/get_next_line_utils_bonus.c): `get_next_line_utils_bonus.c`

### Other components

- **Library caller**
- **File descriptor**

## Connections

- Library caller → Line reader: calls (evidence: `README.md`)
- Line reader → File descriptor: reads bytes (evidence: `get_next_line.c`)
- Line reader → String and line helpers: splits line (evidence: `get_next_line.c`)
- Library caller → Multi-FD reader: calls (evidence: `README.md`)
- Multi-FD reader → File descriptor: reads bytes (evidence: `get_next_line_bonus.c`)
- Multi-FD reader → Bonus helpers: splits line (evidence: `get_next_line_bonus.c`)
