17 static void quit(int sig
)
21 /* do your non-curses wrapup here */
31 init_pair(COLOR_BLACK
, COLOR_BLACK
, COLOR_BLACK
);
32 init_pair(COLOR_GREEN
, COLOR_GREEN
, COLOR_BLACK
);
33 init_pair(COLOR_RED
, COLOR_RED
, COLOR_BLACK
);
34 init_pair(COLOR_CYAN
, COLOR_CYAN
, COLOR_BLACK
);
35 init_pair(COLOR_WHITE
, COLOR_WHITE
, COLOR_BLACK
);
36 init_pair(COLOR_MAGENTA
, COLOR_MAGENTA
, COLOR_BLACK
);
37 init_pair(COLOR_BLUE
, COLOR_BLUE
, COLOR_BLACK
);
38 init_pair(COLOR_YELLOW
, COLOR_YELLOW
, COLOR_BLACK
);
44 (void) signal(SIGINT
, quit
); /* arrange interrupts to terminate */
46 (void) initscr(); /* initialize the curses library */
47 keypad(stdscr
, TRUE
); /* enable keyboard mapping */
48 (void) nonl(); /* tell curses not to do NL->CR/NL on output */
49 (void) cbreak(); /* take input chars one at a time, no wait for \n */
50 (void) noecho(); /* don't echo input */
61 main(int argc
, char *argv
[])
67 getmaxyx(stdscr
, y
, x
);
69 attrset(COLOR_PAIR(COLOR_GREEN
));
72 printw("%s", "cg-view");
81 mvprintw(y
- 1, 0, "%s", "press 'q' to quit");
84 FILE *rev_list
= popen("git-rev-list $(git-rev-parse --since=1.month) HEAD", "r");
89 while ((line
= fgets(buffer
, sizeof(buffer
), rev_list
))) {
91 printw("%2d: ", lineno
++);
101 int c
= getch(); /* refresh, accept single keystroke of input */
103 /* Process the command keystroke */
110 addstr("Shelling out...");
111 def_prog_mode(); /* save current tty modes */
112 endwin(); /* restore original tty modes */
113 system("sh"); /* run shell */
114 addstr("returned.\n"); /* prepare return message */
116 //refresh(); /* restore save modes, repaint screen */
120 if (isprint(c
) || isspace(c
))