/*++ Copyright (c) 1991 Microsoft Corporation Module Name: ws.c Abstract: Utility program to set both the console window size and buffer size. Author: Steve Wood (stevewo) 01-Feb-1992 Revision History: --*/ #include #include #include #include #include #include void Usage() { printf("Usage: ws [-w WindowColumns,WindowRows][-b BufferColumns,BufferRows]\n"); exit(1); } _CRTAPI1 main( argc, argv ) int argc; char *argv[]; { int i; char *s; HANDLE ScreenHandle; DWORD WindowRows,WindowColumns; DWORD BufferRows,BufferColumns; COORD BufferSize; CONSOLE_SCREEN_BUFFER_INFO sbi; SMALL_RECT WindowSize; COORD LargestScreenSize; USHORT MaxRows; USHORT MaxCols; ScreenHandle = GetStdHandle(STD_OUTPUT_HANDLE); if (!GetConsoleScreenBufferInfo( ScreenHandle, &sbi )) { fprintf( stderr, "WS: Unable to read current console mode.\n" ); exit( 1 ); } BufferRows = sbi.dwSize.Y; BufferColumns = sbi.dwSize.X; WindowRows = sbi.srWindow.Bottom - sbi.srWindow.Top + 1; WindowColumns = sbi.srWindow.Right - sbi.srWindow.Left + 1; LargestScreenSize = GetLargestConsoleWindowSize( ScreenHandle ); try { for (i=1; i