Drop -Werror
[pmc.git] / ansitest.c
blob96604acb78fc16939356023075cec374ee8af438
1 #include <stdio.h>
2 #include <sys/types.h>
3 #include <string.h>
4 #include <cbuf.h>
5 #include <ncurses.h>
6 #include <stdlib.h>
8 #include <color.h>
9 #include <ansi.h>
11 #ifdef DEBUG
13 int
14 main(int argc, char **argv)
16 size_t nbytes = 0;
17 char buf[1024];
18 char buf2[1024];
19 char *cb;
20 WINDOW *bg;
21 FILE *fp = fopen(argv[1], "r");
23 if (!fp) {
24 printf(" needs filename dummy\n");
25 return 1;
28 if (argc == 3) {
29 cb = cb_init(buf2, sizeof(buf2), NULL);
30 while (fgets(buf, sizeof(buf), fp)!=NULL) {
31 cb_reset(cb);
32 ansi_strip(cb, buf, strlen(buf));
33 printf("%s", cb);
36 return 0;
42 bg = initscr();
43 start_color();
44 pmc_init_color();
45 scrollok(bg, TRUE);
46 clearok(bg, FALSE);
48 wattr_set(bg, A_NORMAL, (short)(BG(C_BLACK)|C_WHITE), NULL);
50 while (fgets(buf, sizeof(buf), fp)!=NULL) {
51 nbytes += ansi_waddnstr(bg, buf, strlen(buf));
52 wnoutrefresh(bg);
53 doupdate();
56 getch();
57 endwin();
58 printf("%d bytes\n", nbytes);
59 return 0;
61 #endif