+ struct winsize ws;
+
+ /* dimensions */
+ if(ioctl(1,TIOCGWINSZ,&ws)==-1) {
+ perror("[display] ioctl call");
+ return D_ERROR;
+ }
+ display->max_x=ws.ws_col;
+ display->max_y=ws.ws_row;
+
+ printf("[display] initializing display, width: %02d / height: %02d ...\n",
+ ws.ws_col,ws.ws_row);
+
+ /* allocating 'screen' buffer */
+ if((display->screen=(unsigned char *)malloc(display->max_x*display->max_y))
+ ==NULL) {
+ perror("[display] malloc call");
+ return D_ERROR;
+ }
+ /* space as display pixel default */
+ memset(display->screen,0x20,display->max_x*display->max_y);
+
+#ifdef USE_NCURSES
+ initscr();
+ nonl();
+ noecho();
+ cbreak();
+ curs_set(0);
+#endif
+
+ return D_SUCCESS;
+}