diff options
| author | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:07:58 +0200 |
|---|---|---|
| committer | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:07:58 +0200 |
| commit | 967be9e750221ab2ab783f95df79bb26d290a45e (patch) | |
| tree | 6802900a5e975f9f68b169f0f503f040056d6952 /bittorrent/mbtstr/src/fprint.c | |
Diffstat (limited to 'bittorrent/mbtstr/src/fprint.c')
| -rw-r--r-- | bittorrent/mbtstr/src/fprint.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/bittorrent/mbtstr/src/fprint.c b/bittorrent/mbtstr/src/fprint.c new file mode 100644 index 0000000..d0ee309 --- /dev/null +++ b/bittorrent/mbtstr/src/fprint.c @@ -0,0 +1,17 @@ +#include <complex.h> +#include <ctype.h> +#include <stdbool.h> + +#include "mbtstr/utils.h" +#include "mbtstr/view.h" + +void mbt_cview_fprint(struct mbt_cview view, FILE *stream) +{ + for (size_t i = 0; i < view.size; i++) + { + if (isprint(view.data[i])) + fputc(view.data[i], stream); + else + fprintf(stream, "U+%04X", (view.data[i] + 256) % 256); + } +} |
