Patch from Timothy Schepens <tischepe@fastmail.fm>:
This is a patch to let more use the window size instead of the buffer size.

sort.c: fixed qsort warning

svn path=/trunk/; revision=6421
This commit is contained in:
Vizzini 2003-10-23 21:36:43 +00:00
parent 6a031188f2
commit 15fc6ff3af
2 changed files with 6 additions and 6 deletions

View file

@ -5,6 +5,8 @@
* *
* 26 Sep 1999 - Paolo Pantaleo <paolopan@freemail.it> * 26 Sep 1999 - Paolo Pantaleo <paolopan@freemail.it>
* started * started
* Oct 2003 - Timothy Schepens <tischepe at fastmail dot fm>
* use window size instead of buffer size.
*/ */
#include <windows.h> #include <windows.h>
@ -29,11 +31,9 @@ GetScreenSize (PSHORT maxx, PSHORT maxy)
CONSOLE_SCREEN_BUFFER_INFO csbi; CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo (hStdOut, &csbi); GetConsoleScreenBufferInfo (hStdOut, &csbi);
*maxx = csbi.srWindow.Right;
*maxy = csbi.srWindow.Bottom;
if (maxx)
*maxx = csbi.dwSize.X;
if (maxy)
*maxy = csbi.dwSize.Y;
} }
@ -126,7 +126,7 @@ int main (int argc, char **argv)
{ {
ch_count=0; ch_count=0;
line_count++; line_count++;
if (line_count == maxy-1) if (line_count == maxy)
{ {
line_count = 0; line_count = 0;
WriteFile(hStdOut,&buff[last], i-last+1, &dwWritten, NULL); WriteFile(hStdOut,&buff[last], i-last+1, &dwWritten, NULL);

View file

@ -34,7 +34,7 @@ int sortcol; /* sort column */
int err = 0; /* error counter */ int err = 0; /* error counter */
int int
cmpr(void *a, void *b) cmpr(const void *a, const void *b)
{ {
char *A, *B; char *A, *B;