-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexencode.c
More file actions
29 lines (22 loc) · 892 Bytes
/
exencode.c
File metadata and controls
29 lines (22 loc) · 892 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// SPDX-License-Identifier: MIT
#define AMP_BUF_SIZE 2048 // Let's use the integrated buffer for convenience.
#include "../../amp.h"
int main(int, char **) {
struct amp_type amp;
if (amp_init(&, 78, 2, nullptr, 0) > sizeof(amp.buffer)) {
static const char message[] = "amp_init: not enough memory provided\n";
write(2, message, strlen(message));
return EXIT_FAILURE;
}
amp_print_rich_text(
&, amp_get_width(&) / 2, 0, AMP_STYLE_NONE, 0, AMP_ALIGN_CENTER,
"{Nnavy background{X, {rred foreground{x, {/italic{x, {/{?faint italic"
);
// Write to stdout.
amp_to_ans(&, nullptr, 0);
const char *comment = "\n\nConverted to a plaintext AMP container:\n";
amp_stdout(comment, strlen(comment));
amp_encode(&, AMP_FLATTEN|AMP_DEFLATE, nullptr, 0);
amp_stdout("\n", 1);
return EXIT_SUCCESS;
}