void scrollTest(WINDOW *win) { int i, OldY; #ifndef PDCURSES int OldX; #endif werase(win); mvwaddstr(win, height - 2, 1, "The window will now scroll slowly"); box(win, ACS_VLINE, ACS_HLINE); wrefresh(win); scrollok(win, TRUE); napms(500); for (i = 1; i <= height; i++) { napms(150); scroll(win); wrefresh(win); }; #ifdef PDCURSES OldY = getmaxy(win); #else getmaxyx(win, OldY, OldX); #endif mvwaddstr(win, 6, 1, "The top of the window will scroll"); wmove(win, 1, 1); wsetscrreg(win, 0, 4); box(win, ACS_VLINE, ACS_HLINE); wrefresh(win); for (i = 1; i <= 5; i++) { napms(500); scroll(win); wrefresh(win); } mvwaddstr(win, 3, 1, "The bottom of the window will scroll"); wmove(win, 8, 1); wsetscrreg(win, 5, --OldY); box(win, ACS_VLINE, ACS_HLINE); wrefresh(win); for (i = 5; i <= OldY; i++) { napms(300); wscrl(win, -1); wrefresh(win); } wsetscrreg(win, 0, OldY); }
static void scrollTest(WINDOW *win) { int i; int half; int OldY; NCURSES_CONST char *Message = "The window will now scroll slowly"; wclear(win); OldY = getmaxy(win); half = OldY / 2; MvWAddStr(win, OldY - 2, 1, Message); wrefresh(win); scrollok(win, TRUE); for (i = 1; i <= OldY; i++) { napms(600); scroll(win); wrefresh(win); } werase(win); for (i = 1; i < OldY; i++) { MvWPrintw(win, i, 1, "Line %d", i); } MvWPrintw(win, OldY - 2, 1, "The top of the window will scroll"); wmove(win, 1, 1); wsetscrreg(win, 0, half - 1); box(win, ACS_VLINE, ACS_HLINE); wrefresh(win); for (i = 1; i <= half; i++) { napms(600); scroll(win); box(win, ACS_VLINE, ACS_HLINE); wrefresh(win); } werase(win); for (i = 1; i < OldY; i++) { MvWPrintw(win, i, 1, "Line %d", i); } MvWPrintw(win, 1, 1, "The bottom of the window will scroll"); wmove(win, OldY - 2, 1); wsetscrreg(win, half, --OldY); box(win, ACS_VLINE, ACS_HLINE); wrefresh(win); for (i = half; i <= OldY; i++) { napms(600); wscrl(win, -1); box(win, ACS_VLINE, ACS_HLINE); wrefresh(win); } wsetscrreg(win, 0, OldY); }
void read_thread(pt_s *pt) { WINDOW *show_win, *people_win; win_s show, people; int l = -1, y, x, mes_len = 0; int i = 0; for (i = 0; i < 128; ++i) { int j = 0; for (j = 0; j < 20; ++j) { pt->name_list[i][j] = 0; } } people.startx = COLS - 20; people.starty = 0; people.width = 20; people.height = LINES; people_win = create_newwin(people, "PEOPLE"); show.startx = show.starty = 0; show.height = LINES - 5; show.width = COLS - 20; show_win = create_newwin(show, "MESSAGE"); scrollok(show_win, true); wsetscrreg(show_win, 0, show.height - 3); while (Rio_readlineb(&(pt->rio), pt->rbuf, MAXLINE)) { int color_num = pt->rbuf[0] % 5; mes_len = strlen(pt->rbuf); if (pt->rbuf[mes_len - 2] == '#') { // 显示消息 pt->rbuf[mes_len - 2] = '\n'; pt->rbuf[mes_len - 1] = '\0'; if (l < show.height - 3) l++; wattron(show_win, COLOR_PAIR(color_num)); mvwprintw(show_win, l, 0, "%s", pt->rbuf); wattroff(show_win, COLOR_PAIR(color_num)); wrefresh(show_win); } else { // 打印在线列表 char pos = pt->rbuf[mes_len - 2]; if (pt->name_list[pos][0]) { pt->name_list[pos][0] = 0; } else { strncpy(pt->name_list[pos], pt->rbuf, mes_len - 2); } int i = 0, ll = 0; werase(people_win); for (i = 0; i < 128; ++i) { if (pt->name_list[i][0]) { wattron(people_win, COLOR_PAIR(pt->name_list[i][0] % 5)); mvwprintw(people_win, ll++, 0, "%s", pt->name_list[i]); wattroff(people_win, COLOR_PAIR(pt->name_list[i][0] % 5)); wrefresh(people_win); } } } } }
main() { int i; WINDOW *win; initscr(); noecho(); nonl(); cbreak(); scrollok(stdscr, TRUE); for (i=0; i<25; i++) printw("This is in the background, this should be left alone!\n"); refresh(); win=newwin(10,50,6,20); scrollok(win,TRUE); wmove(win,0,0); whline(win,0,49); wmove(win,9,0); whline(win,0,49); wrefresh(win); wattrset(win,A_STANDOUT); mvwprintw(win, 0, 14, " Scrolling Demo! "); mvwprintw(win, 9, 14, " Scrolling Demo! "); wattroff(win,A_STANDOUT); wsetscrreg(win, 1,8); mvwprintw(win, 0, 5, " DOWN "); wmove(win,1,0); wrefresh(win); getch(); for (i=0; i<25; i++){ wprintw(win, "This is window line test (%d).\n", i); if (i%2) wattrset(win,A_BOLD); else wattroff(win,A_BOLD); wrefresh(win); } mvwprintw(win, 0, 5, " UP "); wrefresh(win); getch(); for (i=0; i<25; i++) { wmove(win,1,0); winsertln(win); if (i%2) wattrset(win,A_BOLD); else wattroff(win,A_BOLD); wprintw(win, "Scrolling backwards! (%d)\n", i); wrefresh(win); } mvwprintw(win, 0, 5, " DONE "); wrefresh(win); endwin(); }
void setupTerminal(void) { wnd = initscr(); getmaxyx(wnd,termRows,termCols); start_color(); init_pair(1, COLOR_RED, COLOR_BLACK); init_pair(2, COLOR_YELLOW, COLOR_BLACK); init_pair(3, COLOR_GREEN, COLOR_BLACK); init_pair(4, COLOR_CYAN, COLOR_BLACK); init_pair(5, COLOR_BLACK, COLOR_WHITE); cbreak(); noecho(); keypad(stdscr, TRUE); wresize(wnd, termRows-3, termCols); wsetscrreg(wnd, 0, termRows-3); scrollok(wnd, true); inputWnd = newwin(3, termCols, termRows-3, 0); whline(inputWnd, '-', termCols); wmove(inputWnd, 1, 0); nodelay(wnd, true); nodelay(inputWnd, true); }
static void scroll_window(winid wid) { int wh, ww, s_top, s_bottom; boolean border = curses_window_has_border(wid); WINDOW *win = curses_get_nhwin(wid); curses_get_window_size(wid, &wh, &ww); if (wh == 1) { curses_clear_nhwin(wid); return; } if (border) { s_top = 1; s_bottom = wh; } else { s_top = 0; s_bottom = wh - 1; } scrollok(win, TRUE); wsetscrreg(win, s_top, s_bottom); scroll(win); scrollok(win, FALSE); if (wid == MESSAGE_WIN) { if (border) mx = 1; else mx = 0; } if (border) { box(win, 0, 0); } wrefresh(win); }
/*@ -globstate @*/ static void windowsetup(void) /* inotialize curses and set up screen windows */ { /* Set the window sizes per the following criteria: * * 1. Set the window size to display the maximum number of * satellites possible, but not more than can be fit in a * window the size of the GPS report window. We have to set * the limit that way because MAXCHANNELS has been made large * in order to prepare for survey-grade receivers.. * * 2. If the screen size will not allow for the full complement of * satellites to be displayed, set the windows sizes smaller, but * not smaller than the number of lines necessary to display all of * the fields in the 'datawin'. The list of displayed satellites * will be truncated to fit the available window size. (TODO: If * the satellite list is truncated, omit the satellites not used to * obtain the current fix.) * * 3. If the screen is large enough to display all possible * satellites (MAXCHANNELS - 2) with space still left at the bottom, * add a window at the bottom in which to scroll raw gpsd data. */ int xsize, ysize; /* Fire up curses. */ (void)initscr(); (void)noecho(); getmaxyx(stdscr, ysize, xsize); #ifdef TRUENORTH if (compass_flag) { if (ysize == MIN_COMPASS_DATAWIN_SIZE) { raw_flag = false; window_length = MIN_COMPASS_DATAWIN_SIZE; } else if (ysize > MIN_COMPASS_DATAWIN_SIZE) { raw_flag = true; window_length = MIN_COMPASS_DATAWIN_SIZE; } else { (void)mvprintw(0, 0, "Your screen must be at least 80x%d to run cgps.", MIN_COMPASS_DATAWIN_SIZE); /*@ -nullpass @*/ (void)refresh(); /*@ +nullpass @*/ (void)sleep(5); die(0); } } else #endif /* TRUENORTH */ { if (ysize > MAX_GPS_DATAWIN_SIZE) { raw_flag = true; window_length = MAX_GPS_DATAWIN_SIZE; } else if (ysize == MAX_GPS_DATAWIN_SIZE) { raw_flag = false; window_length = MAX_GPS_DATAWIN_SIZE; } else if (ysize > MIN_GPS_DATAWIN_SIZE) { raw_flag = true; window_length = MIN_GPS_DATAWIN_SIZE; } else if (ysize == MIN_GPS_DATAWIN_SIZE) { raw_flag = false; window_length = MIN_GPS_DATAWIN_SIZE; } else { (void)mvprintw(0, 0, "Your screen must be at least 80x%d to run cgps.", MIN_GPS_DATAWIN_SIZE); /*@ -nullpass @*/ (void)refresh(); /*@ +nullpass @*/ (void)sleep(5); die(0); } display_sats = window_length - SATWIN_OVERHEAD - (int)raw_flag; } #ifdef TRUENORTH /* Set up the screen for either a compass or a gps receiver. */ if (compass_flag) { /* We're a compass, set up accordingly. */ /*@ -onlytrans @*/ datawin = newwin(window_length, DATAWIN_WIDTH, 0, 0); (void)nodelay(datawin, (bool) TRUE); if (raw_flag) { messages = newwin(0, 0, window_length, 0); /*@ +onlytrans @*/ (void)scrollok(messages, true); (void)wsetscrreg(messages, 0, ysize - (window_length)); } /*@ -nullpass @*/ (void)refresh(); /*@ +nullpass @*/ /* Do the initial field label setup. */ (void)mvwprintw(datawin, 1, DATAWIN_DESC_OFFSET, "Time:"); (void)mvwprintw(datawin, 2, DATAWIN_DESC_OFFSET, "Heading:"); (void)mvwprintw(datawin, 3, DATAWIN_DESC_OFFSET, "Pitch:"); (void)mvwprintw(datawin, 4, DATAWIN_DESC_OFFSET, "Roll:"); (void)mvwprintw(datawin, 5, DATAWIN_DESC_OFFSET, "Dip:"); (void)mvwprintw(datawin, 6, DATAWIN_DESC_OFFSET, "Rcvr Type:"); (void)wborder(datawin, 0, 0, 0, 0, 0, 0, 0, 0); } else #endif /* TRUENORTH */ { /* We're a GPS, set up accordingly. */ /*@ -onlytrans @*/ datawin = newwin(window_length, DATAWIN_WIDTH, 0, 0); satellites = newwin(window_length, SATELLITES_WIDTH, 0, DATAWIN_WIDTH); (void)nodelay(datawin, (bool) TRUE); if (raw_flag) { messages = newwin(ysize - (window_length), xsize, window_length, 0); /*@ +onlytrans @*/ (void)scrollok(messages, true); (void)wsetscrreg(messages, 0, ysize - (window_length)); } /*@ -nullpass @*/ (void)refresh(); /*@ +nullpass @*/ /* Do the initial field label setup. */ (void)mvwprintw(datawin, 1, DATAWIN_DESC_OFFSET, "Time:"); (void)mvwprintw(datawin, 2, DATAWIN_DESC_OFFSET, "Latitude:"); (void)mvwprintw(datawin, 3, DATAWIN_DESC_OFFSET, "Longitude:"); (void)mvwprintw(datawin, 4, DATAWIN_DESC_OFFSET, "Altitude:"); (void)mvwprintw(datawin, 5, DATAWIN_DESC_OFFSET, "Speed:"); (void)mvwprintw(datawin, 6, DATAWIN_DESC_OFFSET, "Heading:"); (void)mvwprintw(datawin, 7, DATAWIN_DESC_OFFSET, "Climb:"); (void)mvwprintw(datawin, 8, DATAWIN_DESC_OFFSET, "Status:"); /* Note that the following fields are exceptions to the * sizing rule. The minimum window size does not include these * fields, if the window is too small, they get excluded. This * may or may not change if/when the output for these fields is * fixed and/or people request their permanance. They're only * there in the first place because I arbitrarily thought they * sounded interesting. ;^) */ if (window_length == MAX_GPS_DATAWIN_SIZE) { (void)mvwprintw(datawin, 9, DATAWIN_DESC_OFFSET, "Longitude Err:"); (void)mvwprintw(datawin, 10, DATAWIN_DESC_OFFSET, "Latitude Err:"); (void)mvwprintw(datawin, 11, DATAWIN_DESC_OFFSET, "Altitude Err:"); (void)mvwprintw(datawin, 12, DATAWIN_DESC_OFFSET, "Course Err:"); (void)mvwprintw(datawin, 13, DATAWIN_DESC_OFFSET, "Speed Err:"); /* it's actually esr that thought *these* were interesting */ (void)mvwprintw(datawin, 14, DATAWIN_DESC_OFFSET, "Time offset:"); (void)mvwprintw(datawin, 15, DATAWIN_DESC_OFFSET, "Grid Square:"); } (void)wborder(datawin, 0, 0, 0, 0, 0, 0, 0, 0); (void)mvwprintw(satellites, 1, 1, "PRN: Elev: Azim: SNR: Used:"); (void)wborder(satellites, 0, 0, 0, 0, 0, 0, 0, 0); } }
int setscrreg(int top, int bottom) { PDC_LOG(("setscrreg() - called: top %d bottom %d\n", top, bottom)); return wsetscrreg(stdscr, top, bottom); }
/* * setscrreg -- * Set the top and bottom of the scrolling region for stdscr. */ int setscrreg(int top, int bottom) { return wsetscrreg(stdscr, top, bottom); }
int main(int argc, char *argv[]) { int i; int ch; int lines, cols; WINDOW *win, *win2,*winarea, *subwin; ITEM *items[32]; MENU *mymenu; time_t tm; tm = time(NULL); if(initscr() == NULL) { perror("initcurs"); exit(EXIT_FAILURE); } cbreak(); noecho(); curs_set(1); keypad(stdscr, TRUE); getmaxyx(stdscr, lines, cols); win = newwin(15, cols, 0, 0); winarea = newwin(14, cols, 16, 0); // win2 = newwin(lines/2, cols, 22, 0); wborder(win, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '); wrefresh(win); box(win, 0, 0); box(winarea, 0, 0); wborder(win, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '); wrefresh(win); wborder(winarea, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '); wrefresh(winarea); // scrollok(win, TRUE); scrollok(winarea, TRUE); wsetscrreg(win, 0, 15); wsetscrreg(winarea, 0, 16); mvwprintw(win, 0, 16, "Press Ctrl-C or 'Q' to exit; "); mvwprintw(win, 2, 16, "Date: %s", ctime(&tm)); mvwprintw(win, 2, 16, "Date: %s", ctime(&tm)); wrefresh(win); // wrefresh(winarea); int k = 0; // for(k = 0; k < 100; k ++){ // wprintw(win, "test_%d\n",k); // } mvwprintw(winarea, 2, 0, "-------------------------------------------------"); while(toupper(ch = wgetch(win))) { if (ch == 'i') { // mvwprintw(win, 0, 44, "input i "); // scrl(2); wscrl(win,2); continue; } else if(ch == 'k') { // mvwprintw(win, 0, 44, "input d "); wscrl(win,-2); continue; } wprintw(win, "%c",ch); } endwin(); return 0; }
void *listening(void *) { char buffer[1]; box(chat, '*', '*'); wrefresh(chat); while(true) { bzero(buffer, 1); std::string str; str.clear(); while(true) { int n = read(sockMain, buffer, 1); if(buffer[0] == '\0') break; if(n <= 0) break; str += buffer[0]; } if(!str.empty()) { if(str[0] == '&') { wclear(users); mvwaddstr(users, 1, 1, "Users:\n"); str.erase(str.begin()); mvwaddstr(users, 2, 1, str.c_str()); box(input, '*', '*'); wrefresh(users); wrefresh(chat); } else { if(str.size() > 50) { str.insert(49, "\n*"); } mvwaddstr(chat, car, 1, str.c_str()); wrefresh(chat); if(str.size() > 50 && car + 1 != 16) { car++; } if(car + 1 == 16) { scrollok(chat, true); wsetscrreg(chat, 2, 16); idlok(chat, true); wscrl(chat, 1); box(chat, '*', '*'); box(users, '*', '*'); wrefresh(users); wrefresh(chat); } else if(car + 1 == 16 && str.size() > 50) { scrollok(chat, true); wsetscrreg(chat, 2, 16); idlok(chat, true); wscrl(chat, 3); box(chat, '*', '*'); wrefresh(chat); } else car++; } } else if(str.empty()) { break; } str.clear(); bzero(buffer, 1); } close(sockMain); pthread_exit(NULL); }
int init_framework() { g_mutex_lock(&curses_mutex); std_win = initscr(); cbreak(); keypad(stdscr, TRUE); noecho(); start_color(); /* Remove visibility of cursor */ curs_set(0); init_pair(1, COLOR_RED, COLOR_BLACK); init_pair(2, COLOR_GREEN, COLOR_BLACK); init_pair(3, COLOR_YELLOW, COLOR_BLUE); init_pair(4, COLOR_YELLOW, COLOR_BLACK); init_pair(5, COLOR_MAGENTA, COLOR_BLACK); init_pair(6, COLOR_BLACK, COLOR_WHITE); init_pair(7, COLOR_BLACK, COLOR_YELLOW); /* Determine window height */ getmaxyx(std_win, _nc_height, _nc_width); #define MAX_H (_nc_height) #define WIN_H (MAX_H/2) #define WIN_W (_nc_width) #define PAD_H (WIN_H - 2) #define PAD_W (WIN_W - 2) /* Create window with border */ _stdout = newwin(WIN_H, WIN_W, 0, 0); stdout_panel = new_panel(_stdout); wattron(_stdout, COLOR_PAIR(3)|A_BOLD); box(_stdout, ACS_VLINE, ACS_HLINE); wrefresh(_stdout); wattroff(_stdout, COLOR_PAIR(3)); stdout_win = derwin(_stdout, PAD_H, PAD_W, 1, 1); wbkgd(stdout_win, COLOR_PAIR(2)|A_BOLD); werase(stdout_win); wattron(_stdout, A_UNDERLINE); mvwprintw(_stdout, 0, 2, " Standard Output "); wattroff(_stdout, A_UNDERLINE); /* Set background for 'stdout' panel */ wattron(stdout_win, COLOR_PAIR(2)); mvwprintw(stdout_win, 0, 0, "Program Started\n"); wsetscrreg(stdout_win, 0, PAD_H); scrollok(stdout_win, TRUE); wrefresh(_stdout); wrefresh(stdout_win); _stderr = newwin(WIN_H, WIN_W, WIN_H, 0); stderr_panel = new_panel(_stderr); wattron(_stderr, COLOR_PAIR(3)|A_BOLD); box(_stderr, ACS_VLINE, ACS_HLINE); wattroff(_stderr, COLOR_PAIR(3)); stderr_win = derwin(_stderr, PAD_H, _nc_width-2, 1, 1); wattron(_stderr, A_UNDERLINE); mvwprintw(_stderr, 0, 2, " Standard Error "); wattroff(_stderr, A_UNDERLINE); /* Set background for 'stderr' stream panel */ wbkgd(stderr_win, COLOR_PAIR(1)|A_BOLD); werase(stderr_win); wattron(stderr_win, COLOR_PAIR(1)); mvwprintw(stderr_win, 0, 0, "Error Console Ready\n"); wsetscrreg(stderr_win, 0, PAD_H); scrollok(stderr_win, TRUE); wrefresh(_stderr); wrefresh(stderr_win); focus_win = stdout_win; mvwprintw(_stdout, 0, 2, "#"); update_panels(); refresh(); doupdate(); g_mutex_unlock(&curses_mutex); return 0; }
int setscrreg(int t, int b) { return (wsetscrreg(stdscr, t, b)); }
void clipboardTest(WINDOW *win) { static const char *text = "This string placed in clipboard by PDCurses test program, testcurs."; char *ptr = NULL; long i, length = 0; mvaddstr(1, 1, "This test will display the contents of the system clipboard"); Continue2(); scrollok(stdscr, TRUE); i = PDC_getclipboard(&ptr, &length); switch(i) { case PDC_CLIP_ACCESS_ERROR: mvaddstr(3, 1, "There was an error accessing the clipboard"); refresh(); break; case PDC_CLIP_MEMORY_ERROR: mvaddstr(3, 1, "Unable to allocate memory for clipboard contents"); break; case PDC_CLIP_EMPTY: mvaddstr(3, 1, "There was no text in the clipboard"); break; default: wsetscrreg(stdscr, 0, LINES - 1); clear(); mvaddstr(1, 1, "Clipboard contents..."); mvprintw(2, 1, "%s\n", ptr); } Continue2(); clear(); mvaddstr(1, 1, "This test will place the following string in the system clipboard:"); mvaddstr(2, 1, text); i = PDC_setclipboard(text, strlen(text)); switch(i) { case PDC_CLIP_ACCESS_ERROR: mvaddstr(3, 1, "There was an error accessing the clipboard"); break; case PDC_CLIP_MEMORY_ERROR: mvaddstr(3, 1, "Unable to allocate memory for clipboard contents"); break; default: mvaddstr(3, 1, "The string was placed in the clipboard successfully"); } Continue2(); }
/* MAIN Envoyer et recevoir des donnes Gere les fenetres du GUI */ int main (int argc, char* argv[]) { if ( argc < 2 ) { printf ("Usage: %s PORT\n", argv[0]); exit (EXIT_FAILURE); } initscr(); // Start curses mode cbreak(); // Line buffering disabled, Pass on everty thing to me //my_win = create_newwin(height, width, starty, startx); f_haut = definirFenetre( f_haut_hauteur, COLS, 0, 0 ); f_bas = definirFenetre( f_bas_hauteur, COLS, (LINES - f_bas_hauteur - marge_bas), 0 ); f_info = definirFenetre( f_info_hauteur, COLS, (LINES - donnerHauteur(f_bas) - f_info_hauteur - marge_bas), 0 ); f_cmd = definirFenetre( f_cmd_hauteur, COLS, (LINES - donnerHauteur(f_bas) - donnerHauteur(f_info) - marge_bas - f_cmd_hauteur), 0); f_chat = definirFenetre( (LINES - donnerHauteur(f_haut) - donnerHauteur(f_cmd) - donnerHauteur(f_info) - donnerHauteur(f_bas) - marge_bas), COLS, donnerHauteur(f_haut), 0 ); refresh(); w_haut = create_newwin_with_border( f_haut ); w_bas = create_newwin_no_border( f_bas ); w_info = create_newwin_with_border( f_info ); w_cmd = create_newwin_with_border( f_cmd ); w_chat = create_newwin_no_border( f_chat ); scrollok( w_chat, 1 ); wsetscrreg( w_chat, donnerStarty(f_chat), donnerHauteur(f_chat) ); wtimeout(w_bas, 500); mvwprintw(w_haut, 1, 1, "CHAT CLIENT"); mvwprintw(w_cmd, 1, 1, ""); mvwprintw(w_info, 1, 1, "/nom usager\t/mp usager msg\t/creer groupe type\t/info groupe\t\t/accept usager groupe"); mvwprintw(w_info, 2, 1, "\t\t/mg groupe msg\t/joindre groupe\t\t/liste usagers\t\t/refuser usager groupe"); mvwprintw(w_info, 3, 1, "/quitter\t\t\t/byebye groupe\t\t/liste groupes\t\t/stats groupe"); wmove( w_bas, 0, 0 ); wrefresh(w_haut); wrefresh(w_info); wrefresh(w_bas); wrefresh(w_cmd); struct sockaddr_in serveur; struct hostent* hp; socket_d = socket (AF_INET, SOCK_STREAM, 0); if (socket_d < 0) { endwin(); printf("Erreur lors de la création de la socket !\n"); return 1; } setnonblocking (socket_d); hp = gethostbyname("localhost"); if (hp==0) { endwin(); close (socket_d); printf("Hôte inconnu!\n"); return 2; } serveur.sin_family = AF_INET; serveur.sin_port = htons(atoi(argv[1])); bcopy((char *)hp->h_addr, (char *)&serveur.sin_addr, hp->h_length); if ( connect(socket_d,(struct sockaddr *)&serveur,sizeof(struct sockaddr_in)) < 0 ) { endwin(); close (socket_d); printf("Erreur lors de la création d'une nouvelle connexion !\n"); return 3; } nom_usager_defini = 0; input = chaineCreerVide( COLS ); while ( 1 ) { key_handler(); if ( ! recv_handler() ) break; } endwin (); close (socket_d); return 0; }
int t_wsetscrreg(t_window *win, int top, int bottom) { return wsetscrreg(win, top, bottom); }
//------------------------------------------------------------------------------ int setscrreg( int top, int bottom ) { __QCS_FCONTEXT( "setscrreg" ); return wsetscrreg( stdscr, top, bottom ); }
EIF_INTEGER c_ecurses_wsetscrreg (EIF_POINTER p, EIF_INTEGER top, EIF_INTEGER bottom) { return wsetscrreg( (WINDOW *) p , (int) top, (int) bottom) ; };
NCURSES_EXPORT(int) (setscrreg) (int a1, int z) { T((T_CALLED("setscrreg(%d,%d)"), a1, z)); returnCode(wsetscrreg(stdscr,a1,z)); }