printtest.c (1076B)
1 /* 2 * Copy me if you can. 3 * by 20h 4 * 5 * % make printtest 6 * % ./printtest 7 */ 8 9 #include <unistd.h> 10 #include <stdlib.h> 11 #include <stdio.h> 12 13 int 14 main(int argc, char *argv[]) 15 { 16 int bgcol, fgcol, attr; 17 char *test = "This täxt is töo long. üü"; 18 char *col[] = { 19 "right, bggreen, fgblue, underline", 20 "bgblack, center, dim, fgred", 21 "dim, fgblack, bgwhite" 22 }; 23 char *rcol = "reset, bgblack, fgwhite"; 24 int i; 25 print_t *apri, *rpri; 26 27 rpri = print_new(rcol); 28 29 for (i = 0; i < (sizeof(col)/sizeof(col[0])); i++) { 30 apri = print_new(col[i]); 31 print_palignf(apri, 80, "%s", col[i]); 32 print_pcolor(rpri); 33 printf("\n"); 34 print_free(apri); 35 } 36 37 apri = print_new("left, overline, fggreen, bgwhite"); 38 printf("\n"); 39 print_palignf(apri, 80, "%s", test); 40 print_pcolor(rpri); 41 42 printf("\n"); 43 print_palignf(apri, 8, "%s", test); 44 print_pcolor(rpri); 45 46 printf("\n"); 47 print_palignf(apri, 16, "%s", test); 48 print_pcolor(rpri); 49 50 printf("\n"); 51 print_palignf(apri, 28, "%s", test); 52 print_free(apri); 53 54 print_pcolor(rpri); 55 print_free(rpri); 56 printf("\n"); 57 58 return 0; 59 } 60