[UP] del tab module in ion, change status update interval.
[arrow.git] / ncurses / attr.c
blob11247a043a2abd8dd782e03e36c198ed0992917b
1 /* copyleft (C) GPL3 {{{2
2 * Filename: attr.c
4 * Author: arrow <arrow_zhang@sdc.sercomm.com>
5 * Created at: Tue Jan 8 23:04:51 2008
6 * }}}*/
7 /*header files {{{1*/
8 #include <ncurses.h>
9 /*}}}*/
11 /*declaration {{{1*/
12 /*}}}*/
14 /*functions {{{1*/
15 int main(int argc, char *argv[])
17 int ch, prev;
18 FILE *fp;
19 int goto_prev = FALSE, y, x;
20 if (argc != 2) {
21 printf("usage: %s<a c file name>\n", argv[0]);
22 return 0;
24 fp = fopen(argv[1], "r");
25 if (fp == NULL) {
26 perror("cannot open input file");
27 return 0;
29 initscr();
30 prev = EOF;
31 while ((ch = fgetc(fp)) != EOF) {
32 if (prev == '/' && ch == '*') {
33 attron(A_BOLD);
34 goto_prev = TRUE;
36 if (goto_prev == TRUE) {
37 getyx(stdscr, y, x);
38 move(y, x - 1);
39 printw("%c%c", '/', ch);
40 ch = 'a';
41 goto_prev = FALSE;
42 } else {
43 printw("%c", ch);
45 refresh();
46 if (prev == '*' && ch == '/') {
47 attroff(A_BOLD);
49 prev = ch;
51 getch();
52 endwin();
53 return 0;
56 /* vim:fdm=marker:ts=8:ft=c:norl:fdl=1:
57 * }}}*/