#include "main.h" #include "readline.h" #include #include #include #include #include #include "wind.h" /* * Entry point of mesms and event loop */ #ifdef DEBUG #include #endif const int color[] = { COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_YELLOW, COLOR_BLUE, COLOR_MAGENTA, COLOR_CYAN, COLOR_WHITE}; #define MAX_PATH 1024 extern char* msg_win_str; static bool visual_mode = false; WINDOW *cmd_win; WINDOW *sep_win; char status[10]; void fail_exit(const char *msg) { if (visual_mode) endwin(); fprintf(stderr, "%s\n", msg); exit(EXIT_FAILURE); } int main(int argc, char* argv[]){ /* Gestion des paramètres */ while (1) { int c; int optIndex = 0; static struct option optlv[] = { {"help", no_argument, 0, 'h' }, {"version", no_argument, 0, 'v' }, {NULL, 0, 0, 0 } }; c = getopt_long(argc, argv, "hv:", optlv, &optIndex); if (c == -1) break; switch (c) { case 'v': if( !strcmp(optlv[optIndex].name, "version") ) { puts( VERSION_MESMS ); } break; case 'h': puts( HELP_STRING_MESMS ); return EXIT_SUCCESS; break; case '?': default: return EXIT_FAILURE; } } /* Initialisation */ int size = 0; int c; int comp = 0; setlocale(LC_ALL, ""); initscr(); if (has_colors()) { CHECK(start_color); } CHECK(cbreak); CHECK(noecho); CHECK(nonl); CHECK(intrflush, NULL, FALSE); visual_mode = true; curs_set(0); cmd_win = newwin(1, COLS, LINES - 20, 0); sep_win = newwin(1, COLS, LINES - 2, 0); init_pair( 12, COLOR_WHITE, COLOR_BLUE); CHECK(wbkgd, sep_win, COLOR_PAIR(12)); CHECK(wrefresh, sep_win); init_readline(); for(int i = 0 ; i < 9 ; i++) { init_pair( i+1, i, COLOR_BLACK); } /* Premier affichage */ /* Event loop */ while( c = getch() ) { if (c == KEY_RESIZE) { continue; } refresh(); } refresh(); getch(); end: endwin(); return 0; }