# ckormanyos/xxd architecture

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

- Interactive diagram: https://gitdiagram.com/ckormanyos/xxd
- Repository: https://github.com/ckormanyos/xxd

## Overview

This repository is a standalone command-line `xxd` utility: it reads bytes from a file or standard input and either renders a text representation or reconstructs binary data from hex-like text. The README documents normal, PostScript, C-include and binary dumps, plus reverse conversion and file patching. The implementation is concentrated in `src/xxd.c`; the sampled excerpts show option parsing, stream setup and reverse parsing, but omit some formatting routines, so their internal call wiring is not expanded.

Main entry points: [`src/xxd.c`](https://github.com/ckormanyos/xxd/blob/main/src/xxd.c) (Option parsing)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_user(("CLI user"))
node_entry["Option parsing<br/>[xxd.c]"]
node_streams["File streams<br/>[xxd.c]"]
node_hex["Hex dump<br/>[xxd.c]"]
node_alternate["Other dump formats<br/>[xxd.c]"]
node_reverse["Reverse decoding<br/>[xxd.c]"]
node_result["Output bytes or text"]

node_user -->|"runs options"| node_entry
node_entry -->|"selects streams"| node_streams
node_entry -->|"selects dump"| node_hex
node_entry -->|"selects format"| node_alternate
node_entry -->|"selects reverse"| node_reverse
node_streams -->|"supplies bytes"| node_hex
node_streams -->|"supplies bytes"| node_alternate
node_streams -->|"supplies text"| node_reverse
node_hex -->|"writes dump"| node_result
node_alternate -->|"writes dump"| node_result
node_reverse -->|"writes bytes"| node_result

click node_entry "https://github.com/ckormanyos/xxd/blob/main/src/xxd.c"
click node_streams "https://github.com/ckormanyos/xxd/blob/main/src/xxd.c"
click node_hex "https://github.com/ckormanyos/xxd/blob/main/src/xxd.c"
click node_alternate "https://github.com/ckormanyos/xxd/blob/main/src/xxd.c"
click node_reverse "https://github.com/ckormanyos/xxd/blob/main/src/xxd.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_user toneBlue
class node_entry,node_streams,node_hex,node_alternate,node_reverse toneTeal
class node_result toneIndigo
```

## Components

### Other components

- **CLI user**
- [Option parsing](https://github.com/ckormanyos/xxd/blob/main/src/xxd.c): `src/xxd.c`
- [File streams](https://github.com/ckormanyos/xxd/blob/main/src/xxd.c): `src/xxd.c`
- [Hex dump](https://github.com/ckormanyos/xxd/blob/main/src/xxd.c): `src/xxd.c`
- [Other dump formats](https://github.com/ckormanyos/xxd/blob/main/src/xxd.c): `src/xxd.c`
- [Reverse decoding](https://github.com/ckormanyos/xxd/blob/main/src/xxd.c): `src/xxd.c`
- **Output bytes or text**

## Connections

- CLI user → Option parsing: runs options
- Option parsing → File streams: selects streams
- Option parsing → Hex dump: selects dump
- Option parsing → Other dump formats: selects format
- Option parsing → Reverse decoding: selects reverse
- File streams → Hex dump: supplies bytes
- File streams → Other dump formats: supplies bytes
- File streams → Reverse decoding: supplies text
- Hex dump → Output bytes or text: writes dump
- Other dump formats → Output bytes or text: writes dump
- Reverse decoding → Output bytes or text: writes bytes
