AppUtil.cpp File Reference
#include <cstdio>
#include <cstdlib>
#include <signal.h>
#include <unistd.h>
#include <termios.h>
#include <sys/ioctl.h>
#include <ctype.h>
#include <time.h>
#include "AppUtil.hpp"
#include "CubitMessage.hpp"
#include "CubitString.hpp"
#include "CubitObserver.hpp"
#include "SettingHandler.hpp"
#include "StubProgressTool.hpp"
#include <sys/resource.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <dlfcn.h>
#include "CubitUtil.hpp"

Go to the source code of this file.


#define PATH_MAX   _MAX_PATH


void cubit_update_terminal_size (int)
void sigint_handler (int)


static volatile CubitBoolean cubit_intr = CUBIT_FALSE

Define Documentation

#define PATH_MAX   _MAX_PATH

Definition at line 67 of file AppUtil.cpp.

Function Documentation

Definition at line 114 of file AppUtil.cpp.

#if defined(_WIN32)

  HANDLE h_stdout = GetStdHandle(STD_OUTPUT_HANDLE);
  if (GetConsoleScreenBufferInfo(h_stdout, &scr_info))
        // dwSize.Y is will return the height of the scroll-back buffer.
        // srWindow contains the position of the visible rect of the
        // window in the buffer.  That is the height of the window.
      scr_info.srWindow.Bottom - scr_info.srWindow.Top,
        // use width of scroll buffer rather than size of window
        // for number of columns.  The window size is useless as
        // caller would need to know the offset in the X direction
        // to make use of it and we aren't returning that.  Besides,
        // the user presumably set the scroll buffer to this width
        // because that's the line length (s)he wants.

#elif defined(TIOCGWINSZ)

    // On UNIX platforms, register this function as a handler for
    // SIGWINCH.  The system will then call this function any time
    // the user changes the size of the terminal window.
  signal( SIGWINCH, &cubit_update_terminal_size );

  const int file = fileno(stdout);
  struct winsize size;
  if( ioctl( file, TIOCGWINSZ, (char*)&size ) == 0 )
    AppUtil::instance()->set_terminal_size( size.ws_row, size.ws_col );

void sigint_handler ( int  )

Definition at line 306 of file AppUtil.cpp.

  if( signal( SIGINT, sigint_handler ) == SIG_ERR )
    PRINT_ERROR("Cannot continue to catch SIGINT!\n");
  cubit_intr = CUBIT_TRUE;

Variable Documentation

volatile CubitBoolean cubit_intr = CUBIT_FALSE [static]

Definition at line 112 of file AppUtil.cpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines