remove trailing whitespace at end of lines

svn path=/trunk/; revision=15091
This commit is contained in:
Steven Edwards 2005-05-07 21:24:31 +00:00
parent 1c29a40c45
commit 456be5d16b
385 changed files with 5481 additions and 5481 deletions

View file

@ -32,7 +32,7 @@
#define NUM_ELEMENTS(a) (sizeof(a)/sizeof(a[0])) #define NUM_ELEMENTS(a) (sizeof(a)/sizeof(a[0]))
#define ASSERT(a) #define ASSERT(a)
const TCHAR* const usage_strings[] = { const TCHAR* const usage_strings[] = {
_T("Device Status: MODE [device] [/STATUS]"), _T("Device Status: MODE [device] [/STATUS]"),
_T("Select code page: MODE CON[:] CP SELECT=yyy"), _T("Select code page: MODE CON[:] CP SELECT=yyy"),
_T("Code page status: MODE CON[:] CP [/STATUS]"), _T("Code page status: MODE CON[:] CP [/STATUS]"),
@ -45,7 +45,7 @@ const TCHAR* const usage_strings[] = {
_T(" [rts=on|off|hs|tg] [idsr=on|off]"), _T(" [rts=on|off|hs|tg] [idsr=on|off]"),
}; };
const TCHAR* const parity_strings[] = { const TCHAR* const parity_strings[] = {
_T("None"), // default _T("None"), // default
_T("Odd"), // only symbol in this set to have a 'd' in it _T("Odd"), // only symbol in this set to have a 'd' in it
_T("Even"), // ... 'v' in it _T("Even"), // ... 'v' in it
@ -75,7 +75,7 @@ int QueryDevices()
TCHAR buffer[10240]; TCHAR buffer[10240];
int len; int len;
TCHAR* ptr = buffer; TCHAR* ptr = buffer;
*ptr = '\0'; *ptr = '\0';
if (QueryDosDevice(NULL, buffer, NUM_ELEMENTS(buffer))) { if (QueryDosDevice(NULL, buffer, NUM_ELEMENTS(buffer))) {
while (*ptr != '\0') { while (*ptr != '\0') {
@ -146,7 +146,7 @@ int ShowConsoleStatus()
return 0; return 0;
} }
static static
BOOL SerialPortQuery(int nPortNum, LPDCB pDCB, LPCOMMTIMEOUTS pCommTimeouts, BOOL bWrite) BOOL SerialPortQuery(int nPortNum, LPDCB pDCB, LPCOMMTIMEOUTS pCommTimeouts, BOOL bWrite)
{ {
BOOL result; BOOL result;
@ -270,7 +270,7 @@ int SetConsoleState()
return 0; return 0;
} }
static static
int ExtractModeSerialParams(const TCHAR* param) int ExtractModeSerialParams(const TCHAR* param)
{ {
if ( _tcsstr(param, _T("OFF"))) { if ( _tcsstr(param, _T("OFF"))) {
@ -428,7 +428,7 @@ int main(int argc, TCHAR *argv[])
goto show_status; goto show_status;
} else if (_tcsstr(param1, _T("lpt"))) { } else if (_tcsstr(param1, _T("lpt"))) {
nPortNum = find_portnum(param1); nPortNum = find_portnum(param1);
if (nPortNum != -1) if (nPortNum != -1)
return ShowParallelStatus(nPortNum); return ShowParallelStatus(nPortNum);
} else if (_tcsstr(param1, _T("con"))) { } else if (_tcsstr(param1, _T("con"))) {
return ShowConsoleStatus(); return ShowConsoleStatus();

View file

@ -1,10 +1,10 @@
/* /*
* MORE.C - external command. * MORE.C - external command.
* *
* clone from 4nt more command * clone from 4nt more command
* *
* 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> * Oct 2003 - Timothy Schepens <tischepe at fastmail dot fm>
* use window size instead of buffer size. * use window size instead of buffer size.
*/ */

View file

@ -1,10 +1,10 @@
/* /*
* TEE.C - external command. * TEE.C - external command.
* *
* clone from 4nt tee command * clone from 4nt tee command
* *
* 01 Sep 1999 - Paolo Pantaleo <paolopan@freemail.it> * 01 Sep 1999 - Paolo Pantaleo <paolopan@freemail.it>
* started * started
* *
* *
*/ */
@ -69,7 +69,7 @@ INT main (int argc,char **p)
/*handle for file and console*/ /*handle for file and console*/
HANDLE hConsoleIn,hConsoleOut; HANDLE hConsoleIn,hConsoleOut;
/*bytes written by WriteFile and ReadFile*/ /*bytes written by WriteFile and ReadFile*/
DWORD dwRead,dwWritten; DWORD dwRead,dwWritten;
@ -82,7 +82,7 @@ INT main (int argc,char **p)
INT i; INT i;
BOOL bQuote; BOOL bQuote;
/*file list implementation*/ /*file list implementation*/
LPTSTR *files; LPTSTR *files;
INT iFileCounter=0; INT iFileCounter=0;
HANDLE *hFile; HANDLE *hFile;
@ -140,7 +140,7 @@ INT main (int argc,char **p)
/* /*
if( iFileCounter >= sizeof(files) / sizeof(*files) ) if( iFileCounter >= sizeof(files) / sizeof(*files) )
{ {
ConErrPrintf("too many files, maximum is %d\n",sizeof(files) / sizeof(*files)); ConErrPrintf("too many files, maximum is %d\n",sizeof(files) / sizeof(*files));
return 1; return 1;
} }
*/ */
@ -150,7 +150,7 @@ INT main (int argc,char **p)
/*open file(s)*/ /*open file(s)*/
for(i=0;i<iFileCounter;i++) for(i=0;i<iFileCounter;i++)
{ {
//l=0; //l=0;
hFile[i] = CreateFile(files[i],GENERIC_WRITE, hFile[i] = CreateFile(files[i],GENERIC_WRITE,
0,NULL, 0,NULL,

View file

@ -204,10 +204,10 @@ stime_arg1(char *arg, time_t *tvp)
{ {
struct tm *t; struct tm *t;
int yearset; int yearset;
char *p; char *p;
/* Start with the current time. */ /* Start with the current time. */
if ((t = localtime(&tvp[0])) == NULL) if ((t = localtime(&tvp[0])) == NULL)
err(1, "localtime"); DbgPrint("[%s]", "[23]"); err(1, "localtime"); DbgPrint("[%s]", "[23]");
/* [[CC]YY]MMDDhhmm[.SS] */ /* [[CC]YY]MMDDhhmm[.SS] */
if ((p = strchr(arg, '.')) == NULL) if ((p = strchr(arg, '.')) == NULL)
t->tm_sec = 0; /* Seconds defaults to 0. */ t->tm_sec = 0; /* Seconds defaults to 0. */
@ -217,7 +217,7 @@ stime_arg1(char *arg, time_t *tvp)
*p++ = '\0'; *p++ = '\0';
t->tm_sec = ATOI2(p); t->tm_sec = ATOI2(p);
} }
yearset = 0; yearset = 0;
switch(strlen(arg)) { switch(strlen(arg)) {
case 12: /* CCYYMMDDhhmm */ case 12: /* CCYYMMDDhhmm */

View file

@ -80,7 +80,7 @@ int main (int argc, char **argv)
for (i = 1; i < argc; i++) for (i = 1; i < argc; i++)
{ {
hFind=FindFirstFile(argv[i],&FindData); hFind=FindFirstFile(argv[i],&FindData);
if (hFind==INVALID_HANDLE_VALUE) if (hFind==INVALID_HANDLE_VALUE)
{ {
ConErrPrintf("File not found - %s\n",argv[i]); ConErrPrintf("File not found - %s\n",argv[i]);
@ -107,7 +107,7 @@ int main (int argc, char **argv)
if (dwRead>0 && bRet) if (dwRead>0 && bRet)
WriteFile(hConsoleOut,buff,dwRead,&dwWritten,NULL); WriteFile(hConsoleOut,buff,dwRead,&dwWritten,NULL);
} while(dwRead>0 && bRet); } while(dwRead>0 && bRet);
CloseHandle(hFile); CloseHandle(hFile);

View file

@ -13,36 +13,36 @@
* screenhack stuff. There's still some work that could * screenhack stuff. There's still some work that could
* be done on this, particularly allowing a resource to * be done on this, particularly allowing a resource to
* specify how big the squares are. * specify how big the squares are.
* modified: [ 10-4-88 ] Richard Hess ...!uunet!cimshop!rhess * modified: [ 10-4-88 ] Richard Hess ...!uunet!cimshop!rhess
* [ Revised primary execution loop within main()... * [ Revised primary execution loop within main()...
* [ Extended X event handler, check_events()... * [ Extended X event handler, check_events()...
* modified: [ 1-29-88 ] Dave Lemke lemke@sun.com * modified: [ 1-29-88 ] Dave Lemke lemke@sun.com
* [ Hacked for X11... * [ Hacked for X11...
* [ Note the word "hacked" -- this is extremely ugly, but at * [ Note the word "hacked" -- this is extremely ugly, but at
* [ least it does the job. NOT a good programming example * [ least it does the job. NOT a good programming example
* [ for X. * [ for X.
* original: [ 6/21/85 ] Martin Weiss Sun Microsystems [ SunView ] * original: [ 6/21/85 ] Martin Weiss Sun Microsystems [ SunView ]
* *
****************************************************************************** ******************************************************************************
Copyright 1988 by Sun Microsystems, Inc. Mountain View, CA. Copyright 1988 by Sun Microsystems, Inc. Mountain View, CA.
All Rights Reserved All Rights Reserved
Permission to use, copy, modify, and distribute this software and its Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted, documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Sun or MIT not be supporting documentation, and that the names of Sun or MIT not be
used in advertising or publicity pertaining to distribution of the used in advertising or publicity pertaining to distribution of the
software without specific prior written permission. Sun and M.I.T. software without specific prior written permission. Sun and M.I.T.
make no representations about the suitability of this software for make no representations about the suitability of this software for
any purpose. It is provided "as is" without any express or implied warranty. any purpose. It is provided "as is" without any express or implied warranty.
SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. IN NO EVENT SHALL SUN BE LIABLE FOR ANY SPECIAL, INDIRECT PURPOSE. IN NO EVENT SHALL SUN BE LIABLE FOR ANY SPECIAL, INDIRECT
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
OR PERFORMANCE OF THIS SOFTWARE. OR PERFORMANCE OF THIS SOFTWARE.
*****************************************************************************/ *****************************************************************************/
@ -115,7 +115,7 @@ static struct {
unsigned char x; unsigned char x;
unsigned char y; unsigned char y;
unsigned char dir; unsigned char dir;
unsigned char dummy; unsigned char dummy;
} move_list[MOVE_LIST_SIZE], save_path[MOVE_LIST_SIZE], path[MOVE_LIST_SIZE]; } move_list[MOVE_LIST_SIZE], save_path[MOVE_LIST_SIZE], path[MOVE_LIST_SIZE];
static int maze_size_x, maze_size_y; static int maze_size_x, maze_size_y;
@ -139,50 +139,50 @@ static void
initialize_maze() /* draw the surrounding wall and start/end squares */ initialize_maze() /* draw the surrounding wall and start/end squares */
{ {
register int i, j, wall; register int i, j, wall;
/* initialize all squares */ /* initialize all squares */
for ( i=0; i<maze_size_x; i++) { for ( i=0; i<maze_size_x; i++) {
for ( j=0; j<maze_size_y; j++) { for ( j=0; j<maze_size_y; j++) {
maze[i][j] = 0; maze[i][j] = 0;
} }
} }
/* top wall */ /* top wall */
for ( i=0; i<maze_size_x; i++ ) { for ( i=0; i<maze_size_x; i++ ) {
maze[i][0] |= WALL_TOP; maze[i][0] |= WALL_TOP;
} }
/* right wall */ /* right wall */
for ( j=0; j<maze_size_y; j++ ) { for ( j=0; j<maze_size_y; j++ ) {
maze[maze_size_x-1][j] |= WALL_RIGHT; maze[maze_size_x-1][j] |= WALL_RIGHT;
} }
/* bottom wall */ /* bottom wall */
for ( i=0; i<maze_size_x; i++ ) { for ( i=0; i<maze_size_x; i++ ) {
maze[i][maze_size_y-1] |= WALL_BOTTOM; maze[i][maze_size_y-1] |= WALL_BOTTOM;
} }
/* left wall */ /* left wall */
for ( j=0; j<maze_size_y; j++ ) { for ( j=0; j<maze_size_y; j++ ) {
maze[0][j] |= WALL_LEFT; maze[0][j] |= WALL_LEFT;
} }
/* set start square */ /* set start square */
wall = get_random(4); wall = get_random(4);
switch (wall) { switch (wall) {
case 0: case 0:
i = get_random(maze_size_x); i = get_random(maze_size_x);
j = 0; j = 0;
break; break;
case 1: case 1:
i = maze_size_x - 1; i = maze_size_x - 1;
j = get_random(maze_size_y); j = get_random(maze_size_y);
break; break;
case 2: case 2:
i = get_random(maze_size_x); i = get_random(maze_size_x);
j = maze_size_y - 1; j = maze_size_y - 1;
break; break;
case 3: case 3:
i = 0; i = 0;
j = get_random(maze_size_y); j = get_random(maze_size_y);
break; break;
@ -196,7 +196,7 @@ initialize_maze() /* draw the surrounding wall and start/end squares */
start_y = j; start_y = j;
start_dir = wall; start_dir = wall;
sqnum = 0; sqnum = 0;
/* set end square */ /* set end square */
wall = (wall + 2)%4; wall = (wall + 2)%4;
switch (wall) { switch (wall) {
@ -236,7 +236,7 @@ create_maze() /* create a maze layout given the intiialized maze */
{ {
register int i, newdoor = 0; register int i, newdoor = 0;
HDC hDC; HDC hDC;
hDC = GetDC(hWnd); hDC = GetDC(hWnd);
do { do {
move_list[sqnum].x = cur_sq_x; move_list[sqnum].x = cur_sq_x;
@ -248,10 +248,10 @@ create_maze() /* create a maze layout given the intiialized maze */
return; /* done ... return */ return; /* done ... return */
} }
} }
/* mark the out door */ /* mark the out door */
maze[cur_sq_x][cur_sq_y] |= ( DOOR_OUT_TOP >> newdoor ); maze[cur_sq_x][cur_sq_y] |= ( DOOR_OUT_TOP >> newdoor );
switch (newdoor) { switch (newdoor) {
case 0: cur_sq_y--; case 0: cur_sq_y--;
break; break;
@ -263,10 +263,10 @@ create_maze() /* create a maze layout given the intiialized maze */
break; break;
} }
sqnum++; sqnum++;
/* mark the in door */ /* mark the in door */
maze[cur_sq_x][cur_sq_y] |= ( DOOR_IN_TOP >> ((newdoor+2)%4) ); maze[cur_sq_x][cur_sq_y] |= ( DOOR_IN_TOP >> ((newdoor+2)%4) );
/* if end square set path length and save path */ /* if end square set path length and save path */
if ( maze[cur_sq_x][cur_sq_y] & END_SQUARE ) { if ( maze[cur_sq_x][cur_sq_y] & END_SQUARE ) {
path_length = sqnum; path_length = sqnum;
@ -276,9 +276,9 @@ create_maze() /* create a maze layout given the intiialized maze */
save_path[i].dir = move_list[i].dir; save_path[i].dir = move_list[i].dir;
} }
} }
} while (1); } while (1);
} }
@ -287,9 +287,9 @@ choose_door(HDC hDC) /* pick a new path */
{ {
int candidates[3]; int candidates[3];
register int num_candidates; register int num_candidates;
num_candidates = 0; num_candidates = 0;
/* top wall */ /* top wall */
if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_TOP ) if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_TOP )
goto rightwall; goto rightwall;
@ -304,7 +304,7 @@ choose_door(HDC hDC) /* pick a new path */
goto rightwall; goto rightwall;
} }
candidates[num_candidates++] = 0; candidates[num_candidates++] = 0;
rightwall: rightwall:
/* right wall */ /* right wall */
if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_RIGHT ) if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_RIGHT )
@ -320,7 +320,7 @@ choose_door(HDC hDC) /* pick a new path */
goto bottomwall; goto bottomwall;
} }
candidates[num_candidates++] = 1; candidates[num_candidates++] = 1;
bottomwall: bottomwall:
/* bottom wall */ /* bottom wall */
if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_BOTTOM ) if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_BOTTOM )
@ -336,7 +336,7 @@ choose_door(HDC hDC) /* pick a new path */
goto leftwall; goto leftwall;
} }
candidates[num_candidates++] = 2; candidates[num_candidates++] = 2;
leftwall: leftwall:
/* left wall */ /* left wall */
if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_LEFT ) if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_LEFT )
@ -352,14 +352,14 @@ choose_door(HDC hDC) /* pick a new path */
goto donewall; goto donewall;
} }
candidates[num_candidates++] = 3; candidates[num_candidates++] = 3;
donewall: donewall:
if (num_candidates == 0) if (num_candidates == 0)
return ( -1 ); return ( -1 );
if (num_candidates == 1) if (num_candidates == 1)
return ( candidates[0] ); return ( candidates[0] );
return ( candidates[ get_random(num_candidates) ] ); return ( candidates[ get_random(num_candidates) ] );
} }
@ -385,19 +385,19 @@ draw_solid_square(i, j, dir, hDC, hBrush) /* draw a solid square in a s
RECT rc; RECT rc;
switch (dir) { switch (dir) {
case 0: case 0:
rc.left = border_x + bw + grid_width * i; rc.left = border_x + bw + grid_width * i;
rc.right = rc.left + grid_width - (bw + bw); rc.right = rc.left + grid_width - (bw + bw);
rc.top = border_y - bw + grid_height * j; rc.top = border_y - bw + grid_height * j;
rc.bottom = rc.top + grid_height; rc.bottom = rc.top + grid_height;
break; break;
case 1: case 1:
rc.left = border_x + bw + grid_width * i; rc.left = border_x + bw + grid_width * i;
rc.right = rc.left + grid_width; rc.right = rc.left + grid_width;
rc.top = border_y + bw + grid_height * j; rc.top = border_y + bw + grid_height * j;
rc.bottom = rc.top + grid_height - (bw + bw); rc.bottom = rc.top + grid_height - (bw + bw);
break; break;
case 2: case 2:
rc.left = border_x + bw + grid_width * i; rc.left = border_x + bw + grid_width * i;
rc.right = rc.left + grid_width - (bw + bw); rc.right = rc.left + grid_width - (bw + bw);
rc.top = border_y + bw + grid_height * j; rc.top = border_y + bw + grid_height * j;
@ -418,8 +418,8 @@ draw_maze_border(HWND hWnd, HDC hDC) /* draw the maze outline */
{ {
register int i, j; register int i, j;
HBRUSH hBrush; HBRUSH hBrush;
for ( i=0; i<maze_size_x; i++) { for ( i=0; i<maze_size_x; i++) {
if ( maze[i][0] & WALL_TOP ) { if ( maze[i][0] & WALL_TOP ) {
MoveToEx(hDC, border_x + grid_width * i, border_y, NULL); MoveToEx(hDC, border_x + grid_width * i, border_y, NULL);
@ -459,7 +459,7 @@ draw_wall(i, j, dir, hDC) /* draw a single wal
switch (dir) { switch (dir) {
case 0: case 0:
MoveToEx(hDC, border_x + grid_width * i, border_y + grid_height * j, NULL); MoveToEx(hDC, border_x + grid_width * i, border_y + grid_height * j, NULL);
(void) LineTo(hDC, border_x + grid_width * (i+1), (void) LineTo(hDC, border_x + grid_width * (i+1),
border_y + grid_height * j); border_y + grid_height * j);
break; break;
case 1: case 1:
@ -471,13 +471,13 @@ draw_wall(i, j, dir, hDC) /* draw a single wal
case 2: case 2:
MoveToEx(hDC, border_x + grid_width * i, border_y + grid_height * (j+1), MoveToEx(hDC, border_x + grid_width * i, border_y + grid_height * (j+1),
NULL); NULL);
(void) LineTo(hDC, border_x + grid_width * (i+1), (void) LineTo(hDC, border_x + grid_width * (i+1),
border_y + grid_height * (j+1)); border_y + grid_height * (j+1));
break; break;
case 3: case 3:
MoveToEx(hDC, border_x + grid_width * i, border_y + grid_height * j, MoveToEx(hDC, border_x + grid_width * i, border_y + grid_height * j,
NULL); NULL);
(void) LineTo(hDC, border_x + grid_width * i, (void) LineTo(hDC, border_x + grid_width * i,
border_y + grid_height * (j+1)); border_y + grid_height * (j+1));
break; break;
} }
@ -497,11 +497,11 @@ begin_solve_maze() /* solve it with graphical feedba
0xaaaaaaaa 0xaaaaaaaa
}; };
static RGBQUAD argbq[] = { static RGBQUAD argbq[] = {
{ 0, 0, 255, 0 }, { 0, 0, 255, 0 },
{ 255, 255, 255, 0 } { 255, 255, 255, 0 }
}; };
BITMAPINFO *pbmi; BITMAPINFO *pbmi;
hDC = GetDC(hWnd); hDC = GetDC(hWnd);
pbmi = malloc(sizeof(BITMAPINFOHEADER) + sizeof(argbq) + sizeof(grayPattern)); pbmi = malloc(sizeof(BITMAPINFOHEADER) + sizeof(argbq) + sizeof(grayPattern));
pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
@ -525,31 +525,31 @@ begin_solve_maze() /* solve it with graphical feedba
/* plug up the surrounding wall */ /* plug up the surrounding wall */
maze[start_x][start_y] |= (WALL_TOP >> start_dir); maze[start_x][start_y] |= (WALL_TOP >> start_dir);
maze[end_x][end_y] |= (WALL_TOP >> end_dir); maze[end_x][end_y] |= (WALL_TOP >> end_dir);
/* initialize search path */ /* initialize search path */
pathi = 0; pathi = 0;
path[pathi].x = end_x; path[pathi].x = end_x;
path[pathi].y = end_y; path[pathi].y = end_y;
path[pathi].dir = -1; path[pathi].dir = -1;
} }
static int static int
solve_maze() /* solve it with graphical feedback */ solve_maze() /* solve it with graphical feedback */
{ {
int ret; int ret;
int action_done; int action_done;
do { do {
action_done = 1; action_done = 1;
if ( ++path[pathi].dir >= 4 ) { if ( ++path[pathi].dir >= 4 ) {
pathi--; pathi--;
draw_solid_square( (int)(path[pathi].x), (int)(path[pathi].y), draw_solid_square( (int)(path[pathi].x), (int)(path[pathi].y),
(int)(path[pathi].dir), hDC, hBrushDead); (int)(path[pathi].dir), hDC, hBrushDead);
ret = 0; ret = 0;
} }
else if ( ! (maze[path[pathi].x][path[pathi].y] & else if ( ! (maze[path[pathi].x][path[pathi].y] &
(WALL_TOP >> path[pathi].dir)) && (WALL_TOP >> path[pathi].dir)) &&
( (pathi == 0) || ( (path[pathi].dir != ( (pathi == 0) || ( (path[pathi].dir !=
(int)(path[pathi-1].dir+2)%4) ) ) ) { (int)(path[pathi-1].dir+2)%4) ) ) ) {
enter_square(pathi, hDC, hBrushLiving); enter_square(pathi, hDC, hBrushLiving);
pathi++; pathi++;
@ -567,15 +567,15 @@ solve_maze() /* solve it with graphical feedback */
} while (! action_done); } while (! action_done);
return ret; return ret;
} }
static void static void
enter_square(int n, HDC hDC, HBRUSH hBrush) /* move into a neighboring square */ enter_square(int n, HDC hDC, HBRUSH hBrush) /* move into a neighboring square */
{ {
draw_solid_square( (int)path[n].x, (int)path[n].y, draw_solid_square( (int)path[n].x, (int)path[n].y,
(int)path[n].dir, hDC, hBrush); (int)path[n].dir, hDC, hBrush);
path[n+1].dir = -1; path[n+1].dir = -1;
switch (path[n].dir) { switch (path[n].dir) {
case 0: path[n+1].x = path[n].x; case 0: path[n+1].x = path[n].x;

View file

@ -4,7 +4,7 @@
// //
// Next default values for new objects // Next default values for new objects
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS

View file

@ -23,7 +23,7 @@
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h> #include <windows.h>
#include <tchar.h> #include <tchar.h>
#include "main.h" #include "main.h"
#include "framewnd.h" #include "framewnd.h"

View file

@ -25,7 +25,7 @@
#include <tchar.h> #include <tchar.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "main.h" #include "main.h"
#include "framewnd.h" #include "framewnd.h"
@ -109,7 +109,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
// Initialize global strings // Initialize global strings
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadString(hInstance, IDC_ZOOMIN, szFrameClass, MAX_LOADSTRING); LoadString(hInstance, IDC_ZOOMIN, szFrameClass, MAX_LOADSTRING);
// Store instance handle in our global variable // Store instance handle in our global variable
hInst = hInstance; hInst = hInstance;

View file

@ -81,7 +81,7 @@ static void AddStatusMsg(DFWINDOW wnd, DF_PARAM p1)
if (wnd->StatusBar != NULL) { if (wnd->StatusBar != NULL) {
if (p1 && *(char *)p1) if (p1 && *(char *)p1)
DfSendMessage(wnd->StatusBar, DFM_SETTEXT, p1, 0); DfSendMessage(wnd->StatusBar, DFM_SETTEXT, p1, 0);
else else
DfSendMessage(wnd->StatusBar, DFM_CLEARTEXT, 0, 0); DfSendMessage(wnd->StatusBar, DFM_CLEARTEXT, 0, 0);
DfSendMessage(wnd->StatusBar, DFM_PAINT, 0, 0); DfSendMessage(wnd->StatusBar, DFM_PAINT, 0, 0);
} }
@ -95,7 +95,7 @@ static void SetFocusMsg(DFWINDOW wnd, BOOL p1)
DfInFocus = p1 ? wnd : NULL; DfInFocus = p1 ? wnd : NULL;
if (DfIsVisible(wnd)) if (DfIsVisible(wnd))
DfSendMessage(wnd, DFM_BORDER, 0, 0); DfSendMessage(wnd, DFM_BORDER, 0, 0);
else else
DfSendMessage(wnd, DFM_SHOW_WINDOW, 0, 0); DfSendMessage(wnd, DFM_SHOW_WINDOW, 0, 0);
} }
@ -195,7 +195,7 @@ static void CommandMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2)
if (DfDialogBox(wnd, &Display, TRUE, NULL)) { if (DfDialogBox(wnd, &Display, TRUE, NULL)) {
if (DfInFocus == wnd->MenuBarWnd || DfInFocus == wnd->StatusBar) if (DfInFocus == wnd->MenuBarWnd || DfInFocus == wnd->StatusBar)
oldFocus = DfApplicationWindow; oldFocus = DfApplicationWindow;
else else
oldFocus = DfInFocus; oldFocus = DfInFocus;
DfSendMessage(wnd, DFM_HIDE_WINDOW, 0, 0); DfSendMessage(wnd, DFM_HIDE_WINDOW, 0, 0);
SelectColors(wnd); SelectColors(wnd);
@ -389,7 +389,7 @@ static char *WindowName(DFWINDOW wnd)
{ {
if (DfGetClass(wnd) == DF_DIALOG) if (DfGetClass(wnd) == DF_DIALOG)
return ((DF_DBOX *)(wnd->extension))->HelpName; return ((DF_DBOX *)(wnd->extension))->HelpName;
else else
return "Untitled"; return "Untitled";
} }
else else

View file

@ -7,7 +7,7 @@
* You must add entries to the DfColor tables in * You must add entries to the DfColor tables in
* DFCONFIG.C for new classes. * DFCONFIG.C for new classes.
* *
* Class Name Base Class Processor Attribute * Class Name Base Class Processor Attribute
* ------------ --------- --------------- ----------- * ------------ --------- --------------- -----------
*/ */
DfClassDef( DF_NORMAL, -1, DfNormalProc, 0 ) DfClassDef( DF_NORMAL, -1, DfNormalProc, 0 )

View file

@ -449,7 +449,7 @@ void DfBuildFileName(char *path, char *ext)
cp = strrchr(path, '\\'); cp = strrchr(path, '\\');
if (cp == NULL) if (cp == NULL)
cp = path; cp = path;
else else
cp++; cp++;
strcpy(cp, DFlatApplication); strcpy(cp, DFlatApplication);
strcat(cp, ext); strcat(cp, ext);

View file

@ -529,11 +529,11 @@ void DfSetScrollBars(DFWINDOW wnd)
int oldattr = DfGetAttribute(wnd); int oldattr = DfGetAttribute(wnd);
if (wnd->wlines > DfClientHeight(wnd)) if (wnd->wlines > DfClientHeight(wnd))
DfAddAttribute(wnd, DF_VSCROLLBAR); DfAddAttribute(wnd, DF_VSCROLLBAR);
else else
DfClearAttribute(wnd, DF_VSCROLLBAR); DfClearAttribute(wnd, DF_VSCROLLBAR);
if (wnd->textwidth > DfClientWidth(wnd)) if (wnd->textwidth > DfClientWidth(wnd))
DfAddAttribute(wnd, DF_HSCROLLBAR); DfAddAttribute(wnd, DF_HSCROLLBAR);
else else
DfClearAttribute(wnd, DF_HSCROLLBAR); DfClearAttribute(wnd, DF_HSCROLLBAR);
if (DfGetAttribute(wnd) != oldattr) if (DfGetAttribute(wnd) != oldattr)
DfSendMessage(wnd, DFM_BORDER, 0, 0); DfSendMessage(wnd, DFM_BORDER, 0, 0);
@ -643,15 +643,15 @@ static void FixColors(DFWINDOW wnd)
{ {
if (ct->class != DF_SPINBUTTON && ct->class != DF_COMBOBOX) if (ct->class != DF_SPINBUTTON && ct->class != DF_COMBOBOX)
{ {
wnd->WindowColors[DF_FRAME_COLOR][DF_FG] = wnd->WindowColors[DF_FRAME_COLOR][DF_FG] =
DfGetParent(wnd)->WindowColors[DF_FRAME_COLOR][DF_FG]; DfGetParent(wnd)->WindowColors[DF_FRAME_COLOR][DF_FG];
wnd->WindowColors[DF_FRAME_COLOR][DF_BG] = wnd->WindowColors[DF_FRAME_COLOR][DF_BG] =
DfGetParent(wnd)->WindowColors[DF_FRAME_COLOR][DF_BG]; DfGetParent(wnd)->WindowColors[DF_FRAME_COLOR][DF_BG];
if (ct->class != DF_EDITBOX && ct->class != DF_LISTBOX) if (ct->class != DF_EDITBOX && ct->class != DF_LISTBOX)
{ {
wnd->WindowColors[DF_STD_COLOR][DF_FG] = wnd->WindowColors[DF_STD_COLOR][DF_FG] =
DfGetParent(wnd)->WindowColors[DF_STD_COLOR][DF_FG]; DfGetParent(wnd)->WindowColors[DF_STD_COLOR][DF_FG];
wnd->WindowColors[DF_STD_COLOR][DF_BG] = wnd->WindowColors[DF_STD_COLOR][DF_BG] =
DfGetParent(wnd)->WindowColors[DF_STD_COLOR][DF_BG]; DfGetParent(wnd)->WindowColors[DF_STD_COLOR][DF_BG];
} }
} }

View file

@ -183,7 +183,7 @@ static int DlgFnOpen(DFWINDOW wnd,DFMESSAGE msg,DF_PARAM p1,DF_PARAM p2)
DfGetItemText(wnd, DF_ID_PATH, FileSpec, 65); DfGetItemText(wnd, DF_ID_PATH, FileSpec, 65);
strcat(FileSpec, FileName); strcat(FileSpec, FileName);
} }
else else
strcpy(FileSpec, FileName); strcpy(FileSpec, FileName);
} }
break; break;

View file

@ -398,7 +398,7 @@ static void FlipSelection(DFWINDOW wnd, int sel)
} }
static int ExtendSelections(DFWINDOW wnd, int sel, int shift) static int ExtendSelections(DFWINDOW wnd, int sel, int shift)
{ {
if (shift & (DF_LEFTSHIFT | DF_RIGHTSHIFT) && if (shift & (DF_LEFTSHIFT | DF_RIGHTSHIFT) &&
wnd->AnchorPoint != -1) { wnd->AnchorPoint != -1) {
int i = sel; int i = sel;

View file

@ -125,7 +125,7 @@ static int MemoPadProc(DFWINDOW wnd,DFMESSAGE msg,DF_PARAM p1,DF_PARAM p2)
case DF_ID_PRINT: case DF_ID_PRINT:
PrintPad(DfInFocus); PrintPad(DfInFocus);
return TRUE; return TRUE;
case DF_ID_EXIT: case DF_ID_EXIT:
if (!DfYesNoBox("Exit Memopad?")) if (!DfYesNoBox("Exit Memopad?"))
return FALSE; return FALSE;
break; break;
@ -144,7 +144,7 @@ static int MemoPadProc(DFWINDOW wnd,DFMESSAGE msg,DF_PARAM p1,DF_PARAM p2)
FixTabMenu(); FixTabMenu();
return TRUE; return TRUE;
case DF_ID_TAB6: case DF_ID_TAB6:
DfCfg.Tabs = 6; DfCfg.Tabs = 6;
FixTabMenu(); FixTabMenu();
return TRUE; return TRUE;
case DF_ID_TAB8: case DF_ID_TAB8:
@ -254,7 +254,7 @@ static void OpenPadWindow(DFWINDOW wnd, char *FileName)
} }
DfSendMessage(wwnd, DFM_CLOSE_WINDOW, 0, 0); DfSendMessage(wwnd, DFM_CLOSE_WINDOW, 0, 0);
DfSendMessage(wnd1, DFM_SETFOCUS, TRUE, 0); DfSendMessage(wnd1, DFM_SETFOCUS, TRUE, 0);
DfSendMessage(wnd1, DFM_MAXIMIZE, 0, 0); DfSendMessage(wnd1, DFM_MAXIMIZE, 0, 0);
} }
/* --- Load the notepad file into the editor text buffer --- */ /* --- Load the notepad file into the editor text buffer --- */
@ -414,7 +414,7 @@ static int EditorProc(DFWINDOW wnd,DFMESSAGE msg,DF_PARAM p1,DF_PARAM p2)
rtn = DfDefaultWndProc(wnd, msg, p1, p2); rtn = DfDefaultWndProc(wnd, msg, p1, p2);
if ((int)p1 == FALSE) if ((int)p1 == FALSE)
DfSendMessage(DfGetParent(wnd), DFM_ADDSTATUS, 0, 0); DfSendMessage(DfGetParent(wnd), DFM_ADDSTATUS, 0, 0);
else else
ShowPosition(wnd); ShowPosition(wnd);
return rtn; return rtn;
case DFM_KEYBOARD_CURSOR: case DFM_KEYBOARD_CURSOR:

View file

@ -49,7 +49,7 @@ typedef struct DfMenuBar {
#define DF_INACTIVE 1 #define DF_INACTIVE 1
#define DF_CHECKED 2 #define DF_CHECKED 2
#define DF_TOGGLE 4 #define DF_TOGGLE 4
#define DF_CASCADED 8 #define DF_CASCADED 8
/* --------- the standard menus ---------- */ /* --------- the standard menus ---------- */
extern DF_MBAR DfMainMenu; extern DF_MBAR DfMainMenu;

View file

@ -196,7 +196,7 @@ static void KeyboardMsg(DFWINDOW wnd, DF_PARAM p1)
if (mwnd != NULL) if (mwnd != NULL)
DfSendMessage(wnd, DFM_MB_SELECTION, DfSendMessage(wnd, DFM_MB_SELECTION,
DfActiveMenuBar->ActiveSelection, 0); DfActiveMenuBar->ActiveSelection, 0);
else else
DfSendMessage(wnd, DFM_PAINT, 0, 0); DfSendMessage(wnd, DFM_PAINT, 0, 0);
break; break;
case DF_BS: case DF_BS:
@ -207,7 +207,7 @@ static void KeyboardMsg(DFWINDOW wnd, DF_PARAM p1)
if (mwnd != NULL) if (mwnd != NULL)
DfSendMessage(wnd, DFM_MB_SELECTION, DfSendMessage(wnd, DFM_MB_SELECTION,
DfActiveMenuBar->ActiveSelection, 0); DfActiveMenuBar->ActiveSelection, 0);
else else
DfSendMessage(wnd, DFM_PAINT, 0, 0); DfSendMessage(wnd, DFM_PAINT, 0, 0);
break; break;
default: default:

View file

@ -593,7 +593,7 @@ BOOL DfDispatchMessage (void)
while (EventQueueCtr > 0) while (EventQueueCtr > 0)
{ {
struct events ev; struct events ev;
ev = EventQueue[EventQueueOffCtr]; ev = EventQueue[EventQueueOffCtr];
if (++EventQueueOffCtr == DF_MAXMESSAGES) if (++EventQueueOffCtr == DF_MAXMESSAGES)
EventQueueOffCtr = 0; EventQueueOffCtr = 0;

View file

@ -123,7 +123,7 @@ BOOL DfInputBox(DFWINDOW wnd,char *ttl,char *msg,char *text,int len)
InputText = text; InputText = text;
TextLength = len; TextLength = len;
InputBoxDB.dwnd.title = ttl; InputBoxDB.dwnd.title = ttl;
InputBoxDB.dwnd.w = 4 + InputBoxDB.dwnd.w = 4 +
max(20, max(len, max((int)strlen(ttl), (int)strlen(msg)))); max(20, max(len, max((int)strlen(ttl), (int)strlen(msg))));
InputBoxDB.ctl[1].dwnd.x = (InputBoxDB.dwnd.w-2-len)/2; InputBoxDB.ctl[1].dwnd.x = (InputBoxDB.dwnd.w-2-len)/2;
InputBoxDB.ctl[0].dwnd.w = strlen(msg); InputBoxDB.ctl[0].dwnd.w = strlen(msg);

View file

@ -74,7 +74,7 @@ static int FindVector(DFWINDOW wnd, DFRECT rc, int x, int y)
coll = 0; coll = 0;
else if (rc.lf+x == rcc.rt) else if (rc.lf+x == rcc.rt)
coll = 2; coll = 2;
else else
coll = 1; coll = 1;
} }
} }
@ -88,7 +88,7 @@ static int FindVector(DFWINDOW wnd, DFRECT rc, int x, int y)
coll = 0; coll = 0;
else if (rc.tp+y == rcc.bt) else if (rc.tp+y == rcc.bt)
coll = 2; coll = 2;
else else
coll = 1; coll = 1;
} }
} }

View file

@ -228,7 +228,7 @@ static BOOL KeyboardMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2)
case DF_F1: case DF_F1:
if (ActivePopDown == NULL) if (ActivePopDown == NULL)
DfSendMessage(DfGetParent(wnd), DFM_KEYBOARD, p1, p2); DfSendMessage(DfGetParent(wnd), DFM_KEYBOARD, p1, p2);
else else
DfDisplayHelp(wnd, DfDisplayHelp(wnd,
(ActivePopDown+wnd->selection)->help); (ActivePopDown+wnd->selection)->help);
return TRUE; return TRUE;

View file

@ -14,7 +14,7 @@ int DfStatusBarProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2)
if ((int)p1 == DF_CTRL_F4) if ((int)p1 == DF_CTRL_F4)
return TRUE; return TRUE;
break; break;
case DFM_PAINT: case DFM_PAINT:
if (!DfIsVisible(wnd)) if (!DfIsVisible(wnd))
break; break;
statusbar = DfCalloc(1, DfWindowWidth(wnd)+1); statusbar = DfCalloc(1, DfWindowWidth(wnd)+1);

View file

@ -45,7 +45,7 @@ void DfBuildSystemMenu(DFWINDOW wnd)
int lf, tp, ht, wd; int lf, tp, ht, wd;
DFWINDOW SystemMenuWnd; DFWINDOW SystemMenuWnd;
DfSystemMenu.PullDown[0].Selections[6].Accelerator = DfSystemMenu.PullDown[0].Selections[6].Accelerator =
(DfGetClass(wnd) == DF_APPLICATION) ? DF_ALT_F4 : DF_CTRL_F4; (DfGetClass(wnd) == DF_APPLICATION) ? DF_ALT_F4 : DF_CTRL_F4;
lf = DfGetLeft(wnd)+1; lf = DfGetLeft(wnd)+1;

View file

@ -713,7 +713,7 @@ void DfWriteTextLine(DFWINDOW wnd, DFRECT *rcc, int y, BOOL reverse)
if (*(lp+i) && i < wnd->wleft+3) { if (*(lp+i) && i < wnd->wleft+3) {
if (wnd->wleft+4 > lnlen) if (wnd->wleft+4 > lnlen)
trunc = TRUE; trunc = TRUE;
else else
lp += 4; lp += 4;
} }
else { else {

View file

@ -14,7 +14,7 @@
#define IDM_HELP_ABOUT 40006 #define IDM_HELP_ABOUT 40006
// Next default values for new objects // Next default values for new objects
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 105 #define _APS_NEXT_RESOURCE_VALUE 105

View file

@ -81,7 +81,7 @@ static void AddStatusMsg(DFWINDOW wnd, PARAM p1)
if (wnd->StatusBar != NULL) { if (wnd->StatusBar != NULL) {
if (p1 && *(char *)p1) if (p1 && *(char *)p1)
DfSendMessage(wnd->StatusBar, SETTEXT, p1, 0); DfSendMessage(wnd->StatusBar, SETTEXT, p1, 0);
else else
DfSendMessage(wnd->StatusBar, CLEARTEXT, 0, 0); DfSendMessage(wnd->StatusBar, CLEARTEXT, 0, 0);
DfSendMessage(wnd->StatusBar, PAINT, 0, 0); DfSendMessage(wnd->StatusBar, PAINT, 0, 0);
} }
@ -95,7 +95,7 @@ static void SetFocusMsg(DFWINDOW wnd, BOOL p1)
inFocus = p1 ? wnd : NULL; inFocus = p1 ? wnd : NULL;
if (isVisible(wnd)) if (isVisible(wnd))
DfSendMessage(wnd, BORDER, 0, 0); DfSendMessage(wnd, BORDER, 0, 0);
else else
DfSendMessage(wnd, SHOW_WINDOW, 0, 0); DfSendMessage(wnd, SHOW_WINDOW, 0, 0);
} }
@ -195,7 +195,7 @@ static void CommandMsg(DFWINDOW wnd, PARAM p1, PARAM p2)
if (DfDialogBox(wnd, &Display, TRUE, NULL)) { if (DfDialogBox(wnd, &Display, TRUE, NULL)) {
if (inFocus == wnd->MenuBarWnd || inFocus == wnd->StatusBar) if (inFocus == wnd->MenuBarWnd || inFocus == wnd->StatusBar)
oldFocus = ApplicationWindow; oldFocus = ApplicationWindow;
else else
oldFocus = inFocus; oldFocus = inFocus;
DfSendMessage(wnd, DFM_HIDE_WINDOW, 0, 0); DfSendMessage(wnd, DFM_HIDE_WINDOW, 0, 0);
SelectColors(wnd); SelectColors(wnd);
@ -389,7 +389,7 @@ static char *WindowName(DFWINDOW wnd)
{ {
if (GetClass(wnd) == DIALOG) if (GetClass(wnd) == DIALOG)
return ((DBOX *)(wnd->extension))->HelpName; return ((DBOX *)(wnd->extension))->HelpName;
else else
return "Untitled"; return "Untitled";
} }
else else

View file

@ -449,7 +449,7 @@ void BuildFileName(char *path, char *ext)
cp = strrchr(path, '\\'); cp = strrchr(path, '\\');
if (cp == NULL) if (cp == NULL)
cp = path; cp = path;
else else
cp++; cp++;
strcpy(cp, DFlatApplication); strcpy(cp, DFlatApplication);
strcat(cp, ext); strcat(cp, ext);

View file

@ -529,11 +529,11 @@ void SetScrollBars(DFWINDOW wnd)
int oldattr = GetAttribute(wnd); int oldattr = GetAttribute(wnd);
if (wnd->wlines > ClientHeight(wnd)) if (wnd->wlines > ClientHeight(wnd))
AddAttribute(wnd, VSCROLLBAR); AddAttribute(wnd, VSCROLLBAR);
else else
ClearAttribute(wnd, VSCROLLBAR); ClearAttribute(wnd, VSCROLLBAR);
if (wnd->textwidth > ClientWidth(wnd)) if (wnd->textwidth > ClientWidth(wnd))
AddAttribute(wnd, HSCROLLBAR); AddAttribute(wnd, HSCROLLBAR);
else else
ClearAttribute(wnd, HSCROLLBAR); ClearAttribute(wnd, HSCROLLBAR);
if (GetAttribute(wnd) != oldattr) if (GetAttribute(wnd) != oldattr)
DfSendMessage(wnd, BORDER, 0, 0); DfSendMessage(wnd, BORDER, 0, 0);
@ -643,15 +643,15 @@ static void FixColors(DFWINDOW wnd)
{ {
if (ct->class != SPINBUTTON && ct->class != COMBOBOX) if (ct->class != SPINBUTTON && ct->class != COMBOBOX)
{ {
wnd->WindowColors[FRAME_COLOR][FG] = wnd->WindowColors[FRAME_COLOR][FG] =
GetParent(wnd)->WindowColors[FRAME_COLOR][FG]; GetParent(wnd)->WindowColors[FRAME_COLOR][FG];
wnd->WindowColors[FRAME_COLOR][BG] = wnd->WindowColors[FRAME_COLOR][BG] =
GetParent(wnd)->WindowColors[FRAME_COLOR][BG]; GetParent(wnd)->WindowColors[FRAME_COLOR][BG];
if (ct->class != EDITBOX && ct->class != LISTBOX) if (ct->class != EDITBOX && ct->class != LISTBOX)
{ {
wnd->WindowColors[STD_COLOR][FG] = wnd->WindowColors[STD_COLOR][FG] =
GetParent(wnd)->WindowColors[STD_COLOR][FG]; GetParent(wnd)->WindowColors[STD_COLOR][FG];
wnd->WindowColors[STD_COLOR][BG] = wnd->WindowColors[STD_COLOR][BG] =
GetParent(wnd)->WindowColors[STD_COLOR][BG]; GetParent(wnd)->WindowColors[STD_COLOR][BG];
} }
} }

View file

@ -1,4 +1,4 @@
/* /*
* ReactOS DFLAT32.DLL * ReactOS DFLAT32.DLL
*/ */

View file

@ -398,7 +398,7 @@ static void FlipSelection(DFWINDOW wnd, int sel)
} }
static int ExtendSelections(DFWINDOW wnd, int sel, int shift) static int ExtendSelections(DFWINDOW wnd, int sel, int shift)
{ {
if (shift & (LEFTSHIFT | RIGHTSHIFT) && if (shift & (LEFTSHIFT | RIGHTSHIFT) &&
wnd->AnchorPoint != -1) { wnd->AnchorPoint != -1) {
int i = sel; int i = sel;

View file

@ -196,7 +196,7 @@ static void KeyboardMsg(DFWINDOW wnd, PARAM p1)
if (mwnd != NULL) if (mwnd != NULL)
DfSendMessage(wnd, MB_SELECTION, DfSendMessage(wnd, MB_SELECTION,
ActiveMenuBar->ActiveSelection, 0); ActiveMenuBar->ActiveSelection, 0);
else else
DfSendMessage(wnd, PAINT, 0, 0); DfSendMessage(wnd, PAINT, 0, 0);
break; break;
case BS: case BS:
@ -207,7 +207,7 @@ static void KeyboardMsg(DFWINDOW wnd, PARAM p1)
if (mwnd != NULL) if (mwnd != NULL)
DfSendMessage(wnd, MB_SELECTION, DfSendMessage(wnd, MB_SELECTION,
ActiveMenuBar->ActiveSelection, 0); ActiveMenuBar->ActiveSelection, 0);
else else
DfSendMessage(wnd, PAINT, 0, 0); DfSendMessage(wnd, PAINT, 0, 0);
break; break;
default: default:

View file

@ -593,7 +593,7 @@ BOOL DfDispatchMessage (void)
while (EventQueueCtr > 0) while (EventQueueCtr > 0)
{ {
struct events ev; struct events ev;
ev = EventQueue[EventQueueOffCtr]; ev = EventQueue[EventQueueOffCtr];
if (++EventQueueOffCtr == MAXMESSAGES) if (++EventQueueOffCtr == MAXMESSAGES)
EventQueueOffCtr = 0; EventQueueOffCtr = 0;

View file

@ -123,7 +123,7 @@ BOOL InputBox(DFWINDOW wnd,char *ttl,char *msg,char *text,int len)
InputText = text; InputText = text;
TextLength = len; TextLength = len;
InputBoxDB.dwnd.title = ttl; InputBoxDB.dwnd.title = ttl;
InputBoxDB.dwnd.w = 4 + InputBoxDB.dwnd.w = 4 +
max(20, max(len, max((int)strlen(ttl), (int)strlen(msg)))); max(20, max(len, max((int)strlen(ttl), (int)strlen(msg))));
InputBoxDB.ctl[1].dwnd.x = (InputBoxDB.dwnd.w-2-len)/2; InputBoxDB.ctl[1].dwnd.x = (InputBoxDB.dwnd.w-2-len)/2;
InputBoxDB.ctl[0].dwnd.w = strlen(msg); InputBoxDB.ctl[0].dwnd.w = strlen(msg);

View file

@ -74,7 +74,7 @@ static int FindVector(DFWINDOW wnd, DFRECT rc, int x, int y)
coll = 0; coll = 0;
else if (rc.lf+x == rcc.rt) else if (rc.lf+x == rcc.rt)
coll = 2; coll = 2;
else else
coll = 1; coll = 1;
} }
} }
@ -88,7 +88,7 @@ static int FindVector(DFWINDOW wnd, DFRECT rc, int x, int y)
coll = 0; coll = 0;
else if (rc.tp+y == rcc.bt) else if (rc.tp+y == rcc.bt)
coll = 2; coll = 2;
else else
coll = 1; coll = 1;
} }
} }

View file

@ -228,7 +228,7 @@ static BOOL KeyboardMsg(DFWINDOW wnd, PARAM p1, PARAM p2)
case F1: case F1:
if (ActivePopDown == NULL) if (ActivePopDown == NULL)
DfSendMessage(GetParent(wnd), KEYBOARD, p1, p2); DfSendMessage(GetParent(wnd), KEYBOARD, p1, p2);
else else
DisplayHelp(wnd, DisplayHelp(wnd,
(ActivePopDown+wnd->selection)->help); (ActivePopDown+wnd->selection)->help);
return TRUE; return TRUE;

View file

@ -14,7 +14,7 @@ int StatusBarProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2)
if ((int)p1 == CTRL_F4) if ((int)p1 == CTRL_F4)
return TRUE; return TRUE;
break; break;
case PAINT: case PAINT:
if (!isVisible(wnd)) if (!isVisible(wnd))
break; break;
statusbar = DFcalloc(1, WindowWidth(wnd)+1); statusbar = DFcalloc(1, WindowWidth(wnd)+1);

View file

@ -8,7 +8,7 @@ int TestCriticalError(void)
/* These are functions that are supposed to be part of the application /* These are functions that are supposed to be part of the application
* not part of the dflat32.dll * not part of the dflat32.dll
* *
* - Fixme * - Fixme
*/ */
char DFlatApplication[] = "none"; //edit.c char DFlatApplication[] = "none"; //edit.c

View file

@ -45,7 +45,7 @@ void BuildSystemMenu(DFWINDOW wnd)
int lf, tp, ht, wd; int lf, tp, ht, wd;
DFWINDOW SystemMenuWnd; DFWINDOW SystemMenuWnd;
SystemMenu.PullDown[0].Selections[6].Accelerator = SystemMenu.PullDown[0].Selections[6].Accelerator =
(GetClass(wnd) == APPLICATION) ? ALT_F4 : CTRL_F4; (GetClass(wnd) == APPLICATION) ? ALT_F4 : CTRL_F4;
lf = GetLeft(wnd)+1; lf = GetLeft(wnd)+1;

View file

@ -1,16 +1,16 @@
/* This is the configuration file for the Midnight Commander. It was generated /* This is the configuration file for the Midnight Commander. It was generated
by autoconf's configure. by autoconf's configure.
Configure for Midnight Commander Configure for Midnight Commander
Copyright (C) 1994, 1995 Janne Kukonlehto Copyright (C) 1994, 1995 Janne Kukonlehto
Copyright (C) 1994, 1995 Miguel de Icaza Copyright (C) 1994, 1995 Miguel de Icaza
Copyright (C) 1995 Jakub Jelinek Copyright (C) 1995 Jakub Jelinek
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -19,7 +19,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <VERSION> #include <VERSION>
@ -78,7 +78,7 @@
#undef HAVE_SUBSHELL_SUPPORT #undef HAVE_SUBSHELL_SUPPORT
/* If you don't have gcc, define this */ /* If you don't have gcc, define this */
#undef OLD_TOOLS #undef OLD_TOOLS
/* Are you using other type of curses? */ /* Are you using other type of curses? */
#undef OTHER_CURSES #undef OTHER_CURSES
@ -120,7 +120,7 @@
#undef USE_NETCODE #undef USE_NETCODE
/* If defined, use .netrc for FTP connections */ /* If defined, use .netrc for FTP connections */
#undef USE_NETRC #undef USE_NETRC
/* If your operating system does not have enough space for a file name /* If your operating system does not have enough space for a file name
* in a struct dirent, then define this * in a struct dirent, then define this

View file

@ -2,17 +2,17 @@
/* config.h.in. Generated automatically from configure.in by autoheader. */ /* config.h.in. Generated automatically from configure.in by autoheader. */
/* This is the configuration file for the Midnight Commander. It was generated /* This is the configuration file for the Midnight Commander. It was generated
by autoconf's configure. by autoconf's configure.
Configure for Midnight Commander Configure for Midnight Commander
Copyright (C) 1994, 1995 Janne Kukonlehto Copyright (C) 1994, 1995 Janne Kukonlehto
Copyright (C) 1994, 1995 Miguel de Icaza Copyright (C) 1994, 1995 Miguel de Icaza
Copyright (C) 1995 Jakub Jelinek Copyright (C) 1995 Jakub Jelinek
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -21,7 +21,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <VERSION> #include <VERSION>
@ -172,7 +172,7 @@
#define HAVE_SUBSHELL_SUPPORT 1 #define HAVE_SUBSHELL_SUPPORT 1
/* If you don't have gcc, define this */ /* If you don't have gcc, define this */
/* #undef OLD_TOOLS */ /* #undef OLD_TOOLS */
/* Is the subshell the default or optional? */ /* Is the subshell the default or optional? */
/* #undef SUBSHELL_OPTIONAL */ /* #undef SUBSHELL_OPTIONAL */
@ -208,7 +208,7 @@
#define USE_NETCODE 1 #define USE_NETCODE 1
/* If defined, use .netrc for FTP connections */ /* If defined, use .netrc for FTP connections */
/* #undef USE_NETRC */ /* #undef USE_NETRC */
/* If your operating system does not have enough space for a file name /* If your operating system does not have enough space for a file name
* in a struct dirent, then define this * in a struct dirent, then define this

View file

@ -1,14 +1,14 @@
/* editor low level data handling and cursor fundamentals. /* editor low level data handling and cursor fundamentals.
Copyright (C) 1996, 1997 the Free Software Foundation Copyright (C) 1996, 1997 the Free Software Foundation
Authors: 1996, 1997 Paul Sheer Authors: 1996, 1997 Paul Sheer
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -36,9 +36,9 @@
/* /*
* *
* here's a quick sketch of the layout: (don't run this through indent.) * here's a quick sketch of the layout: (don't run this through indent.)
* *
* (b1 is buffers1 and b2 is buffers2) * (b1 is buffers1 and b2 is buffers2)
* *
* | * |
* \0\0\0\0\0m e _ f i l e . \nf i n . \n|T h i s _ i s _ s o\0\0\0\0\0\0\0\0\0 * \0\0\0\0\0m e _ f i l e . \nf i n . \n|T h i s _ i s _ s o\0\0\0\0\0\0\0\0\0
* ______________________________________|______________________________________ * ______________________________________|______________________________________
@ -55,7 +55,7 @@
* file end|||file beginning * file end|||file beginning
* | * |
* | * |
* *
* _ * _
* This_is_some_file * This_is_some_file
* fin. * fin.
@ -100,14 +100,14 @@ char *edit_get_buffer_as_text (WEdit * e)
/* cursor set to start of file */ /* cursor set to start of file */
int init_dynamic_edit_buffers (WEdit * edit, const char *filename, const char *text) int init_dynamic_edit_buffers (WEdit * edit, const char *filename, const char *text)
{ {
#if defined CR_LF_TRANSLATION #if defined CR_LF_TRANSLATION
/* Variables needed for safe handling of Translation from Microsoft CR/LF EOL to /* Variables needed for safe handling of Translation from Microsoft CR/LF EOL to
Unix Style LF EOL - Franco */ Unix Style LF EOL - Franco */
long bytes_wanted,bytes_read,bytes_missing; long bytes_wanted,bytes_read,bytes_missing;
char *p; char *p;
#endif #endif
long buf; long buf;
int j, file = 0, buf2; int j, file = 0, buf2;
@ -129,15 +129,15 @@ int init_dynamic_edit_buffers (WEdit * edit, const char *filename, const char *t
edit->buffers2[buf2] = CMalloc (EDIT_BUF_SIZE); edit->buffers2[buf2] = CMalloc (EDIT_BUF_SIZE);
/* /*
_read returns the number of bytes read, _read returns the number of bytes read,
which may be less than count if there are fewer than count bytes left in the file which may be less than count if there are fewer than count bytes left in the file
or if the file was opened in text mode, or if the file was opened in text mode,
in which case each carriage returnlinefeed (CR-LF) pair is replaced in which case each carriage returnlinefeed (CR-LF) pair is replaced
with a single linefeed character. Only the single linefeed character is counted with a single linefeed character. Only the single linefeed character is counted
in the return value. The replacement does not affect the file pointer. in the return value. The replacement does not affect the file pointer.
_eof returns 1 if the current position is end of file, or 0 if it is not. _eof returns 1 if the current position is end of file, or 0 if it is not.
A return value of -1 indicates an error; in this case, errno is set to EBADF, A return value of -1 indicates an error; in this case, errno is set to EBADF,
which indicates an invalid file handle. which indicates an invalid file handle.
*/ */
if (filename){ if (filename){
@ -381,7 +381,7 @@ int edit_renew (WEdit * edit)
dir = strdup (edit->dir); dir = strdup (edit->dir);
else else
dir = 0; dir = 0;
edit_clean (edit); edit_clean (edit);
if (!edit_init (edit, lines, columns, 0, "", dir, 0)) if (!edit_init (edit, lines, columns, 0, "", dir, 0))
return 0; return 0;
@ -1163,7 +1163,7 @@ int line_is_blank (WEdit * edit, long line)
return is_blank (edit, p); return is_blank (edit, p);
} }
/* moves up until a blank line is reached, or until just /* moves up until a blank line is reached, or until just
before a non-blank line is reached */ before a non-blank line is reached */
static void edit_move_up_paragraph (WEdit * edit, int scroll) static void edit_move_up_paragraph (WEdit * edit, int scroll)
{ {
@ -1638,7 +1638,7 @@ static void edit_tab_cmd (WEdit * edit)
if (option_fake_half_tabs) { if (option_fake_half_tabs) {
if (is_in_indent (edit)) { if (is_in_indent (edit)) {
/*insert a half tab (usually four spaces) unless there is a /*insert a half tab (usually four spaces) unless there is a
half tab already behind, then delete it and insert a half tab already behind, then delete it and insert a
full tab. */ full tab. */
if (right_of_four_spaces (edit)) { if (right_of_four_spaces (edit)) {
for (i = 1; i <= HALF_TAB_SIZE; i++) for (i = 1; i <= HALF_TAB_SIZE; i++)
@ -1811,7 +1811,7 @@ void edit_set_user_command (void (*func) (WEdit *, int))
void edit_mail_dialog (WEdit * edit); void edit_mail_dialog (WEdit * edit);
/* /*
This executes a command at a lower level than macro recording. This executes a command at a lower level than macro recording.
It also does not push a key_press onto the undo stack. This means It also does not push a key_press onto the undo stack. This means
that if it is called many times, a single undo command will undo that if it is called many times, a single undo command will undo

View file

@ -17,11 +17,11 @@
# include "../src/tty.h" # include "../src/tty.h"
# include <sys/stat.h> # include <sys/stat.h>
# include <errno.h> # include <errno.h>
# ifdef HAVE_FCNTL_H # ifdef HAVE_FCNTL_H
# include <fcntl.h> # include <fcntl.h>
# endif # endif
# include <stdlib.h> # include <stdlib.h>
# include <malloc.h> # include <malloc.h>
@ -31,18 +31,18 @@
# include <stdio.h> # include <stdio.h>
# include <stdarg.h> # include <stdarg.h>
# include <sys/types.h> # include <sys/types.h>
# ifdef HAVE_UNISTD_H # ifdef HAVE_UNISTD_H
# include <unistd.h> # include <unistd.h>
# endif # endif
# include <my_string.h> # include <my_string.h>
# include <sys/stat.h> # include <sys/stat.h>
# ifdef HAVE_FCNTL_H # ifdef HAVE_FCNTL_H
# include <fcntl.h> # include <fcntl.h>
# endif # endif
# include <stdlib.h> # include <stdlib.h>
# include <stdarg.h> # include <stdarg.h>
@ -56,7 +56,7 @@
# include <time.h> # include <time.h>
# endif # endif
# endif # endif
# include "regex.h" # include "regex.h"
#endif #endif
@ -91,7 +91,7 @@
# include "../src/menu.h" # include "../src/menu.h"
# include "../src/regex.h" # include "../src/regex.h"
# define WANT_WIDGETS # define WANT_WIDGETS
# define WIDGET_COMMAND (WIDGET_USER + 10) # define WIDGET_COMMAND (WIDGET_USER + 10)
# define N_menus 5 # define N_menus 5
@ -282,9 +282,9 @@ struct editor_widget {
deleted at all since last load or save */ deleted at all since last load or save */
#ifdef MIDNIGHT #ifdef MIDNIGHT
int delete_file; /* has the file been created in edit_load_file? Delete int delete_file; /* has the file been created in edit_load_file? Delete
it at end of editing when it hasn't been modified it at end of editing when it hasn't been modified
or saved */ or saved */
#endif #endif
unsigned char highlight; unsigned char highlight;
long prev_col; /*recent column position of the curser - used when moving long prev_col; /*recent column position of the curser - used when moving
up or down past lines that are shorter than the current line */ up or down past lines that are shorter than the current line */
@ -463,7 +463,7 @@ void edit_get_syntax_color (WEdit * edit, long byte_index, int *fg, int *bg);
# define FONT_PIX_PER_LINE 1 # define FONT_PIX_PER_LINE 1
# define FONT_MEAN_WIDTH 1 # define FONT_MEAN_WIDTH 1
# define get_sys_error(s) (s) # define get_sys_error(s) (s)
# define open mc_open # define open mc_open
# define close(f) mc_close(f) # define close(f) mc_close(f)
@ -476,7 +476,7 @@ void edit_get_syntax_color (WEdit * edit, long byte_index, int *fg, int *bg);
# define edit_get_load_file(d,f,h) input_dialog (h, _(" Enter file name: "), f) # define edit_get_load_file(d,f,h) input_dialog (h, _(" Enter file name: "), f)
# define edit_get_save_file(d,f,h) input_dialog (h, _(" Enter file name: "), f) # define edit_get_save_file(d,f,h) input_dialog (h, _(" Enter file name: "), f)
# define CMalloc(x) malloc(x) # define CMalloc(x) malloc(x)
# define set_error_msg(s) edit_init_error_msg = strdup(s) # define set_error_msg(s) edit_init_error_msg = strdup(s)
# ifdef _EDIT_C # ifdef _EDIT_C
@ -502,7 +502,7 @@ extern char *edit_init_error_msg;
# define MY_O_TEXT 0 # define MY_O_TEXT 0
# define WIN_MESSAGES edit->widget->mainid, 20, 20 # define WIN_MESSAGES edit->widget->mainid, 20, 20
# define edit_get_load_file(d,f,h) CGetLoadFile(WIN_MESSAGES,d,f,h) # define edit_get_load_file(d,f,h) CGetLoadFile(WIN_MESSAGES,d,f,h)
# define edit_get_save_file(d,f,h) CGetSaveFile(WIN_MESSAGES,d,f,h) # define edit_get_save_file(d,f,h) CGetSaveFile(WIN_MESSAGES,d,f,h)
# define edit_error_dialog(h,t) CErrorDialog(WIN_MESSAGES,h,"%s",t) # define edit_error_dialog(h,t) CErrorDialog(WIN_MESSAGES,h,"%s",t)

View file

@ -97,7 +97,7 @@
KEY_F (17), CK_Find_Again, KEY_F (17), CK_Find_Again,
ALT ('<'), CK_Beginning_Of_Text, ALT ('<'), CK_Beginning_Of_Text,
ALT ('>'), CK_End_Of_Text, ALT ('>'), CK_End_Of_Text,
0, 0}; 0, 0};
static long key_pad_map[10] = static long key_pad_map[10] =
@ -276,7 +276,7 @@
goto fin; goto fin;
/* Function still not found for this key, so try macro's */ /* Function still not found for this key, so try macro's */
/* This allows the same macro to be /* This allows the same macro to be
enabled by either eg "ALT('f')" or "XCTRL('f')" or "XCTRL('a'), 'f'" */ enabled by either eg "ALT('f')" or "XCTRL('f')" or "XCTRL('a'), 'f'" */
/* key.h: #define ALT(x) (0x200 | (x)) */ /* key.h: #define ALT(x) (0x200 | (x)) */

View file

@ -410,8 +410,8 @@ int edit_save_as_cmd (WEdit * edit)
different_filename = 1; different_filename = 1;
if ((file = open ((char *) exp, O_RDONLY)) != -1) { /* the file exists */ if ((file = open ((char *) exp, O_RDONLY)) != -1) { /* the file exists */
close (file); close (file);
if (edit_query_dialog2 (_(" Warning "), if (edit_query_dialog2 (_(" Warning "),
_(" A file already exists with this name. "), _(" A file already exists with this name. "),
/* Push buttons to over-write the current file, or cancel the operation */ /* Push buttons to over-write the current file, or cancel the operation */
_("Overwrite"), _("Cancel"))) _("Overwrite"), _("Cancel")))
return 0; return 0;
@ -423,7 +423,7 @@ int edit_save_as_cmd (WEdit * edit)
edit->modified = 0; edit->modified = 0;
#ifdef MIDNIGHT #ifdef MIDNIGHT
edit->delete_file = 0; edit->delete_file = 0;
#endif #endif
if (different_filename && !edit->explicit_syntax) if (different_filename && !edit->explicit_syntax)
edit_load_syntax (edit, 0, 0); edit_load_syntax (edit, 0, 0);
return 1; return 1;
@ -462,7 +462,7 @@ int raw_callback (struct Dlg_head *h, int key, int Msg)
} }
/* gets a raw key from the keyboard. Passing cancel = 1 draws /* gets a raw key from the keyboard. Passing cancel = 1 draws
a cancel button thus allowing c-c etc.. Alternatively, cancel = 0 a cancel button thus allowing c-c etc.. Alternatively, cancel = 0
will return the next key pressed */ will return the next key pressed */
int edit_raw_key_query (char *heading, char *query, int cancel) int edit_raw_key_query (char *heading, char *query, int cancel)
{ {
@ -624,7 +624,7 @@ void edit_delete_macro_cmd (WEdit * edit)
command = CK_Macro (edit_raw_key_query (_(" Delete Macro "), _(" Press macro hotkey: "), 1)); command = CK_Macro (edit_raw_key_query (_(" Delete Macro "), _(" Press macro hotkey: "), 1));
#else #else
/* This heads the 'Delete Macro' dialog box */ /* This heads the 'Delete Macro' dialog box */
command = CK_Macro (CKeySymMod (CRawkeyQuery (0, 0, 0, _(" Delete Macro "), command = CK_Macro (CKeySymMod (CRawkeyQuery (0, 0, 0, _(" Delete Macro "),
/* Input line for a single key press follows the ':' */ /* Input line for a single key press follows the ':' */
_(" Press macro hotkey: ")))); _(" Press macro hotkey: "))));
#endif #endif
@ -708,7 +708,7 @@ int edit_save_cmd (WEdit * edit)
edit->modified = 0; edit->modified = 0;
#ifdef MIDNIGHT #ifdef MIDNIGHT
edit->delete_file = 0; edit->delete_file = 0;
#endif #endif
return 1; return 1;
} }
@ -850,7 +850,7 @@ void edit_block_move_cmd (WEdit * edit)
} }
edit_scroll_screen_over_cursor (edit); edit_scroll_screen_over_cursor (edit);
edit_cursor_move (edit, current - edit->curs1 edit_cursor_move (edit, current - edit->curs1
- (((current - edit->curs1) > 0) ? end_mark - start_mark : 0)); - (((current - edit->curs1) > 0) ? end_mark - start_mark : 0));
edit_scroll_screen_over_cursor (edit); edit_scroll_screen_over_cursor (edit);
@ -1011,7 +1011,7 @@ void edit_replace_dialog (WEdit * edit, char **search_text, char **replace_text,
0, 0, XV_WLAY_DONTCARE, NULL}, 0, 0, XV_WLAY_DONTCARE, NULL},
{quick_checkbox, 25, 50, 9, REPLACE_DLG_HEIGHT, "Pr&ompt on replace", 0, 0, {quick_checkbox, 25, 50, 9, REPLACE_DLG_HEIGHT, "Pr&ompt on replace", 0, 0,
0, 0, XV_WLAY_DONTCARE, NULL}, 0, 0, XV_WLAY_DONTCARE, NULL},
{quick_checkbox, 4, 50, 11, REPLACE_DLG_HEIGHT, "&Backwards", 0, 0, {quick_checkbox, 4, 50, 11, REPLACE_DLG_HEIGHT, "&Backwards", 0, 0,
0, 0, XV_WLAY_DONTCARE, NULL}, 0, 0, XV_WLAY_DONTCARE, NULL},
{quick_checkbox, 4, 50, 10, REPLACE_DLG_HEIGHT, "&Regular exprssn", 0, 0, {quick_checkbox, 4, 50, 10, REPLACE_DLG_HEIGHT, "&Regular exprssn", 0, 0,
0, 0, XV_WLAY_DONTCARE, NULL}, 0, 0, XV_WLAY_DONTCARE, NULL},
@ -1314,9 +1314,9 @@ int edit_replace_prompt (WEdit * edit, char *replace_text, int xpos, int ypos)
p++; p++;
} }
edit->force |= REDRAW_COMPLETELY; edit->force |= REDRAW_COMPLETELY;
q = edit_query_dialog4 (_(" Replace "), q = edit_query_dialog4 (_(" Replace "),
/* This is for the confirm replace dialog box. The replaced string comes after the ':' */ /* This is for the confirm replace dialog box. The replaced string comes after the ':' */
catstrs (_(" Replace with: "), r, 0), catstrs (_(" Replace with: "), r, 0),
/* Buttons for the confirm replace dialog box. */ /* Buttons for the confirm replace dialog box. */
_("Replace"), _("Skip"), _("Replace all"), _("Cancel")); _("Replace"), _("Skip"), _("Replace all"), _("Cancel"));
if (r) if (r)
@ -1457,7 +1457,7 @@ long edit_find_string (long start, unsigned char *exp, int *len, long last_byte,
} }
} else { /* regexp matching */ } else { /* regexp matching */
long offset = 0; long offset = 0;
int found_start, match_bol, move_win = 0; int found_start, match_bol, move_win = 0;
while (start + offset < last_byte) { while (start + offset < last_byte) {
match_bol = (offset == 0 || (*get_byte) (data, start + offset - 1) == '\n'); match_bol = (offset == 0 || (*get_byte) (data, start + offset - 1) == '\n');
@ -1846,7 +1846,7 @@ void edit_replace_cmd (WEdit * edit, int again)
while (repl_str[++i]) while (repl_str[++i])
edit_insert (edit, repl_str[i]); edit_insert (edit, repl_str[i]);
} else { } else {
edit_error_dialog (_(" Replace "), edit_error_dialog (_(" Replace "),
/* "Invalid regexp string or scanf string" */ /* "Invalid regexp string or scanf string" */
_(" Error in replacement format string. ")); _(" Error in replacement format string. "));
replace_continue = 0; replace_continue = 0;
@ -1988,7 +1988,7 @@ void edit_quit_cmd (WEdit * edit)
case -1: case -1:
return; return;
} }
} }
#ifdef MIDNIGHT #ifdef MIDNIGHT
else if (edit->delete_file) else if (edit->delete_file)
unlink (catstrs (edit->dir, edit->filename, 0)); unlink (catstrs (edit->dir, edit->filename, 0));
@ -2340,7 +2340,7 @@ int edit_sort_cmd (WEdit * edit)
exp = old ? old : ""; exp = old ? old : "";
exp = input_dialog (_(" Run Sort "), exp = input_dialog (_(" Run Sort "),
/* Not essential to translate */ /* Not essential to translate */
_(" Enter sort options (see manpage) separated by whitespace: "), ""); _(" Enter sort options (see manpage) separated by whitespace: "), "");
@ -2353,13 +2353,13 @@ int edit_sort_cmd (WEdit * edit)
e = system (catstrs (" sort ", exp, " ", home_dir, BLOCK_FILE, " > ", home_dir, TEMP_FILE, 0)); e = system (catstrs (" sort ", exp, " ", home_dir, BLOCK_FILE, " > ", home_dir, TEMP_FILE, 0));
if (e) { if (e) {
if (e == -1 || e == 127) { if (e == -1 || e == 127) {
edit_error_dialog (_(" Sort "), edit_error_dialog (_(" Sort "),
/* Not essential to translate */ /* Not essential to translate */
get_sys_error (_(" Error trying to execute sort command "))); get_sys_error (_(" Error trying to execute sort command ")));
} else { } else {
char q[8]; char q[8];
sprintf (q, "%d ", e); sprintf (q, "%d ", e);
edit_error_dialog (_(" Sort "), edit_error_dialog (_(" Sort "),
/* Not essential to translate */ /* Not essential to translate */
catstrs (_(" Sort returned non-zero: "), q, 0)); catstrs (_(" Sort returned non-zero: "), q, 0));
} }
@ -2385,7 +2385,7 @@ void edit_block_process_cmd (WEdit * edit, const char *shell_cmd, int block)
if (block) { if (block) {
if (eval_marks (edit, &start_mark, &end_mark)) { if (eval_marks (edit, &start_mark, &end_mark)) {
edit_error_dialog (_(" Process block "), edit_error_dialog (_(" Process block "),
/* Not essential to translate */ /* Not essential to translate */
_(" You must first highlight a block of text. ")); _(" You must first highlight a block of text. "));
return; return;
@ -2415,7 +2415,7 @@ void edit_block_process_cmd (WEdit * edit, const char *shell_cmd, int block)
} }
} else { } else {
/* Not essential to translate */ /* Not essential to translate */
edit_error_dialog (_(" Process block "), edit_error_dialog (_(" Process block "),
/* Not essential to translate */ /* Not essential to translate */
get_sys_error (_(" Error trying to stat file "))); get_sys_error (_(" Error trying to stat file ")));
return; return;

View file

@ -96,7 +96,7 @@ void edit_status (WEdit * edit)
extern int fixed_font; extern int fixed_font;
void rerender_text (CWidget * wdt); void rerender_text (CWidget * wdt);
void edit_status (WEdit * edit) void edit_status (WEdit * edit)
{ {
if ((edit->widget->options & EDITOR_NO_TEXT)) { if ((edit->widget->options & EDITOR_NO_TEXT)) {
@ -603,7 +603,7 @@ void edit_render (WEdit * edit, int page, int row_start, int col_start, int row_
#endif #endif
render_edit_text (edit, row_start, col_start, row_end, col_end); render_edit_text (edit, row_start, col_start, row_end, col_end);
if (edit->force) /* edit->force != 0 means a key was pending and the redraw if (edit->force) /* edit->force != 0 means a key was pending and the redraw
was halted, so next time we must redraw everything in case stuff was halted, so next time we must redraw everything in case stuff
was left undrawn from a previous key press */ was left undrawn from a previous key press */
edit->force |= REDRAW_PAGE; edit->force |= REDRAW_PAGE;

View file

@ -36,7 +36,7 @@ extern WMenu *edit_menubar;
#undef edit_message_dialog #undef edit_message_dialog
#define edit_message_dialog(w,x,y,h,s) query_dialog (h, s, 0, 1, "&Ok") #define edit_message_dialog(w,x,y,h,s) query_dialog (h, s, 0, 1, "&Ok")
#define CFocus(x) #define CFocus(x)
static void menu_cmd (int i) static void menu_cmd (int i)
{ {
@ -53,7 +53,7 @@ void edit_wrap_cmd ()
char *f; char *f;
char s[12]; char s[12];
sprintf (s, "%d", option_word_wrap_line_length); sprintf (s, "%d", option_word_wrap_line_length);
f = input_dialog (_(" Word wrap "), f = input_dialog (_(" Word wrap "),
/* Not essential to translate */ /* Not essential to translate */
_(" Enter line length, 0 for off: "), s); _(" Enter line length, 0 for off: "), s);
if (f) { if (f) {

View file

@ -411,7 +411,7 @@ void link_hscrollbar_to_editor (CWidget * scrollbar, CWidget * editor, XEvent *
} }
} }
/* /*
This section comes from rxvt-2.21b1/src/screen.c by This section comes from rxvt-2.21b1/src/screen.c by
Robert Nation <nation@rocket.sanders.lockheed.com> & Robert Nation <nation@rocket.sanders.lockheed.com> &
mods by mj olesen <olesen@me.QueensU.CA> mods by mj olesen <olesen@me.QueensU.CA>

View file

@ -1054,7 +1054,7 @@ void edit_free_syntax_rules (WEdit * edit)
#define CURRENT_SYNTAX_RULES_VERSION "22" #define CURRENT_SYNTAX_RULES_VERSION "22"
char *syntax_text = char *syntax_text =
"# syntax rules version " CURRENT_SYNTAX_RULES_VERSION "\n" "# syntax rules version " CURRENT_SYNTAX_RULES_VERSION "\n"
"# Allowable colors for mc are\n" "# Allowable colors for mc are\n"
"# (after the slash is a Cooledit color, 0-26 or any of the X colors in rgb.txt)\n" "# (after the slash is a Cooledit color, 0-26 or any of the X colors in rgb.txt)\n"

View file

@ -14,7 +14,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <config.h> #include <config.h>
@ -133,8 +133,8 @@ static void strip_newlines (char *t, int size)
#ifndef MIDNIGHT #ifndef MIDNIGHT
int edit_width_of_long_printable (int c); int edit_width_of_long_printable (int c);
#endif #endif
/* /*
This is a copy of the function This is a copy of the function
int calc_text_pos (WEdit * edit, long b, long *q, int l) int calc_text_pos (WEdit * edit, long b, long *q, int l)
in propfont.c :( in propfont.c :(
It calculates the number of chars in a line specified to length l in pixels It calculates the number of chars in a line specified to length l in pixels
@ -228,8 +228,8 @@ static void format_this (char *t, int size, int indent)
break; break;
p = word_start (t, q, size); p = word_start (t, q, size);
if (p == -1) if (p == -1)
q = next_word_start (t, q, size); /* Return the end of the word if the beginning q = next_word_start (t, q, size); /* Return the end of the word if the beginning
of the word is at the beginning of a line of the word is at the beginning of a line
(i.e. a very long word) */ (i.e. a very long word) */
else else
q = p; q = p;

View file

@ -103,7 +103,7 @@ struct {
WCheck *check; WCheck *check;
} check_perm[PERMISSIONS] = { } check_perm[PERMISSIONS] = {
{ {
FILE_ARCHIVED, N_("Archive"), 0, 0, FILE_ARCHIVED, N_("Archive"), 0, 0,
}, },
{ {
@ -245,7 +245,7 @@ static void init_chmod (void)
ch_dlg = create_dlg (0, 0, 22 - single_set, 70, dialog_colors, ch_dlg = create_dlg (0, 0, 22 - single_set, 70, dialog_colors,
chmod_callback, _("[Chmod]"), _("chmod"), DLG_CENTER); chmod_callback, _("[Chmod]"), _("chmod"), DLG_CENTER);
x_set_dialog_title (ch_dlg, _("Chmod command")); x_set_dialog_title (ch_dlg, _("Chmod command"));
#define XTRACT(i) BY+chmod_but[i].y-single_set, BX+chmod_but[i].x, \ #define XTRACT(i) BY+chmod_but[i].y-single_set, BX+chmod_but[i].x, \
@ -430,9 +430,9 @@ void chmod_cmd (void)
statl = label_new (FY+4, FX+2, buffer, NULL); statl = label_new (FY+4, FX+2, buffer, NULL);
add_widget (ch_dlg, statl); add_widget (ch_dlg, statl);
tk_end_frame (); tk_end_frame ();
run_dlg (ch_dlg); /* retrieve an action */ run_dlg (ch_dlg); /* retrieve an action */
/* do action */ /* do action */
switch (ch_dlg->ret_value){ switch (ch_dlg->ret_value){
case B_ENTER: case B_ENTER:
@ -440,11 +440,11 @@ void chmod_cmd (void)
mk_chmod (fname, c_stat); /*.ado */ mk_chmod (fname, c_stat); /*.ado */
need_update = 1; need_update = 1;
break; break;
case B_CANCEL: case B_CANCEL:
end_chmod = 1; end_chmod = 1;
break; break;
case B_ALL: case B_ALL:
case B_MARKED: case B_MARKED:
and_mask = or_mask = 0; and_mask = or_mask = 0;
@ -460,7 +460,7 @@ void chmod_cmd (void)
apply_mask (sf_stat); apply_mask (sf_stat);
break; break;
case B_SETMRK: case B_SETMRK:
and_mask = or_mask = 0; and_mask = or_mask = 0;
and_mask = ~and_mask; and_mask = ~and_mask;

View file

@ -14,7 +14,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
Changes: Changes:

View file

@ -1,12 +1,12 @@
/* Client interface for General purpose Win32 console save/restore server /* Client interface for General purpose Win32 console save/restore server
Having the same interface as its Linux counterpart: Having the same interface as its Linux counterpart:
Copyright (C) 1994 Janne Kukonlehto <jtklehto@stekt.oulu.fi> Copyright (C) 1994 Janne Kukonlehto <jtklehto@stekt.oulu.fi>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -14,8 +14,8 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Note: Note:
show_console_contents doesn't know how to write to its window show_console_contents doesn't know how to write to its window
the rest works fine. the rest works fine.
@ -39,7 +39,7 @@ void show_console_contents (int starty, unsigned char begin_line,
unsigned char end_line) unsigned char end_line)
{ {
COORD c0 = { 0, 0 }; COORD c0 = { 0, 0 };
COORD csize; COORD csize;
SMALL_RECT rect; SMALL_RECT rect;
CHAR_INFO *pchar; CHAR_INFO *pchar;
@ -58,7 +58,7 @@ void show_console_contents (int starty, unsigned char begin_line,
/* FIXME: this should've work, /* FIXME: this should've work,
but refresh() is called after this write :-( */ but refresh() is called after this write :-( */
win32APICALL(WriteConsoleOutput (hNew, pchar, csize, c0, &rect)); win32APICALL(WriteConsoleOutput (hNew, pchar, csize, c0, &rect));
free (pchar); free (pchar);
} }

View file

@ -1,13 +1,13 @@
/* Client interface for General purpose OS/2 console save/restore server. /* Client interface for General purpose OS/2 console save/restore server.
1997 Alexander Dong <ado@software-ag.de> 1997 Alexander Dong <ado@software-ag.de>
Having the same interface as its Linux counterpart: Having the same interface as its Linux counterpart:
Copyright (C) 1994 Janne Kukonlehto <jtklehto@stekt.oulu.fi> Copyright (C) 1994 Janne Kukonlehto <jtklehto@stekt.oulu.fi>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -15,8 +15,8 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <config.h> #include <config.h>
@ -101,7 +101,7 @@ void handle_console (unsigned char action)
n = col * row * 2; n = col * row * 2;
VioWrtCellStr ((PCH) scr_buffer, (USHORT) n, 0, 0, 0); /* Write it back */ VioWrtCellStr ((PCH) scr_buffer, (USHORT) n, 0, 0, 0); /* Write it back */
break; break;
default: default:
/* This is not possible, but if we are here, just save the screen */ /* This is not possible, but if we are here, just save the screen */
handle_console(CONSOLE_SAVE); handle_console(CONSOLE_SAVE);
break; break;

View file

@ -15,7 +15,7 @@ DIR *opendir (const char * a_dir)
char *c_dir = malloc (strlen(a_dir) + 4); char *c_dir = malloc (strlen(a_dir) + 4);
strcpy (c_dir, a_dir); strcpy (c_dir, a_dir);
strcat (c_dir, "\\*"); strcat (c_dir, "\\*");
dd_dir->d_handle = FindFirstFile (c_dir, &wfd); dd_dir->d_handle = FindFirstFile (c_dir, &wfd);
if (dd_dir->d_handle == INVALID_HANDLE_VALUE) { if (dd_dir->d_handle == INVALID_HANDLE_VALUE) {
err = GetLastError(); err = GetLastError();
@ -42,7 +42,7 @@ DIR *opendir (const char * a_dir)
dd_dir->d_size = wfd.nFileSizeLow; dd_dir->d_size = wfd.nFileSizeLow;
strcpy (dd_dir->d_name, wfd.cFileName); strcpy (dd_dir->d_name, wfd.cFileName);
dd_dir->d_first = 1; dd_dir->d_first = 1;
free (c_dir); free (c_dir);
return dd_dir; return dd_dir;
} }
@ -51,12 +51,12 @@ DIR *readdir( DIR * dd_dir)
{ {
int err; int err;
WIN32_FIND_DATA wfd; WIN32_FIND_DATA wfd;
if (dd_dir->d_first) { if (dd_dir->d_first) {
dd_dir->d_first = 0; dd_dir->d_first = 0;
return dd_dir; return dd_dir;
} }
if(!FindNextFile (dd_dir->d_handle, &wfd)) { if(!FindNextFile (dd_dir->d_handle, &wfd)) {
err = GetLastError(); err = GetLastError();
switch (err) { switch (err) {
@ -81,7 +81,7 @@ DIR *readdir( DIR * dd_dir)
dd_dir->d_size = wfd.nFileSizeLow; dd_dir->d_size = wfd.nFileSizeLow;
strcpy (dd_dir->d_name, wfd.cFileName); strcpy (dd_dir->d_name, wfd.cFileName);
return dd_dir; return dd_dir;
} }
int closedir (DIR *dd_dir) int closedir (DIR *dd_dir)
{ {

View file

@ -23,8 +23,8 @@ DIR *opendir (const char * a_dir)
strcpy (c_dir, a_dir); strcpy (c_dir, a_dir);
strcat (c_dir, "\\*.*"); strcat (c_dir, "\\*.*");
dd_dir->d_handle = (unsigned long*) HDIR_CREATE; dd_dir->d_handle = (unsigned long*) HDIR_CREATE;
rc = DosFindFirst(c_dir, rc = DosFindFirst(c_dir,
(PHDIR) &dd_dir->d_handle, (PHDIR) &dd_dir->d_handle,
FILE_SYSTEM | FILE_HIDDEN | FILE_DIRECTORY, FILE_SYSTEM | FILE_HIDDEN | FILE_DIRECTORY,
(PVOID) &FindBuffer, (PVOID) &FindBuffer,
@ -42,7 +42,7 @@ DIR *opendir (const char * a_dir)
case ERROR_BUFFER_OVERFLOW: case ERROR_BUFFER_OVERFLOW:
errno = ENOMEM; errno = ENOMEM;
break; break;
default: default:
errno = EINVAL; errno = EINVAL;
break; break;
} }
@ -50,11 +50,11 @@ DIR *opendir (const char * a_dir)
return NULL; return NULL;
} }
dd_dir->d_attr = FindBuffer.attrFile; dd_dir->d_attr = FindBuffer.attrFile;
dd_dir->d_time = dd_dir->d_date = 10; dd_dir->d_time = dd_dir->d_date = 10;
dd_dir->d_size = FindBuffer.cbFile; dd_dir->d_size = FindBuffer.cbFile;
strcpy (dd_dir->d_name, FindBuffer.achName); strcpy (dd_dir->d_name, FindBuffer.achName);
dd_dir->d_first = 1; dd_dir->d_first = 1;
free (c_dir); free (c_dir);
return dd_dir; return dd_dir;
} }
@ -65,13 +65,13 @@ DIR *readdir( DIR * dd_dir)
FILEFINDBUF3 FindBuffer = {0}; FILEFINDBUF3 FindBuffer = {0};
ULONG FileCount = 1; ULONG FileCount = 1;
DIR *ret_dir = (DIR*) malloc (sizeof(DIR)); DIR *ret_dir = (DIR*) malloc (sizeof(DIR));
if (dd_dir->d_first) { if (dd_dir->d_first) {
dd_dir->d_first = 0; dd_dir->d_first = 0;
return dd_dir; return dd_dir;
} }
rc = DosFindNext((HDIR) dd_dir->d_handle, rc = DosFindNext((HDIR) dd_dir->d_handle,
(PVOID) &FindBuffer, (PVOID) &FindBuffer,
sizeof(FILEFINDBUF3), sizeof(FILEFINDBUF3),
&FileCount); &FileCount);
@ -86,19 +86,19 @@ DIR *readdir( DIR * dd_dir)
case ERROR_BUFFER_OVERFLOW: case ERROR_BUFFER_OVERFLOW:
errno = ENOMEM; errno = ENOMEM;
break; break;
default: default:
errno = EINVAL; errno = EINVAL;
break; break;
} }
return NULL; return NULL;
} }
ret_dir->d_attr = FindBuffer.attrFile; ret_dir->d_attr = FindBuffer.attrFile;
ret_dir->d_time = ret_dir->d_date = 10; ret_dir->d_time = ret_dir->d_date = 10;
ret_dir->d_size = FindBuffer.cbFile; ret_dir->d_size = FindBuffer.cbFile;
strcpy (ret_dir->d_name, FindBuffer.achName); strcpy (ret_dir->d_name, FindBuffer.achName);
return ret_dir; return ret_dir;
} }
int closedir (DIR *dd_dir) int closedir (DIR *dd_dir)
{ {

View file

@ -1,10 +1,10 @@
/* Ch-Drive command for Windows NT and OS/2 /* Ch-Drive command for Windows NT and OS/2
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -12,11 +12,11 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Bug: Bug:
the code will not work if you have more drives than those that the code will not work if you have more drives than those that
can fit in a panel. can fit in a panel.
*/ */
#include <config.h> #include <config.h>
@ -51,7 +51,7 @@ static void drive_cmd(void);
#define B_DRIVE_BASE 100 #define B_DRIVE_BASE 100
#define MAX_LGH 13 /* Length for drives */ #define MAX_LGH 13 /* Length for drives */
static void drive_cmd() static void drive_cmd()
{ {
int i, nNewDrive, nDrivesAvail; int i, nNewDrive, nDrivesAvail;
char szTempBuf[7], szDrivesAvail[27*4], *p; char szTempBuf[7], szDrivesAvail[27*4], *p;
@ -86,7 +86,7 @@ static void drive_cmd()
/* Create Dialog */ /* Create Dialog */
do_refresh (); do_refresh ();
m_drv = ((nDrivesAvail > MAX_LGH) ? MAX_LGH: nDrivesAvail); m_drv = ((nDrivesAvail > MAX_LGH) ? MAX_LGH: nDrivesAvail);
/* Center on x, relative to panel */ /* Center on x, relative to panel */
x_pos = this_panel->widget.x + (this_panel->widget.cols - m_drv*3)/2 + 2; x_pos = this_panel->widget.x + (this_panel->widget.cols - m_drv*3)/2 + 2;
@ -128,14 +128,14 @@ static void drive_cmd()
XV_WLAY_RIGHTOF); XV_WLAY_RIGHTOF);
} }
run_dlg(drive_dlg); run_dlg(drive_dlg);
/* do action */ /* do action */
if (drive_dlg->ret_value != B_CANCEL) { if (drive_dlg->ret_value != B_CANCEL) {
int errocc = 0; /* no error */ int errocc = 0; /* no error */
int rtn; int rtn;
char drvLetter; char drvLetter;
/* Set the Panel to Directory listing mode first */ /* Set the Panel to Directory listing mode first */
int is_right=(this_panel==right_panel); int is_right=(this_panel==right_panel);
@ -155,7 +155,7 @@ static void drive_cmd()
#else #else
rtn = DosSetDefaultDisk(nNewDrive + 1); rtn = DosSetDefaultDisk(nNewDrive + 1);
#endif #endif
if (rtn == -1) if (rtn == -1)
errocc = 1; errocc = 1;
else { else {
getcwd (this_panel->cwd, sizeof (this_panel->cwd)-2); getcwd (this_panel->cwd, sizeof (this_panel->cwd)-2);
@ -191,7 +191,7 @@ void drive_cmd_a()
} }
void drive_cmd_b() void drive_cmd_b()
{ {
this_panel = right_panel; this_panel = right_panel;
drive_cmd(); drive_cmd();
} }

View file

@ -5,7 +5,7 @@
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Bugs: Bugs:
Have trouble with non-US keyboards, "Alt-gr"+keys (API tells CTRL-ALT is pressed) Have trouble with non-US keyboards, "Alt-gr"+keys (API tells CTRL-ALT is pressed)
@ -61,15 +61,15 @@ struct {
{ KEY_F(10), VK_F10 }, { KEY_F(10), VK_F10 },
{ KEY_F(11), VK_F11 }, { KEY_F(11), VK_F11 },
{ KEY_F(12), VK_F12 }, { KEY_F(12), VK_F12 },
{ KEY_F(13), VK_F13 }, { KEY_F(13), VK_F13 },
{ KEY_F(14), VK_F14 }, { KEY_F(14), VK_F14 },
{ KEY_F(15), VK_F15 }, { KEY_F(15), VK_F15 },
{ KEY_F(16), VK_F16 }, { KEY_F(16), VK_F16 },
{ KEY_F(17), VK_F17 }, { KEY_F(17), VK_F17 },
{ KEY_F(18), VK_F18 }, { KEY_F(18), VK_F18 },
{ KEY_F(19), VK_F19 }, { KEY_F(19), VK_F19 },
{ KEY_F(20), VK_F20 }, { KEY_F(20), VK_F20 },
{ KEY_IC, VK_INSERT }, { KEY_IC, VK_INSERT },
{ KEY_DC, VK_DELETE }, { KEY_DC, VK_DELETE },
{ KEY_BACKSPACE, VK_BACK }, { KEY_BACKSPACE, VK_BACK },
@ -85,13 +85,13 @@ struct {
{ ALT('*'), VK_MULTIPLY }, { ALT('*'), VK_MULTIPLY },
{ ALT('+'), VK_ADD }, { ALT('+'), VK_ADD },
{ ALT('-'), VK_SUBTRACT }, { ALT('-'), VK_SUBTRACT },
{ ALT('\t'), VK_PAUSE }, /* Added to make Complete work press Pause */ { ALT('\t'), VK_PAUSE }, /* Added to make Complete work press Pause */
{ ESC_CHAR, VK_ESCAPE }, { ESC_CHAR, VK_ESCAPE },
{ 0, 0} { 0, 0}
}; };
/* init_key - Called in main.c to initialize ourselves /* init_key - Called in main.c to initialize ourselves
Get handle to console input Get handle to console input
@ -103,14 +103,14 @@ void init_key (void)
int ctrl_pressed () int ctrl_pressed ()
{ {
if(dwSaved_ControlState & RIGHT_ALT_PRESSED) return 0; if(dwSaved_ControlState & RIGHT_ALT_PRESSED) return 0;
/* The line above fixes the BUG with the AltGr Keys*/ /* The line above fixes the BUG with the AltGr Keys*/
return dwSaved_ControlState & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED); return dwSaved_ControlState & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED);
} }
int shift_pressed () int shift_pressed ()
{ {
if(dwSaved_ControlState & RIGHT_ALT_PRESSED) return 0; if(dwSaved_ControlState & RIGHT_ALT_PRESSED) return 0;
/* The line above fixes the BUG with the AltGr Keys*/ /* The line above fixes the BUG with the AltGr Keys*/
return dwSaved_ControlState & SHIFT_PRESSED; return dwSaved_ControlState & SHIFT_PRESSED;
} }
@ -124,7 +124,7 @@ static int VKtoCurses (int a_vkc)
{ {
int i; int i;
for (i = 0; key_table[i].vkcode != 0; i++) for (i = 0; key_table[i].vkcode != 0; i++)
if (a_vkc == key_table[i].vkcode) { if (a_vkc == key_table[i].vkcode) {
return key_table[i].key_code; return key_table[i].key_code;
} }
@ -183,7 +183,7 @@ int get_key_code (int no_delay)
if (!dw) if (!dw)
return 0; return 0;
} }
do { do {
win32APICALL(ReadConsoleInput(hConsoleInput, &ir, 1, &dw)); win32APICALL(ReadConsoleInput(hConsoleInput, &ir, 1, &dw));
switch (ir.EventType) { switch (ir.EventType) {
@ -219,7 +219,7 @@ int get_key_code (int no_delay)
evSaved_Event.type = GPM_DOWN | GPM_DOUBLE; evSaved_Event.type = GPM_DOWN | GPM_DOUBLE;
break; break;
}; };
return 0; return 0;
} }
} while (!no_delay); } while (!no_delay);
return 0; return 0;
@ -254,7 +254,7 @@ int get_event (Gpm_Event *event, int redo_event, int block)
dirty++; dirty++;
vfs_timeout_handler (); vfs_timeout_handler ();
c = block ? getch_with_delay () : get_key_code (1); c = block ? getch_with_delay () : get_key_code (1);
if (!c) { if (!c) {
@ -270,16 +270,16 @@ int mi_getch ()
{ {
Gpm_Event ev; Gpm_Event ev;
int key; int key;
while ((key = get_event (&ev, 0, 1)) == 0) while ((key = get_event (&ev, 0, 1)) == 0)
; ;
return key; return key;
} }
/* /*
is_idle - A function to check if we're idle. is_idle - A function to check if we're idle.
It checks for any waiting event (that can be a Key, Mouse event, It checks for any waiting event (that can be a Key, Mouse event,
and other internal events like focus or menu) and other internal events like focus or menu)
*/ */
int is_idle (void) int is_idle (void)
{ {

View file

@ -7,7 +7,7 @@
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -15,7 +15,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
@ -86,9 +86,9 @@ static int VKtoCurses (int vkcode);
ALT(F12): 8c00 ALT(F12): 8c00
Mapping for ALT(key_code): Mapping for ALT(key_code):
For Mapping with normal keys, only the scan code can be For Mapping with normal keys, only the scan code can be
used. (see struct ALT_table) used. (see struct ALT_table)
Special keys: Special keys:
ENTER (number block): 0xaaaaE00D ENTER (number block): 0xaaaaE00D
+ (number block): 0xaaaa4E2B Normal: 1B2B + (number block): 0xaaaa4E2B Normal: 1B2B
@ -133,7 +133,7 @@ struct {
{ KEY_F(11), 0x85 }, { KEY_F(11), 0x85 },
{ KEY_F(12), 0x86 }, { KEY_F(12), 0x86 },
{ 0, 0} { 0, 0}
}; };
struct { struct {
@ -181,7 +181,7 @@ struct {
{ ALT(KEY_F(11)), 0x8B }, { ALT(KEY_F(11)), 0x8B },
{ ALT(KEY_F(12)), 0x8C }, { ALT(KEY_F(12)), 0x8C },
{ 0, 0} { 0, 0}
}; };
struct { struct {
@ -199,7 +199,7 @@ struct {
{ KEY_HOME, 0x47 }, { KEY_HOME, 0x47 },
{ KEY_END, 0x4F }, { KEY_END, 0x4F },
{ 0, 0} { 0, 0}
}; };
/* init_key -- to make linker happy */ /* init_key -- to make linker happy */
@ -217,7 +217,7 @@ static int push_char (int c)
{ {
if (!seq_append) if (!seq_append)
seq_append = seq_buffer; seq_append = seq_buffer;
if (seq_append == &(seq_buffer [sizeof (seq_buffer)-2])) if (seq_append == &(seq_buffer [sizeof (seq_buffer)-2]))
return 0; return 0;
*(seq_append++) = c; *(seq_append++) = c;
@ -236,7 +236,7 @@ int get_key_code (int no_delay)
if (inp_ch == 0) { if (inp_ch == 0) {
return 0; return 0;
} }
} }
if (no_delay) { if (no_delay) {
return (VKtoCurses(inp_ch)); return (VKtoCurses(inp_ch));
@ -255,7 +255,7 @@ static int VKtoCurses (int a_vkc)
{ {
int ctrlState = 0; int ctrlState = 0;
int altState = 0; int altState = 0;
int fsState; int fsState;
char scanCode; char scanCode;
char asciiCode; char asciiCode;
@ -267,7 +267,7 @@ static int VKtoCurses (int a_vkc)
scanCode = (char) ((a_vkc & 0x0000FFFF) >> 8); scanCode = (char) ((a_vkc & 0x0000FFFF) >> 8);
asciiCode = (char) (a_vkc & 0x000000FF); asciiCode = (char) (a_vkc & 0x000000FF);
ctrlState = (fsState & CTRL_PRESSED); ctrlState = (fsState & CTRL_PRESSED);
altState = (fsState & ALT_PRESSED); altState = (fsState & ALT_PRESSED);
@ -295,20 +295,20 @@ static int VKtoCurses (int a_vkc)
/* Scan Movement codes */ /* Scan Movement codes */
if (asciiCode == 0) { if (asciiCode == 0) {
/* Replace key code with that in table */ /* Replace key code with that in table */
for (i=0; movement[i].vkcode != 0 || movement[i].key_code != 0; i++) for (i=0; movement[i].vkcode != 0 || movement[i].key_code != 0; i++)
if (scanCode == movement[i].vkcode) if (scanCode == movement[i].vkcode)
return (movement[i].key_code); return (movement[i].key_code);
} }
if (asciiCode == 0) { if (asciiCode == 0) {
/* Function-key detected */ /* Function-key detected */
for (i=0; fkt_table[i].vkcode != 0 || fkt_table[i].key_code != 0; i++) for (i=0; fkt_table[i].vkcode != 0 || fkt_table[i].key_code != 0; i++)
if (scanCode == fkt_table[i].vkcode) if (scanCode == fkt_table[i].vkcode)
return (fkt_table[i].key_code); return (fkt_table[i].key_code);
/* ALT - KEY */ /* ALT - KEY */
/* if (altState) */ { /* if (altState) */ {
for (i=0; ALT_table[i].vkcode != 0 || ALT_table[i].key_code != 0; i++) for (i=0; ALT_table[i].vkcode != 0 || ALT_table[i].key_code != 0; i++)
if (scanCode == ALT_table[i].vkcode) if (scanCode == ALT_table[i].vkcode)
return (ALT_table[i].key_code); return (ALT_table[i].key_code);
} }
} }
@ -348,7 +348,7 @@ int get_event (Gpm_Event *event, int redo_event, int block)
dirty++; dirty++;
vfs_timeout_handler (); vfs_timeout_handler ();
c = block ? getch_with_delay () : get_key_code (1); c = block ? getch_with_delay () : get_key_code (1);
if (!c) { if (!c) {
/* Code is 0, so this is a Control key or mouse event */ /* Code is 0, so this is a Control key or mouse event */
@ -364,17 +364,17 @@ int mi_getch ()
{ {
Gpm_Event ev; Gpm_Event ev;
int key; int key;
while ((key = get_event (&ev, 0, 1)) == 0) while ((key = get_event (&ev, 0, 1)) == 0)
; ;
return key; return key;
} }
/* /*
is_idle - A function to check if we're idle. is_idle - A function to check if we're idle.
It checks for any waiting event (that can be a Key, Mouse event, It checks for any waiting event (that can be a Key, Mouse event,
and other internal events like focus or menu) and other internal events like focus or menu)
*/ */
int is_idle (void) int is_idle (void)
{ {

View file

@ -1,13 +1,13 @@
/* Slang interface to the Midnight Commander for Windows NT and OS/2 /* Slang interface to the Midnight Commander for Windows NT and OS/2
This emulates some features of ncurses on top of slang This emulates some features of ncurses on top of slang
S-lang is not fully consistent between its Unix and non-Unix versions. S-lang is not fully consistent between its Unix and non-Unix versions.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -60,7 +60,7 @@ int got_interrupt ()
void slang_init (void) void slang_init (void)
{ {
SLtt_get_terminfo (); SLtt_get_terminfo ();
SLang_init_tty (XCTRL('c'), 1, 0); SLang_init_tty (XCTRL('c'), 1, 0);
slang_prog_mode (); slang_prog_mode ();
load_terminfo_keys (); load_terminfo_keys ();
} }
@ -109,7 +109,7 @@ void hline (int ch, int len)
last_x = SLsmg_get_column (); last_x = SLsmg_get_column ();
last_y = SLsmg_get_row (); last_y = SLsmg_get_row ();
if (ch == 0) if (ch == 0)
ch = ACS_HLINE; ch = ACS_HLINE;
@ -145,7 +145,7 @@ int has_colors ()
/* No terminals on NT, make default color */ /* No terminals on NT, make default color */
if (!disable_colors) if (!disable_colors)
SLtt_Use_Ansi_Colors = 1; SLtt_Use_Ansi_Colors = 1;
/* Setup emulated colors */ /* Setup emulated colors */
if (SLtt_Use_Ansi_Colors){ if (SLtt_Use_Ansi_Colors){
/* DO NOT TRANSLATE WITH gettext SYNTAX coloring will be broken */ /* DO NOT TRANSLATE WITH gettext SYNTAX coloring will be broken */
@ -164,7 +164,7 @@ void attrset (int color)
SLsmg_set_color (color); SLsmg_set_color (color);
return; return;
} }
if (color & A_BOLD){ if (color & A_BOLD){
if (color == A_BOLD) if (color == A_BOLD)
SLsmg_set_color (A_BOLD); SLsmg_set_color (A_BOLD);
@ -178,7 +178,7 @@ void attrset (int color)
else else
SLsmg_set_color (color); SLsmg_set_color (color);
} }
void load_terminfo_keys () void load_terminfo_keys ()
{ {
} }

View file

@ -1,13 +1,13 @@
/* trace_nt.c - Debugging routines /* trace_nt.c - Debugging routines
for Midnight Commander, under Win32 for Midnight Commander, under Win32
Written 951215 by Juan Grigera <grigera@isis.unlp.edu.ar> Written 951215 by Juan Grigera <grigera@isis.unlp.edu.ar>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -15,7 +15,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <config.h> #include <config.h>
#ifdef HAVE_TRACE #ifdef HAVE_TRACE
@ -28,7 +28,7 @@
#include "trace_nt.h" #include "trace_nt.h"
/* Global variables */ /* Global variables */
int __win32_tracing_enabled = 1; int __win32_tracing_enabled = 1;
static int _win32_tracing_started = 0; static int _win32_tracing_started = 0;
static FILE *__win32_trace_f = NULL; static FILE *__win32_trace_f = NULL;
@ -45,7 +45,7 @@ static char *visbuf(const char *buf);
/* /*
void _win32InitTrace() void _win32InitTrace()
This func will open file TRACE_FILE for output and add _win32EndTrace to onexit This func will open file TRACE_FILE for output and add _win32EndTrace to onexit
list of funcs. list of funcs.
*/ */
static void _win32InitTrace() static void _win32InitTrace()
@ -71,7 +71,7 @@ static void _win32EndTrace()
_win32_tracing_started = 0; _win32_tracing_started = 0;
if (__win32_trace_f) if (__win32_trace_f)
fclose (__win32_trace_f); fclose (__win32_trace_f);
} }
} }
@ -102,12 +102,12 @@ void _win32Trace (const char *fmt, ...)
#endif #endif
#endif #endif
if(__win32_trace_f) if(__win32_trace_f)
fprintf (__win32_trace_f, "%s\n", vp); fprintf (__win32_trace_f, "%s\n", vp);
} }
/* /*
void SetTrace (int trace) void SetTrace (int trace)
Control debug output. Turn it of or on. Control debug output. Turn it of or on.
trace: 0 = off, 1 = on. trace: 0 = off, 1 = on.
*/ */

View file

@ -6,7 +6,7 @@
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -14,7 +14,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* ------------------------------------------------------------------------------------------ * /* ------------------------------------------------------------------------------------------ *
@ -27,11 +27,11 @@
/************************/ /************************/
/* Macros /* Macros
------ ------
win32Trace(x) - Trace macro. Use double in parenthesis for x. Same args as printf. win32Trace(x) - Trace macro. Use double in parenthesis for x. Same args as printf.
win32ASSERT(x) - assert macro, but will not abort program and output sent to trace routine. win32ASSERT(x) - assert macro, but will not abort program and output sent to trace routine.
win32APICALL(x) - Use to enclose a Win32 system call that should return TRUE. win32APICALL(x) - Use to enclose a Win32 system call that should return TRUE.
win32APICALL_HANDLE(h,api) - Use to enclose a Win32 system call that should return a handle. win32APICALL_HANDLE(h,api) - Use to enclose a Win32 system call that should return a handle.
*/ */
#define win32Trace(x) if (__win32_tracing_enabled) _win32Trace x #define win32Trace(x) if (__win32_tracing_enabled) _win32Trace x
#define win32ASSERT(x) if (!(x)) _win32DebugAssertionFailed (#x, __LINE__, __FILE__) #define win32ASSERT(x) if (!(x)) _win32DebugAssertionFailed (#x, __LINE__, __FILE__)
@ -52,7 +52,7 @@ void _win32TraceOff (void);
#define TraceOff _win32TraceOff #define TraceOff _win32TraceOff
/* Global variables */ /* Global variables */
extern int __win32_tracing_enabled; extern int __win32_tracing_enabled;
#else #else
/************************/ /************************/
@ -60,8 +60,8 @@ extern int __win32_tracing_enabled;
/************************/ /************************/
/* Wipe-out these macros */ /* Wipe-out these macros */
#define win32Trace(x) #define win32Trace(x)
#define win32ASSERT(x) #define win32ASSERT(x)
#define win32APICALL(x) x #define win32APICALL(x) x
#define win32APICALL_HANDLE(h,api) h=api; #define win32APICALL_HANDLE(h,api) h=api;

View file

@ -9,7 +9,7 @@
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -142,7 +142,7 @@ int my_system (int as_shell_command, const char *shell, const char *command)
/* .ado: temp. turn out */ /* .ado: temp. turn out */
if (as_shell_command) { if (as_shell_command) {
/* It is only the shell, /c will not work */ /* It is only the shell, /c will not work */
if (command) if (command)
spawnlp (P_WAIT, shell, shell, "/c", command, (char *) 0); spawnlp (P_WAIT, shell, shell, "/c", command, (char *) 0);
else else
spawnlp (P_WAIT, shell, (char *) 0); spawnlp (P_WAIT, shell, (char *) 0);
@ -155,11 +155,11 @@ int my_system (int as_shell_command, const char *shell, const char *command)
#endif #endif
if (as_shell_command) { if (as_shell_command) {
if (!access(command, 0)) { if (!access(command, 0)) {
switch(win32_GetEXEType (shell)) { switch(win32_GetEXEType (shell)) {
case EXE_win16: /* Windows 3.x archive or OS/2 */ case EXE_win16: /* Windows 3.x archive or OS/2 */
case EXE_win32GUI: /* NT or Chicago GUI API */ case EXE_win32GUI: /* NT or Chicago GUI API */
spawnlp (P_NOWAIT, shell, shell, "/c", command, (char *) 0); /* don't wait for GUI programs to end */ spawnlp (P_NOWAIT, shell, shell, "/c", command, (char *) 0); /* don't wait for GUI programs to end */
break; break;
case EXE_otherCUI: /* DOS COM, MZ, ZM, Phar Lap */ case EXE_otherCUI: /* DOS COM, MZ, ZM, Phar Lap */
case EXE_win32CUI: /* NT or Chicago Console API, also OS/2 */ case EXE_win32CUI: /* NT or Chicago Console API, also OS/2 */
case EXE_Unknown: case EXE_Unknown:
@ -186,7 +186,7 @@ int my_system (int as_shell_command, const char *shell, const char *command)
*/ */
char* get_default_shell() char* get_default_shell()
{ {
if (win32_GetPlatform() == OS_WinNT) if (win32_GetPlatform() == OS_WinNT)
return "cmd.exe"; return "cmd.exe";
else else
return "command.com"; return "command.com";
@ -269,7 +269,7 @@ char *canonicalize_pathname (char *path)
continue; continue;
} }
/* Handle `../' or trailing `..' by itself. /* Handle `../' or trailing `..' by itself.
Remove the previous ?/ part with the exception of Remove the previous ?/ part with the exception of
../, which we should leave intact. */ ../, which we should leave intact. */
if (path[i + 1] == '.' && (path[i + 2] == PATH_SEP || !path[i + 2])) { if (path[i + 1] == '.' && (path[i + 2] == PATH_SEP || !path[i + 2])) {
@ -291,7 +291,7 @@ char *canonicalize_pathname (char *path)
} }
#ifndef USE_VFS #ifndef USE_VFS
/* /*
int mc_rmdir (char *path); int mc_rmdir (char *path);
Fix for Win95 UGLY BUG in rmdir: it will return ENOACCESS instead Fix for Win95 UGLY BUG in rmdir: it will return ENOACCESS instead
of ENOTEMPTY. of ENOTEMPTY.
@ -354,7 +354,7 @@ static int conv_nt_unx_rc(int rc)
return errCode; return errCode;
} }
/* /*
int mc_unlink (char *pathName) int mc_unlink (char *pathName)
For Windows 95 and NT, files should be able to be deleted even For Windows 95 and NT, files should be able to be deleted even
if they don't have write-protection. We should build a question box if they don't have write-protection. We should build a question box
@ -409,7 +409,7 @@ int mc_unlink (char *pathName)
} }
} }
if (rc == TRUE) return 0; if (rc == TRUE) return 0;
else else
return -1; return -1;
} }
#endif /*USE_VFS*/ #endif /*USE_VFS*/
@ -426,9 +426,9 @@ void my_statfs (struct my_statfs *myfs_stats, char *path)
/* KBytes available */ /* KBytes available */
myfs_stats->avail = (unsigned int)( ((double)lpSectorsPerCluster * lpBytesPerSector * lpFreeClusters) / 1024 ); myfs_stats->avail = (unsigned int)( ((double)lpSectorsPerCluster * lpBytesPerSector * lpFreeClusters) / 1024 );
/* KBytes total */ /* KBytes total */
myfs_stats->total = (unsigned int)( ((double)lpSectorsPerCluster * lpBytesPerSector * lpClusters) / 1024 ); myfs_stats->total = (unsigned int)( ((double)lpSectorsPerCluster * lpBytesPerSector * lpClusters) / 1024 );
myfs_stats->nfree = lpFreeClusters; myfs_stats->nfree = lpFreeClusters;
myfs_stats->nodes = lpClusters; myfs_stats->nodes = lpClusters;
@ -493,9 +493,9 @@ void my_statfs (struct my_statfs *myfs_stats, char *path)
int gettimeofday (struct timeval* tvp, void *p) int gettimeofday (struct timeval* tvp, void *p)
{ {
if (p != NULL) if (p != NULL)
return 0; return 0;
/* Since MC only calls this func from get_random_hint we return /* Since MC only calls this func from get_random_hint we return
some value, not exactly the "correct" one */ some value, not exactly the "correct" one */
tvp->tv_sec = GetTickCount()/1000; /* Number of milliseconds since Windows //started*/ tvp->tv_sec = GetTickCount()/1000; /* Number of milliseconds since Windows //started*/
tvp->tv_usec = GetTickCount(); tvp->tv_usec = GetTickCount();
@ -503,7 +503,7 @@ int gettimeofday (struct timeval* tvp, void *p)
/* FAKE functions */ /* FAKE functions */
int int
look_for_exe(const char* pathname) look_for_exe(const char* pathname)
{ {
int j; int j;
@ -517,9 +517,9 @@ look_for_exe(const char* pathname)
for (j=0; j<lgh-4; j++) { for (j=0; j<lgh-4; j++) {
p++; p++;
} /* endfor */ } /* endfor */
if (!stricmp(p, ".exe") || if (!stricmp(p, ".exe") ||
!stricmp(p, ".bat") || !stricmp(p, ".bat") ||
!stricmp(p, ".com") || !stricmp(p, ".com") ||
!stricmp(p, ".cmd")) { !stricmp(p, ".cmd")) {
return 1; return 1;
} }
@ -527,7 +527,7 @@ look_for_exe(const char* pathname)
return 0; return 0;
} }
int int
lstat (const char* pathname, struct stat *buffer) lstat (const char* pathname, struct stat *buffer)
{ {
int rc = stat (pathname, buffer); int rc = stat (pathname, buffer);
@ -543,7 +543,7 @@ lstat (const char* pathname, struct stat *buffer)
return rc; return rc;
} }
int getuid () int getuid ()
{ {
/* SID sid; /* SID sid;
LookupAccountName (NULL, &sid... LookupAccountName (NULL, &sid...
@ -552,7 +552,7 @@ int getuid ()
return 0; return 0;
} }
int getgid () int getgid ()
{ {
return 0; return 0;
} }
@ -638,13 +638,13 @@ int mc_doublepopen (int inhandle, int inlen, pid_t *the_pid, char *command, ...)
// Duplicate copy of original stdout back into stdout // Duplicate copy of original stdout back into stdout
if(_dup2(std_sav[1], _fileno(stdout)) != 0) if(_dup2(std_sav[1], _fileno(stdout)) != 0)
exit (1); exit (1);
// Close duplicate copy of original stdout and stdin // Close duplicate copy of original stdout and stdin
close(std_sav[0]); close(std_sav[0]);
close(std_sav[1]); close(std_sav[1]);
while ((i = _read (inhandle, buffer, while ((i = _read (inhandle, buffer,
(inlen == -1 || inlen > 8192) (inlen == -1 || inlen > 8192)
? 8192 : inlen)) > 0) { ? 8192 : inlen)) > 0) {
write (pipe0 [1], buffer, i); write (pipe0 [1], buffer, i);
if (inlen != -1) { if (inlen != -1) {
@ -662,10 +662,10 @@ int mc_doublepopen (int inhandle, int inlen, pid_t *the_pid, char *command, ...)
int mc_doublepclose (int pipe, pid_t pid) int mc_doublepclose (int pipe, pid_t pid)
{ {
int status = 0; int status = 0;
close (pipe); close (pipe);
_cwait ( &status, pid, 0); _cwait ( &status, pid, 0);
return status; return status;
} }
/*hacks to get it compile, remove these after vfs works */ /*hacks to get it compile, remove these after vfs works */

View file

@ -9,7 +9,7 @@
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -75,19 +75,19 @@ static int old_error; /* File descriptor of old standard error */
/* Creates a pipe to hold standard error for a later analysis. */ /* Creates a pipe to hold standard error for a later analysis. */
/* The pipe can hold 4096 bytes. Make sure no more is written */ /* The pipe can hold 4096 bytes. Make sure no more is written */
/* or a deadlock might occur. */ /* or a deadlock might occur. */
void void
open_error_pipe (void) open_error_pipe (void)
{ {
return; return;
} }
void void
close_error_pipe (int error, char *text) close_error_pipe (int error, char *text)
{ {
return; return;
} }
void void
check_error_pipe (void) check_error_pipe (void)
{ {
char error[MAX_PIPE_SIZE]; char error[MAX_PIPE_SIZE];
@ -110,7 +110,7 @@ check_error_pipe (void)
} }
static int static int
StartWindowsProg (char *name, SHORT type) StartWindowsProg (char *name, SHORT type)
{ {
#if 0 /* FIXME: PM DDL's should be loaded (or not loaded) at run time */ #if 0 /* FIXME: PM DDL's should be loaded (or not loaded) at run time */
@ -141,25 +141,25 @@ StartWindowsProg (char *name, SHORT type)
pDetails.progt.progc = PROG_31_ENHSEAMLESSCOMMON ; pDetails.progt.progc = PROG_31_ENHSEAMLESSCOMMON ;
break; break;
} }
WinStartApp(NULLHANDLE, WinStartApp(NULLHANDLE,
&pDetails, &pDetails,
NULL, NULL,
NULL, NULL,
SAF_INSTALLEDCMDLINE|SAF_STARTCHILDAPP) ; SAF_INSTALLEDCMDLINE|SAF_STARTCHILDAPP) ;
#endif #endif
return 0; return 0;
} }
static int static int
os2_system (int as_shell_command, const char *shell, const char *command, char *parm); os2_system (int as_shell_command, const char *shell, const char *command, char *parm);
/* /*
as_shell_command = 1: If a program is started during input line, CTRL-O as_shell_command = 1: If a program is started during input line, CTRL-O
or RETURN or RETURN
= 0: F3, F4 = 0: F3, F4
*/ */
int int
my_system (int as_shell_command, const char *shell, const char *command) my_system (int as_shell_command, const char *shell, const char *command)
{ {
char *sh; /* This is the shell -- always! */ char *sh; /* This is the shell -- always! */
@ -170,9 +170,9 @@ my_system (int as_shell_command, const char *shell, const char *command)
sh = get_default_shell(); sh = get_default_shell();
if (strcmp(sh, shell)) { if (strcmp(sh, shell)) {
/* /*
Not equal -- That means: shell is the program and command is the Not equal -- That means: shell is the program and command is the
parameter parameter
*/ */
cmd = (char *) shell; cmd = (char *) shell;
parm = (char *) command; parm = (char *) command;
@ -185,7 +185,7 @@ my_system (int as_shell_command, const char *shell, const char *command)
if (command[i] == ' ') { if (command[i] == ' ') {
temp[i] = (char) 0; temp[i] = (char) 0;
length--; length--;
} else } else
break; break;
} }
if (i==-1) { if (i==-1) {
@ -205,30 +205,30 @@ my_system (int as_shell_command, const char *shell, const char *command)
return os2_system (as_shell_command, sh, cmd, parm); return os2_system (as_shell_command, sh, cmd, parm);
} }
static int static int
ux_startp (const char *shell, const char *command, const char *parm) ux_startp (const char *shell, const char *command, const char *parm)
{ {
if (parm) { if (parm) {
spawnlp (P_WAIT, spawnlp (P_WAIT,
(char *) shell, (char *) shell,
(char *) shell, (char *) shell,
"/c", "/c",
(char *) command, (char *) command,
(char *) parm, (char *) parm,
(char *) 0); (char *) 0);
} else { } else {
spawnlp (P_WAIT, spawnlp (P_WAIT,
(char *) shell, (char *) shell,
(char *) shell, (char *) shell,
"/c", "/c",
(char *) command, (char *) command,
(char *) 0); (char *) 0);
} }
return 0; return 0;
} }
static int static int
os2_system (int as_shell_command, const char *shell, const char *command, char *parm) os2_system (int as_shell_command, const char *shell, const char *command, char *parm)
{ {
register int i, j; register int i, j;
@ -236,7 +236,7 @@ os2_system (int as_shell_command, const char *shell, const char *command, char *
APIRET rc = NO_ERROR; /* Return Code */ APIRET rc = NO_ERROR; /* Return Code */
char pathValue[5] = "PATH"; /* For DosSearchPath */ char pathValue[5] = "PATH"; /* For DosSearchPath */
UCHAR searchResult[MC_MAXPATHLEN * 2 + 1]; /* For DosSearchPath */ UCHAR searchResult[MC_MAXPATHLEN * 2 + 1]; /* For DosSearchPath */
char *cmdString; char *cmdString;
char *postFix[3]; char *postFix[3];
char *line; char *line;
@ -248,26 +248,26 @@ os2_system (int as_shell_command, const char *shell, const char *command, char *
if (command == NULL) { if (command == NULL) {
/* .ado: just start a shell, we don't need the parameter */ /* .ado: just start a shell, we don't need the parameter */
spawnl (P_WAIT, spawnl (P_WAIT,
(char *) shell, (char *) shell,
(char *) shell, (char *) shell,
(char *) command, (char *) 0); (char *) command, (char *) 0);
return 0; return 0;
} }
memset(&StartData, 0, sizeof(StartData)) ; memset(&StartData, 0, sizeof(StartData)) ;
StartData.Length = sizeof(StartData); StartData.Length = sizeof(StartData);
StartData.Related = SSF_RELATED_CHILD; StartData.Related = SSF_RELATED_CHILD;
StartData.FgBg = SSF_FGBG_BACK; StartData.FgBg = SSF_FGBG_BACK;
StartData.TraceOpt = SSF_TRACEOPT_NONE; StartData.TraceOpt = SSF_TRACEOPT_NONE;
StartData.PgmTitle = NULL; StartData.PgmTitle = NULL;
StartData.TermQ = NULL; StartData.TermQ = NULL;
StartData.InheritOpt = SSF_INHERTOPT_PARENT; StartData.InheritOpt = SSF_INHERTOPT_PARENT;
StartData.IconFile = 0; StartData.IconFile = 0;
StartData.PgmHandle = 0; StartData.PgmHandle = 0;
StartData.PgmControl = SSF_CONTROL_VISIBLE ; StartData.PgmControl = SSF_CONTROL_VISIBLE ;
StartData.ObjectBuffer = ObjBuf; StartData.ObjectBuffer = ObjBuf;
StartData.ObjectBuffLen = 100; StartData.ObjectBuffLen = 100;
StartData.PgmInputs = parm; StartData.PgmInputs = parm;
postFix[0] = ".exe"; postFix[0] = ".exe";
@ -300,7 +300,7 @@ os2_system (int as_shell_command, const char *shell, const char *command, char *
sizeof(searchResult)); sizeof(searchResult));
} }
free (line); free (line);
} else { } else {
/* Just search */ /* Just search */
rc = DosSearchPath((SEARCH_IGNORENETERRS | SEARCH_ENVIRONMENT | SEARCH_CUR_DIRECTORY), rc = DosSearchPath((SEARCH_IGNORENETERRS | SEARCH_ENVIRONMENT | SEARCH_CUR_DIRECTORY),
(PSZ) pathValue, (PSZ) pathValue,
@ -350,9 +350,9 @@ os2_system (int as_shell_command, const char *shell, const char *command, char *
} else { } else {
/* It's not a known exe type or it's a CMD/BAT file */ /* It's not a known exe type or it's a CMD/BAT file */
i = strlen(searchResult); i = strlen(searchResult);
if ((toupper(searchResult[--i]) == 'T') && if ((toupper(searchResult[--i]) == 'T') &&
(toupper(searchResult[--i]) == 'A') && (toupper(searchResult[--i]) == 'A') &&
(toupper(searchResult[--i]) == 'B') && (toupper(searchResult[--i]) == 'B') &&
(searchResult[--i] == '.') ) { (searchResult[--i] == '.') ) {
StartData.SessionType = PROG_WINDOWEDVDM; StartData.SessionType = PROG_WINDOWEDVDM;
rc = DosStartSession(&StartData, &SessionID, &pid) ; rc = DosStartSession(&StartData, &SessionID, &pid) ;
@ -432,7 +432,7 @@ canonicalize_pathname (char *path)
continue; continue;
} }
/* Handle `../' or trailing `..' by itself. /* Handle `../' or trailing `..' by itself.
Remove the previous ?/ part with the exception of Remove the previous ?/ part with the exception of
../, which we should leave intact. */ ../, which we should leave intact. */
if (path[i + 1] == '.' && (path[i + 2] == PATH_SEP || !path[i + 2])) { if (path[i + 1] == '.' && (path[i + 2] == PATH_SEP || !path[i + 2])) {
@ -454,7 +454,7 @@ canonicalize_pathname (char *path)
} }
void void
my_statfs (struct my_statfs *myfs_stats, char *path) my_statfs (struct my_statfs *myfs_stats, char *path)
{ {
PFSALLOCATE pBuf; PFSALLOCATE pBuf;
@ -483,15 +483,15 @@ my_statfs (struct my_statfs *myfs_stats, char *path)
/* KBytes available */ /* KBytes available */
myfs_stats->avail = pBuf->cSectorUnit * pBuf->cUnitAvail * pBuf->cbSector / 1024; myfs_stats->avail = pBuf->cSectorUnit * pBuf->cUnitAvail * pBuf->cbSector / 1024;
/* KBytes total */ /* KBytes total */
myfs_stats->total = pBuf->cSectorUnit * pBuf->cUnit * pBuf->cbSector / 1024; myfs_stats->total = pBuf->cSectorUnit * pBuf->cUnit * pBuf->cbSector / 1024;
myfs_stats->nfree = pBuf->cUnitAvail; myfs_stats->nfree = pBuf->cUnitAvail;
myfs_stats->nodes = pBuf->cbSector; myfs_stats->nodes = pBuf->cbSector;
lghBuf = sizeof(FSINFO); lghBuf = sizeof(FSINFO);
pFsInfo = (PFSINFO) malloc(lghBuf); pFsInfo = (PFSINFO) malloc(lghBuf);
rc = DosQueryFSInfo(0L, rc = DosQueryFSInfo(0L,
FSIL_VOLSER, FSIL_VOLSER,
(PVOID) pFsInfo, (PVOID) pFsInfo,
lghBuf); lghBuf);
/* Get name */ /* Get name */
myfs_stats->device = strdup(pFsInfo->vol.szVolLabel); /* Label of the Disk */ myfs_stats->device = strdup(pFsInfo->vol.szVolLabel); /* Label of the Disk */
@ -501,10 +501,10 @@ my_statfs (struct my_statfs *myfs_stats, char *path)
szDeviceName[0] = (UCHAR) (diskNum + (ULONG) 'A' - 1); szDeviceName[0] = (UCHAR) (diskNum + (ULONG) 'A' - 1);
/* Now get the type of the disk */ /* Now get the type of the disk */
rc = DosQueryFSAttach(szDeviceName, rc = DosQueryFSAttach(szDeviceName,
0L, 0L,
FSAIL_QUERYNAME, FSAIL_QUERYNAME,
pfsqBuffer, pfsqBuffer,
&cbBuffer); &cbBuffer);
pszFSDName = pfsqBuffer->szName + pfsqBuffer->cbName + 1; pszFSDName = pfsqBuffer->szName + pfsqBuffer->cbName + 1;
@ -524,14 +524,14 @@ my_statfs (struct my_statfs *myfs_stats, char *path)
free(pFsInfo); free(pFsInfo);
} }
int int
gettimeofday (struct timeval* tvp, void *p) gettimeofday (struct timeval* tvp, void *p)
{ {
DATETIME pdt = {0}; DATETIME pdt = {0};
if (p != NULL) /* what is "p"? */ if (p != NULL) /* what is "p"? */
return 0; return 0;
/* Since MC only calls this func from get_random_hint we return /* Since MC only calls this func from get_random_hint we return
* some value, not exactly the "correct" one * some value, not exactly the "correct" one
*/ */
DosGetDateTime(&pdt); DosGetDateTime(&pdt);
@ -543,7 +543,7 @@ gettimeofday (struct timeval* tvp, void *p)
/* FAKE functions */ /* FAKE functions */
int int
look_for_exe(const char* pathname) look_for_exe(const char* pathname)
{ {
int j; int j;
@ -557,9 +557,9 @@ look_for_exe(const char* pathname)
for (j=0; j<lgh-4; j++) { for (j=0; j<lgh-4; j++) {
p++; p++;
} }
if (!stricmp(p, ".exe") || if (!stricmp(p, ".exe") ||
!stricmp(p, ".bat") || !stricmp(p, ".bat") ||
!stricmp(p, ".com") || !stricmp(p, ".com") ||
!stricmp(p, ".cmd")) { !stricmp(p, ".cmd")) {
return 1; return 1;
} }
@ -567,7 +567,7 @@ look_for_exe(const char* pathname)
return 0; return 0;
} }
int int
lstat (const char* pathname, struct stat *buffer) lstat (const char* pathname, struct stat *buffer)
{ {
int rc = stat (pathname, buffer); int rc = stat (pathname, buffer);
@ -583,61 +583,61 @@ lstat (const char* pathname, struct stat *buffer)
return rc; return rc;
} }
int int
getuid () getuid ()
{ {
return 0; return 0;
} }
int int
getgid () getgid ()
{ {
return 0; return 0;
} }
int int
readlink (char* path, char* buf, int size) readlink (char* path, char* buf, int size)
{ {
return -1; return -1;
} }
int int
symlink (char *n1, char *n2) symlink (char *n1, char *n2)
{ {
return -1; return -1;
} }
int int
link (char *p1, char *p2) link (char *p1, char *p2)
{ {
return -1; return -1;
} }
int int
chown (char *path, int owner, int group) chown (char *path, int owner, int group)
{ {
return -1; return -1;
} }
int int
mknod (char *path, int mode, int dev) mknod (char *path, int mode, int dev)
{ {
return -1; return -1;
} }
void void
init_uid_gid_cache (void) init_uid_gid_cache (void)
{ {
return; return;
} }
int int
mc_doublepopen (int inhandle, int inlen, pid_t *the_pid, char *command, ...) mc_doublepopen (int inhandle, int inlen, pid_t *the_pid, char *command, ...)
{ {
return 0; return 0;
} }
int int
mc_doublepclose (int pipe, pid_t pid) mc_doublepclose (int pipe, pid_t pid)
{ {
return 0; return 0;
@ -650,13 +650,13 @@ vfs_get_current_dir (void)
return NULL; return NULL;
} }
int int
vfs_current_is_extfs (void) vfs_current_is_extfs (void)
{ {
return 0; return 0;
} }
int int
vfs_file_is_ftp (char *filename) vfs_file_is_ftp (char *filename)
{ {
return 0; return 0;
@ -695,7 +695,7 @@ mc_chdir(char *pathname)
/* First set the default drive */ /* First set the default drive */
if (lgh > 1) { if (lgh > 1) {
if (pathname[1] == ':') { if (pathname[1] == ':') {
ret = DosSetDefaultDisk(toupper(pathname[0]) - 'A' + 1); ret = DosSetDefaultDisk(toupper(pathname[0]) - 'A' + 1);
} }
} }
/* After that, set the current dir! */ /* After that, set the current dir! */
@ -703,7 +703,7 @@ mc_chdir(char *pathname)
} }
return ret; return ret;
} }
int int
mc_chmod(char *pathName, int unxmode) mc_chmod(char *pathName, int unxmode)
{ {
@ -731,7 +731,7 @@ conv_os2_unx_rc(int os2rc)
case ERROR_INVALID_PARAMETER: case ERROR_INVALID_PARAMETER:
errCode = EINVAL; errCode = EINVAL;
break; break;
default: default:
errCode = EINVAL; errCode = EINVAL;
break; break;
} }
@ -747,7 +747,7 @@ mc_open (char *file, int flags, int pmode)
int int
mc_unlink(char *pathName) mc_unlink(char *pathName)
{ {
/* Use OS/2 API to delete a file, if the file is set as read-only, /* Use OS/2 API to delete a file, if the file is set as read-only,
the file will be deleted without asking the user! */ the file will be deleted without asking the user! */
APIRET rc; APIRET rc;
rc = DosDelete(pathName); rc = DosDelete(pathName);
@ -776,7 +776,7 @@ get_default_editor (void)
APIRET rc; APIRET rc;
char pathValue[5] = "PATH"; char pathValue[5] = "PATH";
UCHAR searchResult[MC_MAXPATHLEN + 1]; UCHAR searchResult[MC_MAXPATHLEN + 1];
/* EPM is not always be installed */ /* EPM is not always be installed */
rc = DosSearchPath((SEARCH_IGNORENETERRS | SEARCH_ENVIRONMENT | SEARCH_CUR_DIRECTORY), rc = DosSearchPath((SEARCH_IGNORENETERRS | SEARCH_ENVIRONMENT | SEARCH_CUR_DIRECTORY),
(PSZ) pathValue, (PSZ) pathValue,

View file

@ -7,7 +7,7 @@
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -15,7 +15,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <config.h> #include <config.h>
@ -39,8 +39,8 @@ int win32_GetPlatform ()
return (platform ? platform : (platform = win32_GetVersionEx()) ); return (platform ? platform : (platform = win32_GetVersionEx()) );
} }
/* int win32_GetVersionEx () /* int win32_GetVersionEx ()
intended for use by win32_GetPlatform only intended for use by win32_GetPlatform only
*/ */
int win32_GetVersionEx () int win32_GetVersionEx ()
{ {
@ -177,7 +177,7 @@ int win32_GetEXEType (const char* a_szFileName)
return EXE_Unknown; /* FIXME: what is "NATIVE??" */ return EXE_Unknown; /* FIXME: what is "NATIVE??" */
default: default:
win32Trace(("Unknown type %u.\n", image_optional_header.Subsystem)); win32Trace(("Unknown type %u.\n", image_optional_header.Subsystem));
return EXE_Unknown; return EXE_Unknown;
} }
#else #else
return EXE_Unknown; return EXE_Unknown;

View file

@ -8,7 +8,7 @@
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -16,7 +16,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* Prototypes */ /* Prototypes */

View file

@ -7,7 +7,7 @@
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -15,7 +15,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <config.h> #include <config.h>
#include <windows.h> #include <windows.h>
@ -29,7 +29,7 @@
0 if not 0 if not
Note: Code taken from MSKbase Number: Q118626. Note: Code taken from MSKbase Number: Q118626.
To determine whether or not a user is an administrator, you need to examine To determine whether or not a user is an administrator, you need to examine
the user's access token with GetTokenInformation(). The access token the user's access token with GetTokenInformation(). The access token
represents the user's privileges and the groups to which the user belongs. represents the user's privileges and the groups to which the user belongs.
@ -76,7 +76,7 @@ int winnt_IsAdministrator()
} }
int geteuid () int geteuid ()
{ {
if (winnt_IsAdministrator()) if (winnt_IsAdministrator())
return 0; return 0;

View file

@ -2,7 +2,7 @@
need. Use slang.h for that purpose. */ need. Use slang.h for that purpose. */
/* Copyright (c) 1992, 1995 John E. Davis /* Copyright (c) 1992, 1995 John E. Davis
* All rights reserved. * All rights reserved.
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Perl Artistic License. * License or the Perl Artistic License.
*/ */
@ -34,7 +34,7 @@
/* These quantities are main_types for byte-compiled code. They are used /* These quantities are main_types for byte-compiled code. They are used
* by the inner_interp routine. The ones commented out with a // are * by the inner_interp routine. The ones commented out with a // are
* actually defined in slang.h because they are also used as the main_type in * actually defined in slang.h because they are also used as the main_type in
* the name table. * the name table.
*/ */
@ -156,7 +156,7 @@ typedef struct SLBlock_Type
{ {
unsigned char main_type; unsigned char main_type;
unsigned char sub_type; unsigned char sub_type;
union union
{ {
struct SLBlock_Type *blk; struct SLBlock_Type *blk;
int i_blk; int i_blk;
@ -290,7 +290,7 @@ extern void SLang_push_float(float64);
extern void SLadd_variable(char *); extern void SLadd_variable(char *);
extern void SLang_clear_error(void); extern void SLang_clear_error(void);
extern void SLarray_info (void); extern void SLarray_info (void);
extern int SLPreprocess_Only; /* preprocess instead of extern int SLPreprocess_Only; /* preprocess instead of
* bytecompiling * bytecompiling
*/ */

View file

@ -1,7 +1,7 @@
#ifndef _JD_MACROS_H_ #ifndef _JD_MACROS_H_
#define _JD_MACROS_H_ #define _JD_MACROS_H_
/* This file defines some macros that I use with programs that link to /* This file defines some macros that I use with programs that link to
* the slang library. * the slang library.
*/ */
@ -15,7 +15,7 @@
#ifdef HAVE_MEMORY_H #ifdef HAVE_MEMORY_H
# include <memory.h> # include <memory.h>
#endif #endif
#ifndef SLMEMSET #ifndef SLMEMSET
# ifdef HAVE_MEMSET # ifdef HAVE_MEMSET

View file

@ -3,7 +3,7 @@
/* -*- mode: C; mode: fold; -*- */ /* -*- mode: C; mode: fold; -*- */
/* Copyright (c) 1992, 1995 John E. Davis /* Copyright (c) 1992, 1995 John E. Davis
* All rights reserved. * All rights reserved.
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Perl Artistic License. * License or the Perl Artistic License.
*/ */
@ -96,13 +96,13 @@ extern "C" {
# define VOID unsigned char # define VOID unsigned char
# endif # endif
#endif #endif
#if 1 #if 1
typedef int (*FVOID_STAR)(void); typedef int (*FVOID_STAR)(void);
#else #else
# define FVOID_STAR VOID_STAR # define FVOID_STAR VOID_STAR
#endif #endif
#if defined(msdos) && !defined(DOS386) && !defined(__GO32__) && !defined(__WIN32__) #if defined(msdos) && !defined(DOS386) && !defined(__GO32__) && !defined(__WIN32__)
# define SLFREE(buf) farfree((void far *)(buf)) # define SLFREE(buf) farfree((void far *)(buf))
# define SLMALLOC(x) farmalloc((unsigned long) (x)) # define SLMALLOC(x) farmalloc((unsigned long) (x))
@ -136,7 +136,7 @@ extern "C" {
# define SLCALLOC(n, m) SLdebug_calloc((unsigned long) (n), (unsigned long)(m)) # define SLCALLOC(n, m) SLdebug_calloc((unsigned long) (n), (unsigned long)(m))
# define SLREALLOC(p, x) SLdebug_realloc((unsigned char *)(p), (unsigned long)(x)) # define SLREALLOC(p, x) SLdebug_realloc((unsigned char *)(p), (unsigned long)(x))
#endif /* SL_MALLOC_DEBUG */ #endif /* SL_MALLOC_DEBUG */
extern unsigned char *SLdebug_malloc (unsigned long); extern unsigned char *SLdebug_malloc (unsigned long);
extern unsigned char *SLdebug_calloc (unsigned long, unsigned long); extern unsigned char *SLdebug_calloc (unsigned long, unsigned long);
extern unsigned char *SLdebug_realloc (unsigned char *, unsigned long); extern unsigned char *SLdebug_realloc (unsigned char *, unsigned long);
@ -145,7 +145,7 @@ extern "C" {
extern char *SLstrcpy(register char *, register char *); extern char *SLstrcpy(register char *, register char *);
extern int SLstrcmp(register char *, register char *); extern int SLstrcmp(register char *, register char *);
extern char *SLstrncpy(char *, register char *, register int); extern char *SLstrncpy(char *, register char *, register int);
extern void SLmemset (char *, char, int); extern void SLmemset (char *, char, int);
extern char *SLmemchr (register char *, register char, register int); extern char *SLmemchr (register char *, register char, register int);
extern char *SLmemcpy (char *, char *, int); extern char *SLmemcpy (char *, char *, int);
@ -154,7 +154,7 @@ extern "C" {
#ifdef float64 #ifdef float64
# undef float64 # undef float64
#endif #endif
#ifndef FLOAT64_TYPEDEFED #ifndef FLOAT64_TYPEDEFED
# define FLOAT64_TYPEDEFED # define FLOAT64_TYPEDEFED
typedef double float64; typedef double float64;
@ -182,7 +182,7 @@ typedef struct SLang_Name_Type
char name[SLANG_MAX_NAME_LEN + 2]; /* [0] is hash */ char name[SLANG_MAX_NAME_LEN + 2]; /* [0] is hash */
unsigned char sub_type; unsigned char sub_type;
/* Values for main_type may be as follows. The particlular values are /* Values for main_type may be as follows. The particlular values are
* for compatability. * for compatability.
*/ */
@ -204,9 +204,9 @@ typedef struct SLang_Load_Type
{ {
long name; /* file name, string address, ... */ long name; /* file name, string address, ... */
long handle; /* FILE *, string address, etc... */ long handle; /* FILE *, string address, etc... */
char *ptr; /* input pointer to next line in object char *ptr; /* input pointer to next line in object
* to be read. * to be read.
*/ */
/* Things below here are used by S-Lang. */ /* Things below here are used by S-Lang. */
int type; /* 'F' = file, 'S' = String, etc.. */ int type; /* 'F' = file, 'S' = String, etc.. */
@ -215,7 +215,7 @@ typedef struct SLang_Load_Type
int n; /* line number, etc... */ int n; /* line number, etc... */
char token[256]; /* token to be parsed */ char token[256]; /* token to be parsed */
int ofs; /* offset from buf where last read int ofs; /* offset from buf where last read
* took place * took place
*/ */
int top_level; /* 1 if at top level of parsing */ int top_level; /* 1 if at top level of parsing */
} SLang_Load_Type; } SLang_Load_Type;
@ -225,8 +225,8 @@ typedef struct SLang_Load_Type
# define NO_PROTOTYPES # define NO_PROTOTYPES
# endif # endif
#endif #endif
#ifndef NO_PROTOTYPES #ifndef NO_PROTOTYPES
# define _PROTO(x) x # define _PROTO(x) x
#else #else
# define _PROTO(x) () # define _PROTO(x) ()
@ -235,14 +235,14 @@ typedef struct SLang_Load_Type
typedef struct SL_OOBinary_Type typedef struct SL_OOBinary_Type
{ {
unsigned char sub_type; /* partner type for binary op */ unsigned char sub_type; /* partner type for binary op */
/* The function take the binary op as first argument, the operand types /* The function take the binary op as first argument, the operand types
* form the second and third parameters and the last two parameters are * form the second and third parameters and the last two parameters are
* pointers to the objects themselves. It is up to the function to push * pointers to the objects themselves. It is up to the function to push
* the result on the stack. It must return 1 if it handled the operation * the result on the stack. It must return 1 if it handled the operation
* return zero if the operation is not defined. * return zero if the operation is not defined.
*/ */
int (*binary_function)_PROTO((int, unsigned char, unsigned char, int (*binary_function)_PROTO((int, unsigned char, unsigned char,
VOID_STAR, VOID_STAR)); VOID_STAR, VOID_STAR));
struct SL_OOBinary_Type *next; struct SL_OOBinary_Type *next;
@ -259,13 +259,13 @@ typedef struct
int (*unary_function)_PROTO((int, unsigned char, VOID_STAR)); int (*unary_function)_PROTO((int, unsigned char, VOID_STAR));
/* unary operation function */ /* unary operation function */
SL_OOBinary_Type *binary_ops; SL_OOBinary_Type *binary_ops;
int (*copy_function)_PROTO((unsigned char, VOID_STAR)); int (*copy_function)_PROTO((unsigned char, VOID_STAR));
/* This function is called do make a copy of the object */ /* This function is called do make a copy of the object */
} SLang_Class_Type; } SLang_Class_Type;
extern SLang_Class_Type *SLang_Registered_Types[256]; extern SLang_Class_Type *SLang_Registered_Types[256];
typedef struct typedef struct
{ {
unsigned char main_type; /* SLANG_RVARIABLE, etc.. */ unsigned char main_type; /* SLANG_RVARIABLE, etc.. */
@ -277,7 +277,7 @@ typedef struct
} }
SLuser_Object_Type; SLuser_Object_Type;
/*}}}*/ /*}}}*/
/*{{{ Interpreter Function Prototypes */ /*{{{ Interpreter Function Prototypes */
@ -285,7 +285,7 @@ SLuser_Object_Type;
/* Non zero if error occurs. Must be reset to zero to continue. */ /* Non zero if error occurs. Must be reset to zero to continue. */
extern int SLang_Traceback; extern int SLang_Traceback;
/* If non-zero, dump an S-Lang traceback upon error. Available as /* If non-zero, dump an S-Lang traceback upon error. Available as
_traceback in S-Lang. */ _traceback in S-Lang. */
extern char *SLang_User_Prompt; extern char *SLang_User_Prompt;
@ -299,16 +299,16 @@ SLuser_Object_Type;
extern void (*SLang_Exit_Error_Hook)(char *); extern void (*SLang_Exit_Error_Hook)(char *);
extern void SLang_exit_error (char *); extern void SLang_exit_error (char *);
extern void (*SLang_Dump_Routine)(char *); extern void (*SLang_Dump_Routine)(char *);
/* Called if S-Lang traceback is enabled as well as other debugging /* Called if S-Lang traceback is enabled as well as other debugging
routines (e.g., trace). By default, these messages go to stderr. */ routines (e.g., trace). By default, these messages go to stderr. */
extern void (*SLang_Interrupt)(void); extern void (*SLang_Interrupt)(void);
/* function to call whenever inner interpreter is entered. This is /* function to call whenever inner interpreter is entered. This is
a good place to set SLang_Error to USER_BREAK. */ a good place to set SLang_Error to USER_BREAK. */
extern void (*SLang_User_Clear_Error)(void); extern void (*SLang_User_Clear_Error)(void);
/* function that gets called when '_clear_error' is called. */ /* function that gets called when '_clear_error' is called. */
extern int (*SLang_User_Open_Slang_Object)(SLang_Load_Type *); extern int (*SLang_User_Open_Slang_Object)(SLang_Load_Type *);
extern int (*SLang_User_Close_Slang_Object)(SLang_Load_Type *); extern int (*SLang_User_Close_Slang_Object)(SLang_Load_Type *);
/* user defined loading routines. */ /* user defined loading routines. */
@ -320,7 +320,7 @@ SLuser_Object_Type;
/* Functions: */ /* Functions: */
extern int init_SLang(void); extern int init_SLang(void);
/* This function is mandatory and must be called by all applications */ /* This function is mandatory and must be called by all applications */
extern int init_SLfiles(void); extern int init_SLfiles(void);
/* called if fputs, fgets, etc are need in S-Lang */ /* called if fputs, fgets, etc are need in S-Lang */
@ -331,10 +331,10 @@ SLuser_Object_Type;
/* unix system functions chmod, stat, etc... */ /* unix system functions chmod, stat, etc... */
extern int init_SLmatrix(void); extern int init_SLmatrix(void);
extern int SLang_add_table(SLang_Name_Type *, char *); extern int SLang_add_table(SLang_Name_Type *, char *);
/* add application dependent function table p1 to S-Lang. A name p2 less /* add application dependent function table p1 to S-Lang. A name p2 less
* than 32 characters must also be supplied. * than 32 characters must also be supplied.
* Returns 0 upon failure or 1 upon success. */ * Returns 0 upon failure or 1 upon success. */
extern int SLang_add_global_variable (char *); extern int SLang_add_global_variable (char *);
@ -345,28 +345,28 @@ SLuser_Object_Type;
extern void SLang_restart(int); extern void SLang_restart(int);
/* should be called if an error occurs. If the passed integer is /* should be called if an error occurs. If the passed integer is
* non-zero, items are popped off the stack; otherwise, the stack is * non-zero, items are popped off the stack; otherwise, the stack is
* left intact. Any time the stack is believed to be trashed, this routine * left intact. Any time the stack is believed to be trashed, this routine
* should be called with a non-zero argument (e.g., if setjmp/longjmp is * should be called with a non-zero argument (e.g., if setjmp/longjmp is
* called). */ * called). */
extern void SLang_byte_compile_file(char *, int *); extern void SLang_byte_compile_file(char *, int *);
/* takes a file of S-Lang code and ``byte-compiles'' it for faster /* takes a file of S-Lang code and ``byte-compiles'' it for faster
* loading. The new filename is equivalent to the old except that a `c' is * loading. The new filename is equivalent to the old except that a `c' is
* appended to the name. (e.g., init.sl --> init.slc). If the second * appended to the name. (e.g., init.sl --> init.slc). If the second
* parameter is non-zero, preprocess the file only. * parameter is non-zero, preprocess the file only.
*/ */
extern void SLang_autoload(char *, char *); extern void SLang_autoload(char *, char *);
/* Automatically load S-Lang function p1 from file p2. This function /* Automatically load S-Lang function p1 from file p2. This function
is also available via S-Lang */ is also available via S-Lang */
extern char *SLang_load_string(char *); extern char *SLang_load_string(char *);
/* Like SLang_load_file except input is from a null terminated string. */ /* Like SLang_load_file except input is from a null terminated string. */
extern void SLang_do_pop(void); extern void SLang_do_pop(void);
/* pops item off stack and frees any memory associated with it */ /* pops item off stack and frees any memory associated with it */
extern int SLang_pop_integer(int *); extern int SLang_pop_integer(int *);
/* pops integer *p0 from the stack. Returns 0 upon success and non-zero /* pops integer *p0 from the stack. Returns 0 upon success and non-zero
* if the stack is empty or a type mismatch occurs, setting SLang_Error. * if the stack is empty or a type mismatch occurs, setting SLang_Error.
@ -377,11 +377,11 @@ SLuser_Object_Type;
/* pops string *p0 from stack. If *p1 is non-zero, the string must be /* pops string *p0 from stack. If *p1 is non-zero, the string must be
* freed after its use. DO NOT FREE p0 if *p1 IS ZERO! Returns 0 upon * freed after its use. DO NOT FREE p0 if *p1 IS ZERO! Returns 0 upon
* success */ * success */
extern int SLang_pop_float(float64 *, int *, int *); extern int SLang_pop_float(float64 *, int *, int *);
/* Pops float *p1 from stack. If *p3 is non-zero, *p1 was derived /* Pops float *p1 from stack. If *p3 is non-zero, *p1 was derived
from the integer *p2. Returns zero upon success. */ from the integer *p2. Returns zero upon success. */
extern SLuser_Object_Type *SLang_pop_user_object (unsigned char); extern SLuser_Object_Type *SLang_pop_user_object (unsigned char);
extern void SLang_free_user_object (SLuser_Object_Type *); extern void SLang_free_user_object (SLuser_Object_Type *);
extern void SLang_free_intrinsic_user_object (SLuser_Object_Type *); extern void SLang_free_intrinsic_user_object (SLuser_Object_Type *);
@ -392,14 +392,14 @@ SLuser_Object_Type;
extern void SLang_push_user_object (SLuser_Object_Type *); extern void SLang_push_user_object (SLuser_Object_Type *);
extern SLuser_Object_Type *SLang_create_user_object (unsigned char); extern SLuser_Object_Type *SLang_create_user_object (unsigned char);
extern int SLang_add_unary_op (unsigned char, FVOID_STAR); extern int SLang_add_unary_op (unsigned char, FVOID_STAR);
extern int SLang_add_binary_op (unsigned char, unsigned char, FVOID_STAR); extern int SLang_add_binary_op (unsigned char, unsigned char, FVOID_STAR);
extern int SLang_register_class (unsigned char, FVOID_STAR, FVOID_STAR); extern int SLang_register_class (unsigned char, FVOID_STAR, FVOID_STAR);
extern int SLang_add_copy_operation (unsigned char, FVOID_STAR); extern int SLang_add_copy_operation (unsigned char, FVOID_STAR);
extern long *SLang_pop_pointer(unsigned char *, unsigned char *, int *); extern long *SLang_pop_pointer(unsigned char *, unsigned char *, int *);
/* Returns a pointer to object of type *p1,*p2 on top of stack. /* Returns a pointer to object of type *p1,*p2 on top of stack.
If *p3 is non-zero, the Object must be freed after use. */ If *p3 is non-zero, the Object must be freed after use. */
@ -408,7 +408,7 @@ SLuser_Object_Type;
extern void SLang_push_string(char *); extern void SLang_push_string(char *);
/* Push string p1 onto stack */ /* Push string p1 onto stack */
extern void SLang_push_integer(int); extern void SLang_push_integer(int);
/* push integer p1 on stack */ /* push integer p1 on stack */
@ -418,20 +418,20 @@ SLuser_Object_Type;
extern int SLang_is_defined(char *); extern int SLang_is_defined(char *);
/* Return non-zero is p1 is defined otherwise returns 0. */ /* Return non-zero is p1 is defined otherwise returns 0. */
extern int SLang_run_hooks(char *, char *, char *); extern int SLang_run_hooks(char *, char *, char *);
/* calls S-Lang function p1 pushing strings p2 and p3 onto the stack /* calls S-Lang function p1 pushing strings p2 and p3 onto the stack
* first. If either string is NULL, it is not pushed. If p1 is not * first. If either string is NULL, it is not pushed. If p1 is not
* defined, 0 is returned. */ * defined, 0 is returned. */
extern int SLang_execute_function(char *); extern int SLang_execute_function(char *);
/* Call S-Lang function p1. Returns 0 if the function is not defined /* Call S-Lang function p1. Returns 0 if the function is not defined
* and 1 if it is. * and 1 if it is.
*/ */
extern char *SLang_find_name(char *); extern char *SLang_find_name(char *);
/* Return a pointer to p1 in table if it is defined. Returns NULL /* Return a pointer to p1 in table if it is defined. Returns NULL
* otherwise. This is useful when one wants to avoid redundant strings. * otherwise. This is useful when one wants to avoid redundant strings.
*/ */
extern char *SLang_rpn_interpret(char *); extern char *SLang_rpn_interpret(char *);
@ -439,14 +439,14 @@ SLuser_Object_Type;
extern void SLang_doerror(char *); extern void SLang_doerror(char *);
/* set SLang_Error and display p1 as error message */ /* set SLang_Error and display p1 as error message */
extern SLuser_Object_Type *SLang_add_array(char *, long *, extern SLuser_Object_Type *SLang_add_array(char *, long *,
int, int, int, int, int, int, int, int,
unsigned char, unsigned char); unsigned char, unsigned char);
/* This function has not been tested thoroughly yet. Its purpose is to /* This function has not been tested thoroughly yet. Its purpose is to
* allow a S-Lang procedure to access a C array. For example, suppose that * allow a S-Lang procedure to access a C array. For example, suppose that
* you have an array of 100 ints defined as: * you have an array of 100 ints defined as:
* *
* int c_array[100]; * int c_array[100];
* *
* By calling something like: * By calling something like:
@ -454,39 +454,39 @@ SLuser_Object_Type;
* SLang_add_array ("array_name", (long *) c_array, 1, 100, 0, 0, * SLang_add_array ("array_name", (long *) c_array, 1, 100, 0, 0,
* 'i', SLANG_IVARIABLE); * 'i', SLANG_IVARIABLE);
* *
* the array can be accessed by the name 'array_name'. This function * the array can be accessed by the name 'array_name'. This function
* returns -1 upon failure. The 3rd argument specifies the dimension * returns -1 upon failure. The 3rd argument specifies the dimension
* of the array, the 4th, and 5th arguments specify how many elements * of the array, the 4th, and 5th arguments specify how many elements
* there are in the x,y, and z directions. The last argument must * there are in the x,y, and z directions. The last argument must
* be one of: * be one of:
* *
* SLANG_IVARIABLE: indicates array is writable * SLANG_IVARIABLE: indicates array is writable
* SLANG_RVARIABLE: indicates array is read only * SLANG_RVARIABLE: indicates array is read only
* *
* Returns NULL upon failure. * Returns NULL upon failure.
*/ */
extern int SLang_free_array_handle (int); extern int SLang_free_array_handle (int);
/* This routine may be called by application to free array handle created by /* This routine may be called by application to free array handle created by
* the application. Returns 0 upon success, -1 if the handle is invalid and * the application. Returns 0 upon success, -1 if the handle is invalid and
* -2 if the handle is not associated with a C array. * -2 if the handle is not associated with a C array.
*/ */
extern char *SLang_extract_list_element(char *, int *, int*); extern char *SLang_extract_list_element(char *, int *, int*);
extern void SLexpand_escaped_string (register char *, register char *, extern void SLexpand_escaped_string (register char *, register char *,
register char *); register char *);
extern SLang_Name_Type *SLang_get_function (char *); extern SLang_Name_Type *SLang_get_function (char *);
/* The parameter is the name of a user defined S-Lang function. This /* The parameter is the name of a user defined S-Lang function. This
* routine returns NULL if the function does not exist or it returns the * routine returns NULL if the function does not exist or it returns the
* a pointer to it in an internal S-Lang table. This pointer can be used * a pointer to it in an internal S-Lang table. This pointer can be used
* by 'SLexecute_function' to call the function directly from C. * by 'SLexecute_function' to call the function directly from C.
*/ */
extern void SLexecute_function(SLang_Name_Type *); extern void SLexecute_function(SLang_Name_Type *);
/* This function allows an application to call a S-Lang function from within /* This function allows an application to call a S-Lang function from within
* the C program. The parameter must be non-NULL and must have been * the C program. The parameter must be non-NULL and must have been
* previously obtained by a call to 'SLang_get_function'. * previously obtained by a call to 'SLang_get_function'.
*/ */
extern void SLroll_stack (int *); extern void SLroll_stack (int *);
@ -514,9 +514,9 @@ extern char *SLcurrent_time_string (void);
extern int SLatoi(unsigned char *); extern int SLatoi(unsigned char *);
extern int SLang_extract_token(char **, char *, int); extern int SLang_extract_token(char **, char *, int);
/* returns 0 upon failure and non-zero upon success. The first parameter /* returns 0 upon failure and non-zero upon success. The first parameter
* is a pointer to the input stream which this function will bump along. * is a pointer to the input stream which this function will bump along.
* The second parameter is the buffer where the token is placed. The third * The second parameter is the buffer where the token is placed. The third
* parameter is used internally by the S-Lang library and should be 0 for * parameter is used internally by the S-Lang library and should be 0 for
* user applications. * user applications.
*/ */
@ -524,12 +524,12 @@ extern int SLang_extract_token(char **, char *, int);
/*}}}*/ /*}}}*/
/*{{{ SLang getkey interface Functions */ /*{{{ SLang getkey interface Functions */
#ifdef REAL_UNIX_SYSTEM #ifdef REAL_UNIX_SYSTEM
extern int SLang_TT_Baud_Rate; extern int SLang_TT_Baud_Rate;
extern int SLang_TT_Read_FD; extern int SLang_TT_Read_FD;
#endif #endif
extern int SLang_init_tty (int, int, int); extern int SLang_init_tty (int, int, int);
/* Initializes the tty for single character input. If the first parameter *p1 /* Initializes the tty for single character input. If the first parameter *p1
* is in the range 0-255, it will be used for the abort character; * is in the range 0-255, it will be used for the abort character;
@ -571,7 +571,7 @@ extern int SLang_Ignore_User_Abort;
extern void SLang_set_abort_signal (void (*)(int)); extern void SLang_set_abort_signal (void (*)(int));
/* If SIGINT is generated, the function p1 will be called. If p1 is NULL /* If SIGINT is generated, the function p1 will be called. If p1 is NULL
* the SLang_default signal handler is called. This sets SLang_Error to * the SLang_default signal handler is called. This sets SLang_Error to
* USER_BREAK. I suspect most users will simply want to pass NULL. * USER_BREAK. I suspect most users will simply want to pass NULL.
*/ */
@ -635,19 +635,19 @@ extern SLKeyMap_List_Type SLKeyMap_List[SLANG_MAX_KEYMAPS]; /* these better be
extern char *SLang_process_keystring(char *); extern char *SLang_process_keystring(char *);
#ifdef SLKEYMAP_OBSOLETE #ifdef SLKEYMAP_OBSOLETE
extern int SLang_define_key1(char *, VOID_STAR, unsigned int, SLKeyMap_List_Type *); extern int SLang_define_key1(char *, VOID_STAR, unsigned int, SLKeyMap_List_Type *);
/* define key p1 in keymap p4 to invoke function p2. If type p3 is given by /* define key p1 in keymap p4 to invoke function p2. If type p3 is given by
* SLKEY_F_INTRINSIC, p2 is an intrinsic function, else it is a string to be * SLKEY_F_INTRINSIC, p2 is an intrinsic function, else it is a string to be
* passed to the interpreter for evaluation. The return value is important. * passed to the interpreter for evaluation. The return value is important.
* It returns 0 upon success, -1 upon malloc error, and -2 if the key is * It returns 0 upon success, -1 upon malloc error, and -2 if the key is
* inconsistent. SLang_Error is set upon error. */ * inconsistent. SLang_Error is set upon error. */
#else #else
extern int SLkm_define_key (char *, FVOID_STAR, SLKeyMap_List_Type *); extern int SLkm_define_key (char *, FVOID_STAR, SLKeyMap_List_Type *);
#endif #endif
extern int SLang_define_key(char *, char *, SLKeyMap_List_Type *); extern int SLang_define_key(char *, char *, SLKeyMap_List_Type *);
/* Like define_key1 except that p2 is a string that is to be associated with /* Like define_key1 except that p2 is a string that is to be associated with
* a function in the functions field of p3. This routine calls define_key1. * a function in the functions field of p3. This routine calls define_key1.
*/ */
@ -696,7 +696,7 @@ typedef struct SLang_Read_Line_Type
/* Maximum size of display */ /* Maximum size of display */
#define SLRL_DISPLAY_BUFFER_SIZE 256 #define SLRL_DISPLAY_BUFFER_SIZE 256
typedef struct typedef struct
{ {
SLang_Read_Line_Type *root, *tail, *last; SLang_Read_Line_Type *root, *tail, *last;
unsigned char *buf; /* edit buffer */ unsigned char *buf; /* edit buffer */
@ -704,14 +704,14 @@ typedef struct
int point; /* current editing point */ int point; /* current editing point */
int tab; /* tab width */ int tab; /* tab width */
int len; /* current line size */ int len; /* current line size */
/* display variables */ /* display variables */
int edit_width; /* length of display field */ int edit_width; /* length of display field */
int curs_pos; /* current column */ int curs_pos; /* current column */
int start_column; /* column offset of display */ int start_column; /* column offset of display */
int dhscroll; /* amount to use for horiz scroll */ int dhscroll; /* amount to use for horiz scroll */
char *prompt; char *prompt;
FVOID_STAR last_fun; /* last function executed by rl */ FVOID_STAR last_fun; /* last function executed by rl */
/* These two contain an image of what is on the display */ /* These two contain an image of what is on the display */
@ -719,7 +719,7 @@ typedef struct
unsigned char upd_buf2[SLRL_DISPLAY_BUFFER_SIZE]; unsigned char upd_buf2[SLRL_DISPLAY_BUFFER_SIZE];
unsigned char *old_upd, *new_upd; /* pointers to previous two buffers */ unsigned char *old_upd, *new_upd; /* pointers to previous two buffers */
int new_upd_len, old_upd_len; /* length of output buffers */ int new_upd_len, old_upd_len; /* length of output buffers */
SLKeyMap_List_Type *keymap; SLKeyMap_List_Type *keymap;
/* tty variables */ /* tty variables */
@ -731,7 +731,7 @@ typedef struct
void (*tt_insert)(char); void (*tt_insert)(char);
void (*update_hook)(unsigned char *, int, int); void (*update_hook)(unsigned char *, int, int);
/* The update hook is called with a pointer to a buffer p1 that contains /* The update hook is called with a pointer to a buffer p1 that contains
* an image of what the update hook is suppoed to produce. The length * an image of what the update hook is suppoed to produce. The length
* of the buffer is p2 and after the update, the cursor is to be placed * of the buffer is p2 and after the update, the cursor is to be placed
* in column p3. * in column p3.
*/ */
@ -743,7 +743,7 @@ extern SLang_Read_Line_Type * SLang_rline_save_line (SLang_RLine_Info_Type *);
extern int SLang_init_readline (SLang_RLine_Info_Type *); extern int SLang_init_readline (SLang_RLine_Info_Type *);
extern int SLang_read_line (SLang_RLine_Info_Type *); extern int SLang_read_line (SLang_RLine_Info_Type *);
extern int SLang_rline_insert (char *); extern int SLang_rline_insert (char *);
extern void SLrline_redraw (SLang_RLine_Info_Type *); extern void SLrline_redraw (SLang_RLine_Info_Type *);
extern int SLang_Rline_Quit; extern int SLang_Rline_Quit;
/*}}}*/ /*}}}*/
@ -770,7 +770,7 @@ extern int SLtt_Ignore_Beep;
#if defined(REAL_UNIX_SYSTEM) #if defined(REAL_UNIX_SYSTEM)
extern int SLtt_Force_Keypad_Init; extern int SLtt_Force_Keypad_Init;
#endif #endif
#ifndef __GO32__ #ifndef __GO32__
#if defined(VMS) || defined(REAL_UNIX_SYSTEM) #if defined(VMS) || defined(REAL_UNIX_SYSTEM)
extern int SLtt_Blink_Mode; extern int SLtt_Blink_Mode;
@ -787,8 +787,8 @@ extern int SLtt_Try_Termcap;
#ifdef msdos #ifdef msdos
extern int SLtt_Msdos_Cheap_Video; extern int SLtt_Msdos_Cheap_Video;
#endif #endif
extern int SLtt_flush_output (void); extern int SLtt_flush_output (void);
extern void SLtt_set_scroll_region(int, int); extern void SLtt_set_scroll_region(int, int);
extern void SLtt_reset_scroll_region(void); extern void SLtt_reset_scroll_region(void);
@ -813,7 +813,7 @@ extern void SLtt_reset_video (void);
extern void SLtt_get_terminfo(void); extern void SLtt_get_terminfo(void);
extern void SLtt_get_screen_size (void); extern void SLtt_get_screen_size (void);
extern int SLtt_set_cursor_visibility (int); extern int SLtt_set_cursor_visibility (int);
#if defined(VMS) || defined(REAL_UNIX_SYSTEM) #if defined(VMS) || defined(REAL_UNIX_SYSTEM)
extern void SLtt_enable_cursor_keys(void); extern void SLtt_enable_cursor_keys(void);
extern void SLtt_set_term_vtxxx(int *); extern void SLtt_set_term_vtxxx(int *);
@ -833,19 +833,19 @@ extern void SLtt_disable_status_line (void);
extern int SLtt_tigetnum (char *, char **); extern int SLtt_tigetnum (char *, char **);
# endif # endif
#endif #endif
extern SLtt_Char_Type SLtt_get_color_object (int); extern SLtt_Char_Type SLtt_get_color_object (int);
extern void SLtt_set_color_object (int, SLtt_Char_Type); extern void SLtt_set_color_object (int, SLtt_Char_Type);
extern void SLtt_set_color (int, char *, char *, char *); extern void SLtt_set_color (int, char *, char *, char *);
extern void SLtt_set_mono (int, char *, SLtt_Char_Type); extern void SLtt_set_mono (int, char *, SLtt_Char_Type);
extern void SLtt_add_color_attribute (int, SLtt_Char_Type); extern void SLtt_add_color_attribute (int, SLtt_Char_Type);
extern void SLtt_set_color_fgbg (int, SLtt_Char_Type, SLtt_Char_Type); extern void SLtt_set_color_fgbg (int, SLtt_Char_Type, SLtt_Char_Type);
/*}}}*/ /*}}}*/
/*{{{ SLang Preprocessor Interface */ /*{{{ SLang Preprocessor Interface */
typedef struct typedef struct
{ {
int this_level; int this_level;
int exec_level; int exec_level;
@ -865,8 +865,8 @@ extern int SLprep_line_ok (char *, SLPreprocess_Type *);
/* Adds a string to the SLang #ifdef preparsing defines. SLang already /* Adds a string to the SLang #ifdef preparsing defines. SLang already
defines MSDOS, UNIX, and VMS on the appropriate system. */ defines MSDOS, UNIX, and VMS on the appropriate system. */
extern int (*SLprep_exists_hook) (char *, char); extern int (*SLprep_exists_hook) (char *, char);
/*}}}*/ /*}}}*/
/*{{{ SLsmg Screen Management Functions */ /*{{{ SLsmg Screen Management Functions */
@ -909,7 +909,7 @@ extern void SLsmg_forward (int);
extern void SLsmg_write_color_chars (unsigned short *, unsigned int); extern void SLsmg_write_color_chars (unsigned short *, unsigned int);
extern unsigned int SLsmg_read_raw (unsigned short *, unsigned int); extern unsigned int SLsmg_read_raw (unsigned short *, unsigned int);
extern unsigned int SLsmg_write_raw (unsigned short *, unsigned int); extern unsigned int SLsmg_write_raw (unsigned short *, unsigned int);
extern int SLsmg_Display_Eight_Bit; extern int SLsmg_Display_Eight_Bit;
extern int SLsmg_Tab_Width; extern int SLsmg_Tab_Width;
extern int SLsmg_Newline_Moves; extern int SLsmg_Newline_Moves;
@ -999,7 +999,7 @@ int SLkp_define_keysym (char *, unsigned int);
/* This function must be called AFTER SLtt_get_terminfo and not before. */ /* This function must be called AFTER SLtt_get_terminfo and not before. */
extern int SLkp_init (void); extern int SLkp_init (void);
/* This function uses SLang_getkey and assumes that what ever initialization /* This function uses SLang_getkey and assumes that what ever initialization
* is required for SLang_getkey has been performed. * is required for SLang_getkey has been performed.
*/ */
extern int SLkp_getkey (void); extern int SLkp_getkey (void);
@ -1016,7 +1016,7 @@ typedef struct _SLscroll_Type
} }
SLscroll_Type; SLscroll_Type;
typedef struct typedef struct
{ {
unsigned int flags; unsigned int flags;
SLscroll_Type *top_window_line; /* list element at top of window */ SLscroll_Type *top_window_line; /* list element at top of window */
@ -1088,8 +1088,8 @@ extern int SLsig_unblock_signals (void);
/* This is not ready yet. */ /* This is not ready yet. */
# define SLANG_NOOP 9 # define SLANG_NOOP 9
#endif #endif
/* Everything above string should correspond to a pointer in the object /* Everything above string should correspond to a pointer in the object
* structure. See do_binary (slang.c) for exploitation of this fact. * structure. See do_binary (slang.c) for exploitation of this fact.
*/ */
#define STRING_TYPE 10 #define STRING_TYPE 10
@ -1154,14 +1154,14 @@ extern void SLadd_at_handler (long *, char *);
#define MAKE_INTRINSIC(n, f, out, in) \ #define MAKE_INTRINSIC(n, f, out, in) \
{0, n, (out | (in << 4)), SLANG_INTRINSIC, (long) f} {0, n, (out | (in << 4)), SLANG_INTRINSIC, (long) f}
#define MAKE_VARIABLE(n, v, t, r) \ #define MAKE_VARIABLE(n, v, t, r) \
{0, n, t, (SLANG_IVARIABLE + r), (long) v} {0, n, t, (SLANG_IVARIABLE + r), (long) v}
#else #else
#define MAKE_INTRINSIC(n, f, out, in) \ #define MAKE_INTRINSIC(n, f, out, in) \
{n, (out | (in << 4)), SLANG_INTRINSIC, (long) f} {n, (out | (in << 4)), SLANG_INTRINSIC, (long) f}
#define MAKE_VARIABLE(n, v, t, r) \ #define MAKE_VARIABLE(n, v, t, r) \
{n, t, (SLANG_IVARIABLE + r), (long) v} {n, t, (SLANG_IVARIABLE + r), (long) v}
#endif #endif
@ -1202,13 +1202,13 @@ typedef struct
int beg_matches[10]; /* offset of start of \( */ int beg_matches[10]; /* offset of start of \( */
unsigned int end_matches[10]; /* length of nth submatch unsigned int end_matches[10]; /* length of nth submatch
* Note that the entire match corresponds * Note that the entire match corresponds
* to \0 * to \0
*/ */
int offset; /* offset to be added to beg_matches */ int offset; /* offset to be added to beg_matches */
} SLRegexp_Type; } SLRegexp_Type;
extern unsigned char *SLang_regexp_match(unsigned char *, extern unsigned char *SLang_regexp_match(unsigned char *,
unsigned int, unsigned int,
SLRegexp_Type *); SLRegexp_Type *);
extern int SLang_regexp_compile (SLRegexp_Type *); extern int SLang_regexp_compile (SLRegexp_Type *);
extern char *SLregexp_quote_string (char *, char *, unsigned int); extern char *SLregexp_quote_string (char *, char *, unsigned int);
@ -1254,21 +1254,21 @@ typedef struct
} SLsearch_Type; } SLsearch_Type;
extern int SLsearch_init (char *, int, int, SLsearch_Type *); extern int SLsearch_init (char *, int, int, SLsearch_Type *);
/* This routine must first be called before any search can take place. /* This routine must first be called before any search can take place.
* The second parameter specifies the direction of the search: greater than * The second parameter specifies the direction of the search: greater than
* zero for a forwrd search and less than zero for a backward search. The * zero for a forwrd search and less than zero for a backward search. The
* third parameter specifies whether the search is case sensitive or not. * third parameter specifies whether the search is case sensitive or not.
* The last parameter is a pointer to a structure that is filled by this * The last parameter is a pointer to a structure that is filled by this
* function and it is this structure that must be passed to SLsearch. * function and it is this structure that must be passed to SLsearch.
*/ */
unsigned char *SLsearch (unsigned char *, unsigned char *, SLsearch_Type *); unsigned char *SLsearch (unsigned char *, unsigned char *, SLsearch_Type *);
/* To use this routine, you must first call 'SLsearch_init'. Then the first /* To use this routine, you must first call 'SLsearch_init'. Then the first
* two parameters p1 and p2 serve to define the region over which the search * two parameters p1 and p2 serve to define the region over which the search
* is to take place. The third parameter is the structure that was previously * is to take place. The third parameter is the structure that was previously
* initialized by SLsearch_init. * initialized by SLsearch_init.
* *
* The routine returns a pointer to the match if found otherwise it returns * The routine returns a pointer to the match if found otherwise it returns
* NULL. * NULL.
*/ */

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
/* error handling common to all routines. */ /* error handling common to all routines. */
/* Copyright (c) 1992, 1995 John E. Davis /* Copyright (c) 1992, 1995 John E. Davis
* All rights reserved. * All rights reserved.
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Perl Artistic License. * License or the Perl Artistic License.
*/ */
@ -32,11 +32,11 @@ void SLang_doerror (char *error)
char *str = NULL; char *str = NULL;
*err = 0; *err = 0;
str = "Slang/Midnight Commander unknown error"; str = "Slang/Midnight Commander unknown error";
sprintf(err, "S-Lang Error: %s", str); sprintf(err, "S-Lang Error: %s", str);
if (SLang_Error_Routine == NULL) if (SLang_Error_Routine == NULL)
{ {
fputs (err, stderr); fputs (err, stderr);

View file

@ -1,6 +1,6 @@
/* Copyright (c) 1992, 1995 John E. Davis /* Copyright (c) 1992, 1995 John E. Davis
* All rights reserved. * All rights reserved.
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Perl Artistic License. * License or the Perl Artistic License.
*/ */
@ -18,7 +18,7 @@ int SLang_Abort_Char = 7;
int SLang_Ignore_User_Abort = 0; int SLang_Ignore_User_Abort = 0;
/* This has the effect of mapping all characters in the range 128-169 to /* This has the effect of mapping all characters in the range 128-169 to
* ESC [ something * ESC [ something
*/ */
#ifndef __GO32__ #ifndef __GO32__
# if defined(__unix__) || defined(vms) # if defined(__unix__) || defined(vms)
@ -31,18 +31,18 @@ unsigned int SLang_getkey (void)
{ {
unsigned int imax; unsigned int imax;
unsigned int ch; unsigned int ch;
if (SLang_Input_Buffer_Len) if (SLang_Input_Buffer_Len)
{ {
ch = (unsigned int) *SLang_Input_Buffer; ch = (unsigned int) *SLang_Input_Buffer;
SLang_Input_Buffer_Len--; SLang_Input_Buffer_Len--;
imax = SLang_Input_Buffer_Len; imax = SLang_Input_Buffer_Len;
SLMEMCPY ((char *) SLang_Input_Buffer, SLMEMCPY ((char *) SLang_Input_Buffer,
(char *) (SLang_Input_Buffer + 1), imax); (char *) (SLang_Input_Buffer + 1), imax);
} }
else if (0xFFFF == (ch = SLsys_getkey ())) return ch; else if (0xFFFF == (ch = SLsys_getkey ())) return ch;
#ifdef DEC_8BIT_HACK #ifdef DEC_8BIT_HACK
if (ch & 0x80) if (ch & 0x80)
{ {
@ -78,8 +78,8 @@ void SLang_buffer_keystring (unsigned char *s, unsigned int n)
{ {
if (n + SLang_Input_Buffer_Len + 3 > MAX_INPUT_BUFFER_LEN) return; if (n + SLang_Input_Buffer_Len + 3 > MAX_INPUT_BUFFER_LEN) return;
SLMEMCPY ((char *) SLang_Input_Buffer + SLang_Input_Buffer_Len, SLMEMCPY ((char *) SLang_Input_Buffer + SLang_Input_Buffer_Len,
(char *) s, n); (char *) s, n);
SLang_Input_Buffer_Len += n; SLang_Input_Buffer_Len += n;
} }
@ -95,14 +95,14 @@ int SLang_input_pending (int tsecs)
int n; int n;
unsigned char c; unsigned char c;
if (SLang_Input_Buffer_Len) return (int) SLang_Input_Buffer_Len; if (SLang_Input_Buffer_Len) return (int) SLang_Input_Buffer_Len;
n = SLsys_input_pending (tsecs); n = SLsys_input_pending (tsecs);
if (n <= 0) return 0; if (n <= 0) return 0;
c = (unsigned char) SLang_getkey (); c = (unsigned char) SLang_getkey ();
SLang_ungetkey_string (&c, 1); SLang_ungetkey_string (&c, 1);
return n; return n;
} }
#endif /* OS2_NT */ #endif /* OS2_NT */
@ -110,10 +110,10 @@ int SLang_input_pending (int tsecs)
void SLang_flush_input (void) void SLang_flush_input (void)
{ {
int quit = SLKeyBoard_Quit; int quit = SLKeyBoard_Quit;
SLang_Input_Buffer_Len = 0; SLang_Input_Buffer_Len = 0;
SLKeyBoard_Quit = 0; SLKeyBoard_Quit = 0;
while (SLsys_input_pending (0) > 0) while (SLsys_input_pending (0) > 0)
{ {
(void) SLsys_getkey (); (void) SLsys_getkey ();
/* Set this to 0 because SLsys_getkey may stuff keyboard buffer if /* Set this to 0 because SLsys_getkey may stuff keyboard buffer if

View file

@ -1,6 +1,6 @@
/* Copyright (c) 1992, 1995 John E. Davis /* Copyright (c) 1992, 1995 John E. Davis
* All rights reserved. * All rights reserved.
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Perl Artistic License. * License or the Perl Artistic License.
*/ */
@ -10,7 +10,7 @@
use system rouines. For msdos, I use inline assembly. */ use system rouines. For msdos, I use inline assembly. */
/* The current versions only work in the forward direction only!! */ /* The current versions only work in the forward direction only!! */
#include "config.h" #include "config.h"
#include <stdio.h> #include <stdio.h>
@ -32,20 +32,20 @@ char *SLmemcpy(char *s1, char *s2, int n)
asm mov si, bx asm mov si, bx
asm mov di, dx asm mov di, dx
return(s1); return(s1);
#else #else
register char *smax, *s = s1; register char *smax, *s = s1;
int n2; int n2;
n2 = n % 4; n2 = n % 4;
smax = s + (n - 4); smax = s + (n - 4);
while (s <= smax) while (s <= smax)
{ {
*s = *s2; *(s + 1) = *(s2 + 1); *(s + 2) = *(s2 + 2); *(s + 3) = *(s2 + 3); *s = *s2; *(s + 1) = *(s2 + 1); *(s + 2) = *(s2 + 2); *(s + 3) = *(s2 + 3);
s += 4; s += 4;
s2 += 4; s2 += 4;
} }
while (n2--) *s++ = *s2++; while (n2--) *s++ = *s2++;
return(s1); return(s1);
#endif #endif
} }

View file

@ -1,6 +1,6 @@
/* Copyright (c) 1992, 1995 John E. Davis /* Copyright (c) 1992, 1995 John E. Davis
* All rights reserved. * All rights reserved.
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Perl Artistic License. * License or the Perl Artistic License.
*/ */
@ -10,7 +10,7 @@
use system rouines. For msdos, I use inline assembly. */ use system rouines. For msdos, I use inline assembly. */
/* The current versions only work in the forward direction only!! */ /* The current versions only work in the forward direction only!! */
#include "config.h" #include "config.h"
#include <stdio.h> #include <stdio.h>
@ -34,10 +34,10 @@ void SLmemset(char *p, char space, int n)
pmax = p + (n - 4); pmax = p + (n - 4);
n = n % 4; n = n % 4;
while (p <= pmax) while (p <= pmax)
{ {
*p++ = space; *p++ = space; *p++ = space; *p++= space; *p++ = space; *p++ = space; *p++ = space; *p++= space;
} }
while (n--) *p++ = space; while (n--) *p++ = space;
#endif #endif
} }

View file

@ -1,6 +1,6 @@
/* Copyright (c) 1992, 1995 John E. Davis /* Copyright (c) 1992, 1995 John E. Davis
* All rights reserved. * All rights reserved.
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Perl Artistic License. * License or the Perl Artistic License.
*/ */
@ -235,10 +235,10 @@ unsigned int SLsys_getkey ()
{ {
unsigned int c; unsigned int c;
unsigned char scan; unsigned char scan;
int tsecs = 300; int tsecs = 300;
if (!keyWaiting()) if (!keyWaiting())
while (!SLsys_input_pending(tsecs)); while (!SLsys_input_pending(tsecs));
/* read codes from buffer */ /* read codes from buffer */

View file

@ -21,7 +21,7 @@ SLSig_Fun_Type *SLsignal (int sig, SLSig_Fun_Type *f)
{ {
#ifdef SLANG_POSIX_SIGNALS #ifdef SLANG_POSIX_SIGNALS
struct sigaction old_sa, new_sa; struct sigaction old_sa, new_sa;
# ifdef SIGALRM # ifdef SIGALRM
/* We want system calls to be interrupted by SIGALRM. */ /* We want system calls to be interrupted by SIGALRM. */
if (sig == SIGALRM) return SLsignal_intr (sig, f); if (sig == SIGALRM) return SLsignal_intr (sig, f);
@ -29,15 +29,15 @@ SLSig_Fun_Type *SLsignal (int sig, SLSig_Fun_Type *f)
sigemptyset (&new_sa.sa_mask); sigemptyset (&new_sa.sa_mask);
new_sa.sa_handler = f; new_sa.sa_handler = f;
new_sa.sa_flags = 0; new_sa.sa_flags = 0;
# ifdef SA_RESTART # ifdef SA_RESTART
new_sa.sa_flags |= SA_RESTART; new_sa.sa_flags |= SA_RESTART;
# endif # endif
if (-1 == sigaction (sig, &new_sa, &old_sa)) if (-1 == sigaction (sig, &new_sa, &old_sa))
return (SLSig_Fun_Type *) SIG_ERR; return (SLSig_Fun_Type *) SIG_ERR;
return old_sa.sa_handler; return old_sa.sa_handler;
#else #else
/* Not POSIX. */ /* Not POSIX. */
@ -45,25 +45,25 @@ SLSig_Fun_Type *SLsignal (int sig, SLSig_Fun_Type *f)
#endif #endif
} }
/* This function will NOT cause system calls to be restarted after /* This function will NOT cause system calls to be restarted after
* signal if possible * signal if possible
*/ */
SLSig_Fun_Type *SLsignal_intr (int sig, SLSig_Fun_Type *f) SLSig_Fun_Type *SLsignal_intr (int sig, SLSig_Fun_Type *f)
{ {
#ifdef SLANG_POSIX_SIGNALS #ifdef SLANG_POSIX_SIGNALS
struct sigaction old_sa, new_sa; struct sigaction old_sa, new_sa;
sigemptyset (&new_sa.sa_mask); sigemptyset (&new_sa.sa_mask);
new_sa.sa_handler = f; new_sa.sa_handler = f;
new_sa.sa_flags = 0; new_sa.sa_flags = 0;
# ifdef SA_INTERRUPT # ifdef SA_INTERRUPT
new_sa.sa_flags |= SA_INTERRUPT; new_sa.sa_flags |= SA_INTERRUPT;
# endif # endif
if (-1 == sigaction (sig, &new_sa, &old_sa)) if (-1 == sigaction (sig, &new_sa, &old_sa))
return (SLSig_Fun_Type *) SIG_ERR; return (SLSig_Fun_Type *) SIG_ERR;
return old_sa.sa_handler; return old_sa.sa_handler;
#else #else
/* Not POSIX. */ /* Not POSIX. */
@ -72,7 +72,7 @@ SLSig_Fun_Type *SLsignal_intr (int sig, SLSig_Fun_Type *f)
} }
/* We are primarily interested in blocking signals that would cause the /* We are primarily interested in blocking signals that would cause the
* application to reset the tty. These include suspend signals and * application to reset the tty. These include suspend signals and
* possibly interrupt signals. * possibly interrupt signals.
*/ */
@ -87,13 +87,13 @@ int SLsig_block_signals (void)
#ifdef SLANG_POSIX_SIGNALS #ifdef SLANG_POSIX_SIGNALS
sigset_t new_mask; sigset_t new_mask;
#endif #endif
Blocked_Depth++; Blocked_Depth++;
if (Blocked_Depth != 1) if (Blocked_Depth != 1)
{ {
return 0; return 0;
} }
#ifdef SLANG_POSIX_SIGNALS #ifdef SLANG_POSIX_SIGNALS
sigemptyset (&new_mask); sigemptyset (&new_mask);
# ifdef SIGQUIT # ifdef SIGQUIT
@ -111,7 +111,7 @@ int SLsig_block_signals (void)
# ifdef SIGTTOU # ifdef SIGTTOU
sigaddset (&new_mask, SIGTTOU); sigaddset (&new_mask, SIGTTOU);
# endif # endif
(void) sigprocmask (SIG_BLOCK, &new_mask, &Old_Signal_Mask); (void) sigprocmask (SIG_BLOCK, &new_mask, &Old_Signal_Mask);
return 0; return 0;
#else #else
@ -124,12 +124,12 @@ int SLsig_unblock_signals (void)
{ {
if (Blocked_Depth == 0) if (Blocked_Depth == 0)
return -1; return -1;
Blocked_Depth--; Blocked_Depth--;
if (Blocked_Depth != 0) if (Blocked_Depth != 0)
return 0; return 0;
#ifdef SLANG_POSIX_SIGNALS #ifdef SLANG_POSIX_SIGNALS
(void) sigprocmask (SIG_SETMASK, &Old_Signal_Mask, NULL); (void) sigprocmask (SIG_SETMASK, &Old_Signal_Mask, NULL);
return 0; return 0;

View file

@ -1,7 +1,7 @@
/* SLang Screen management routines */ /* SLang Screen management routines */
/* Copyright (c) 1992, 1995 John E. Davis /* Copyright (c) 1992, 1995 John E. Davis
* All rights reserved. * All rights reserved.
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Perl Artistic License. * License or the Perl Artistic License.
*/ */
@ -60,7 +60,7 @@ static void blank_line (unsigned short *p, int n, unsigned char ch)
register unsigned short color_ch; register unsigned short color_ch;
color_ch = (This_Color << 8) | (unsigned short) ch; color_ch = (This_Color << 8) | (unsigned short) ch;
while (p < pmax) while (p < pmax)
{ {
*p++ = color_ch; *p++ = color_ch;
@ -72,7 +72,7 @@ static void clear_region (int row, int n)
{ {
int i; int i;
int imax = row + n; int imax = row + n;
if (imax > Screen_Rows) imax = Screen_Rows; if (imax > Screen_Rows) imax = Screen_Rows;
for (i = row; i < imax; i++) for (i = row; i < imax; i++)
{ {
@ -87,10 +87,10 @@ static void clear_region (int row, int n)
void SLsmg_erase_eol (void) void SLsmg_erase_eol (void)
{ {
int r, c; int r, c;
c = This_Col - Start_Col; c = This_Col - Start_Col;
r = This_Row - Start_Row; r = This_Row - Start_Row;
if ((r < 0) || (r >= Screen_Rows)) return; if ((r < 0) || (r >= Screen_Rows)) return;
if (c < 0) c = 0; else if (c >= Screen_Cols) return; if (c < 0) c = 0; else if (c >= Screen_Cols) return;
blank_line (SL_Screen[This_Row].neew + c , Screen_Cols - c, ' '); blank_line (SL_Screen[This_Row].neew + c , Screen_Cols - c, ' ');
@ -115,7 +115,7 @@ static void scroll_up (void)
This_Row--; This_Row--;
} }
void SLsmg_gotorc (int r, int c) void SLsmg_gotorc (int r, int c)
@ -150,7 +150,7 @@ void SLsmg_set_char_set (int i)
*/ */
if (i) This_Alt_Char = ALT_CHAR_FLAG; if (i) This_Alt_Char = ALT_CHAR_FLAG;
else This_Alt_Char = 0; else This_Alt_Char = 0;
This_Color &= 0x7F; This_Color &= 0x7F;
This_Color |= This_Alt_Char; This_Color |= This_Alt_Char;
} }
@ -179,10 +179,10 @@ static int point_visible (int col_too)
{ {
return ((This_Row >= Start_Row) && (This_Row < Start_Row + Screen_Rows) return ((This_Row >= Start_Row) && (This_Row < Start_Row + Screen_Rows)
&& ((col_too == 0) && ((col_too == 0)
|| ((This_Col >= Start_Col) || ((This_Col >= Start_Col)
&& (This_Col < Start_Col + Screen_Cols)))); && (This_Col < Start_Col + Screen_Cols))));
} }
void SLsmg_printf (char *fmt, ...) void SLsmg_printf (char *fmt, ...)
{ {
char p[1000]; char p[1000];
@ -191,7 +191,7 @@ void SLsmg_printf (char *fmt, ...)
va_start(ap, fmt); va_start(ap, fmt);
(void) vsprintf(p, fmt, ap); (void) vsprintf(p, fmt, ap);
va_end(ap); va_end(ap);
SLsmg_write_string (p); SLsmg_write_string (p);
} }
@ -205,7 +205,7 @@ void SLsmg_write_nstring (char *str, int n)
int width; int width;
char blank = ' '; char blank = ' ';
if (str == NULL) width = 0; if (str == NULL) width = 0;
else else
{ {
width = strlen (str); width = strlen (str);
if (width > n) width = n; if (width > n) width = n;
@ -218,7 +218,7 @@ void SLsmg_write_wrapped_string (char *s, int r, int c, int dr, int dc, int fill
{ {
register char ch, *p; register char ch, *p;
int maxc = dc; int maxc = dc;
if ((dr == 0) || (dc == 0)) return; if ((dr == 0) || (dc == 0)) return;
p = s; p = s;
dc = 0; dc = 0;
@ -228,9 +228,9 @@ void SLsmg_write_wrapped_string (char *s, int r, int c, int dr, int dc, int fill
if ((ch == 0) || (ch == '\n')) if ((ch == 0) || (ch == '\n'))
{ {
int diff; int diff;
diff = maxc - dc; diff = maxc - dc;
SLsmg_gotorc (r, c); SLsmg_gotorc (r, c);
SLsmg_write_nchars (s, dc); SLsmg_write_nchars (s, dc);
if (fill && (diff > 0)) if (fill && (diff > 0))
@ -238,7 +238,7 @@ void SLsmg_write_wrapped_string (char *s, int r, int c, int dr, int dc, int fill
while (diff--) SLsmg_write_char (' '); while (diff--) SLsmg_write_char (' ');
} }
if ((ch == 0) || (dr == 1)) break; if ((ch == 0) || (dr == 1)) break;
r++; r++;
dc = 0; dc = 0;
dr--; dr--;
@ -259,7 +259,7 @@ void SLsmg_write_wrapped_string (char *s, int r, int c, int dr, int dc, int fill
} }
} }
int SLsmg_Tab_Width = 8; int SLsmg_Tab_Width = 8;
@ -282,30 +282,30 @@ void SLsmg_write_nchars (char *str, int n)
int newline_flag; int newline_flag;
#ifndef pc_system #ifndef pc_system
int alt_char_set_flag; int alt_char_set_flag;
alt_char_set_flag = ((SLtt_Use_Blink_For_ACS == 0) alt_char_set_flag = ((SLtt_Use_Blink_For_ACS == 0)
&& (This_Color & ALT_CHAR_FLAG)); && (This_Color & ALT_CHAR_FLAG));
#endif #endif
str_max = str + n; str_max = str + n;
color = This_Color << 8; color = This_Color << 8;
top: /* get here only on newline */ top: /* get here only on newline */
newline_flag = 0; newline_flag = 0;
start_len = Start_Col; start_len = Start_Col;
if (point_visible (0) == 0) return; if (point_visible (0) == 0) return;
len = This_Col; len = This_Col;
max_len = start_len + Screen_Cols; max_len = start_len + Screen_Cols;
p = SL_Screen[This_Row].neew; p = SL_Screen[This_Row].neew;
if (len > start_len) p += (len - start_len); if (len > start_len) p += (len - start_len);
flags = SL_Screen[This_Row].flags; flags = SL_Screen[This_Row].flags;
while ((len < max_len) && (str < str_max)) while ((len < max_len) && (str < str_max))
{ {
ch = (unsigned char) *str++; ch = (unsigned char) *str++;
#ifndef pc_system #ifndef pc_system
@ -332,7 +332,7 @@ void SLsmg_write_nchars (char *str, int n)
p++; p++;
} }
} }
else if ((ch == '\t') && (SLsmg_Tab_Width > 0)) else if ((ch == '\t') && (SLsmg_Tab_Width > 0))
{ {
n = len; n = len;
@ -345,7 +345,7 @@ void SLsmg_write_nchars (char *str, int n)
len += 1; len += 1;
if (len > start_len) if (len > start_len)
{ {
if (*p != neew) if (*p != neew)
{ {
flags |= TOUCHED; flags |= TOUCHED;
*p = neew; *p = neew;
@ -381,7 +381,7 @@ void SLsmg_write_nchars (char *str, int n)
ch &= 0x7F; ch &= 0x7F;
} }
} }
len += 1; len += 1;
if (len > start_len) if (len > start_len)
{ {
@ -394,7 +394,7 @@ void SLsmg_write_nchars (char *str, int n)
p++; p++;
if (len == max_len) break; if (len == max_len) break;
} }
if (ch == 127) ch = '?'; else ch = ch + '@'; if (ch == 127) ch = '?'; else ch = ch + '@';
len++; len++;
if (len > start_len) if (len > start_len)
@ -409,13 +409,13 @@ void SLsmg_write_nchars (char *str, int n)
} }
} }
} }
SL_Screen[This_Row].flags = flags; SL_Screen[This_Row].flags = flags;
This_Col = len; This_Col = len;
if (SLsmg_Newline_Moves == 0) if (SLsmg_Newline_Moves == 0)
return; return;
if (newline_flag == 0) if (newline_flag == 0)
{ {
while (str < str_max) while (str < str_max)
@ -426,7 +426,7 @@ void SLsmg_write_nchars (char *str, int n)
if (str == str_max) return; if (str == str_max) return;
str++; str++;
} }
This_Row++; This_Row++;
This_Col = 0; This_Col = 0;
if (This_Row == Start_Row + Screen_Rows) if (This_Row == Start_Row + Screen_Rows)
@ -456,7 +456,7 @@ void SLsmg_cls (void)
static void do_copy (unsigned short *a, unsigned short *b) static void do_copy (unsigned short *a, unsigned short *b)
{ {
unsigned short *amax = a + Screen_Cols; unsigned short *amax = a + Screen_Cols;
while (a < amax) *a++ = *b++; while (a < amax) *a++ = *b++;
} }
#endif #endif
@ -469,16 +469,16 @@ static unsigned long compute_hash (unsigned short *s, int n)
register unsigned long sum = 0; register unsigned long sum = 0;
register unsigned short *smax, ch; register unsigned short *smax, ch;
int is_blank = 2; int is_blank = 2;
s += SLsmg_Scroll_Hash_Border; s += SLsmg_Scroll_Hash_Border;
smax = s + (n - SLsmg_Scroll_Hash_Border); smax = s + (n - SLsmg_Scroll_Hash_Border);
while (s < smax) while (s < smax)
{ {
ch = *s++; ch = *s++;
if (is_blank && ((ch & 0xFF) != 32)) is_blank--; if (is_blank && ((ch & 0xFF) != 32)) is_blank--;
sum += ch; sum += ch;
h = sum + (h << 3); h = sum + (h << 3);
if ((g = h & 0xE0000000UL) != 0) if ((g = h & 0xE0000000UL) != 0)
{ {
@ -499,9 +499,9 @@ static void try_scroll (void)
int color, did_scroll = 0; int color, did_scroll = 0;
unsigned short *tmp; unsigned short *tmp;
int ignore; int ignore;
/* find region limits. */ /* find region limits. */
for (rmax = Screen_Rows - 1; rmax > 0; rmax--) for (rmax = Screen_Rows - 1; rmax > 0; rmax--)
{ {
if (SL_Screen[rmax].new_hash != SL_Screen[rmax].old_hash) if (SL_Screen[rmax].new_hash != SL_Screen[rmax].old_hash)
@ -510,11 +510,11 @@ static void try_scroll (void)
if ((r1 == 0) if ((r1 == 0)
|| (SL_Screen[r1].new_hash != SL_Screen[r1].old_hash)) || (SL_Screen[r1].new_hash != SL_Screen[r1].old_hash))
break; break;
rmax = r1; rmax = r1;
} }
} }
for (rmin = 0; rmin < rmax; rmin++) for (rmin = 0; rmin < rmax; rmin++)
{ {
if (SL_Screen[rmin].new_hash != SL_Screen[rmin].old_hash) if (SL_Screen[rmin].new_hash != SL_Screen[rmin].old_hash)
@ -523,30 +523,30 @@ static void try_scroll (void)
if ((r1 == rmax) if ((r1 == rmax)
|| (SL_Screen[r1].new_hash != SL_Screen[r1].old_hash)) || (SL_Screen[r1].new_hash != SL_Screen[r1].old_hash))
break; break;
rmin = r1; rmin = r1;
} }
} }
for (i = rmax; i > rmin; i--) for (i = rmax; i > rmin; i--)
{ {
hash = SL_Screen[i].new_hash; hash = SL_Screen[i].new_hash;
if (hash == Blank_Hash) continue; if (hash == Blank_Hash) continue;
if ((hash == SL_Screen[i].old_hash) if ((hash == SL_Screen[i].old_hash)
|| ((i + 1 < Screen_Rows) && (hash == SL_Screen[i + 1].old_hash)) || ((i + 1 < Screen_Rows) && (hash == SL_Screen[i + 1].old_hash))
|| ((i - 1 > rmin) && (SL_Screen[i].old_hash == SL_Screen[i - 1].new_hash))) || ((i - 1 > rmin) && (SL_Screen[i].old_hash == SL_Screen[i - 1].new_hash)))
continue; continue;
for (j = i - 1; j >= rmin; j--) for (j = i - 1; j >= rmin; j--)
{ {
if (hash == SL_Screen[j].old_hash) break; if (hash == SL_Screen[j].old_hash) break;
} }
if (j < rmin) continue; if (j < rmin) continue;
r2 = i; /* end scroll region */ r2 = i; /* end scroll region */
di = i - j; di = i - j;
j--; j--;
ignore = 0; ignore = 0;
@ -556,12 +556,12 @@ static void try_scroll (void)
j--; j--;
} }
r1 = j + 1; r1 = j + 1;
/* If this scroll only scrolls this line into place, don't do it. /* If this scroll only scrolls this line into place, don't do it.
*/ */
if ((di > 1) && (r1 + di + ignore == r2)) continue; if ((di > 1) && (r1 + di + ignore == r2)) continue;
/* If there is anything in the scrolling region that is ok, abort the /* If there is anything in the scrolling region that is ok, abort the
* scroll. * scroll.
*/ */
@ -576,7 +576,7 @@ static void try_scroll (void)
} }
} }
if (j <= r2) continue; if (j <= r2) continue;
color = This_Color; This_Color = 0; color = This_Color; This_Color = 0;
did_scroll = 1; did_scroll = 1;
SLtt_normal_video (); SLtt_normal_video ();
@ -584,11 +584,11 @@ static void try_scroll (void)
SLtt_goto_rc (0, 0); SLtt_goto_rc (0, 0);
SLtt_reverse_index (di); SLtt_reverse_index (di);
SLtt_reset_scroll_region (); SLtt_reset_scroll_region ();
/* Now we have a hole in the screen. Make the virtual screen look /* Now we have a hole in the screen. Make the virtual screen look
* like it. * like it.
*/ */
for (j = r1; j <= r2; j++) SL_Screen[j].flags = TOUCHED; for (j = r1; j <= r2; j++) SL_Screen[j].flags = TOUCHED;
while (di--) while (di--)
{ {
tmp = SL_Screen[r2].old; tmp = SL_Screen[r2].old;
@ -605,7 +605,7 @@ static void try_scroll (void)
This_Color = color; This_Color = color;
} }
if (did_scroll) return; if (did_scroll) return;
/* Try other direction */ /* Try other direction */
for (i = rmin; i < rmax; i++) for (i = rmin; i < rmax; i++)
@ -613,18 +613,18 @@ static void try_scroll (void)
hash = SL_Screen[i].new_hash; hash = SL_Screen[i].new_hash;
if (hash == Blank_Hash) continue; if (hash == Blank_Hash) continue;
if (hash == SL_Screen[i].old_hash) continue; if (hash == SL_Screen[i].old_hash) continue;
/* find a match further down screen */ /* find a match further down screen */
for (j = i + 1; j <= rmax; j++) for (j = i + 1; j <= rmax; j++)
{ {
if (hash == SL_Screen[j].old_hash) break; if (hash == SL_Screen[j].old_hash) break;
} }
if (j > rmax) continue; if (j > rmax) continue;
r1 = i; /* beg scroll region */ r1 = i; /* beg scroll region */
di = j - i; /* number of lines to scroll */ di = j - i; /* number of lines to scroll */
j++; /* since we know this is a match */ j++; /* since we know this is a match */
/* find end of scroll region */ /* find end of scroll region */
ignore = 0; ignore = 0;
while ((j <= rmax) && (SL_Screen[j].old_hash == SL_Screen[j - di].new_hash)) while ((j <= rmax) && (SL_Screen[j].old_hash == SL_Screen[j - di].new_hash))
@ -633,15 +633,15 @@ static void try_scroll (void)
j++; j++;
} }
r2 = j - 1; /* end of scroll region */ r2 = j - 1; /* end of scroll region */
/* If this scroll only scrolls this line into place, don't do it. /* If this scroll only scrolls this line into place, don't do it.
*/ */
if ((di > 1) && (r1 + di + ignore == r2)) continue; if ((di > 1) && (r1 + di + ignore == r2)) continue;
/* If there is anything in the scrolling region that is ok, abort the /* If there is anything in the scrolling region that is ok, abort the
* scroll. * scroll.
*/ */
for (j = r1; j <= r2; j++) for (j = r1; j <= r2; j++)
{ {
if ((SL_Screen[j].old_hash != Blank_Hash) if ((SL_Screen[j].old_hash != Blank_Hash)
@ -650,21 +650,21 @@ static void try_scroll (void)
if ((j - di < r1) || (SL_Screen[j].old_hash != SL_Screen[j - di].new_hash)) if ((j - di < r1) || (SL_Screen[j].old_hash != SL_Screen[j - di].new_hash))
break; break;
} }
} }
if (j <= r2) continue; if (j <= r2) continue;
color = This_Color; This_Color = 0; color = This_Color; This_Color = 0;
SLtt_normal_video (); SLtt_normal_video ();
SLtt_set_scroll_region (r1, r2); SLtt_set_scroll_region (r1, r2);
SLtt_goto_rc (0, 0); /* relative to scroll region */ SLtt_goto_rc (0, 0); /* relative to scroll region */
SLtt_delete_nlines (di); SLtt_delete_nlines (di);
SLtt_reset_scroll_region (); SLtt_reset_scroll_region ();
/* Now we have a hole in the screen. Make the virtual screen look /* Now we have a hole in the screen. Make the virtual screen look
* like it. * like it.
*/ */
for (j = r1; j <= r2; j++) SL_Screen[j].flags = TOUCHED; for (j = r1; j <= r2; j++) SL_Screen[j].flags = TOUCHED;
while (di--) while (di--)
{ {
tmp = SL_Screen[r1].old; tmp = SL_Screen[r1].old;
@ -683,15 +683,15 @@ static void try_scroll (void)
} }
#endif /* NOT pc_system */ #endif /* NOT pc_system */
static int Smg_Inited; static int Smg_Inited;
void SLsmg_refresh (void) void SLsmg_refresh (void)
{ {
int i; int i;
if (Smg_Inited == 0) return; if (Smg_Inited == 0) return;
#ifndef pc_system #ifndef pc_system
for (i = 0; i < Screen_Rows; i++) for (i = 0; i < Screen_Rows; i++)
@ -700,8 +700,8 @@ void SLsmg_refresh (void)
SL_Screen[i].new_hash = compute_hash (SL_Screen[i].neew, Screen_Cols); SL_Screen[i].new_hash = compute_hash (SL_Screen[i].neew, Screen_Cols);
} }
#endif #endif
if (Cls_Flag) if (Cls_Flag)
{ {
SLtt_normal_video (); SLtt_cls (); SLtt_normal_video (); SLtt_cls ();
} }
@ -712,9 +712,9 @@ void SLsmg_refresh (void)
for (i = 0; i < Screen_Rows; i++) for (i = 0; i < Screen_Rows; i++)
{ {
int trashed; int trashed;
if (SL_Screen[i].flags == 0) continue; if (SL_Screen[i].flags == 0) continue;
if (SL_Screen[i].flags & TRASHED) if (SL_Screen[i].flags & TRASHED)
{ {
SLtt_goto_rc (i, -1); /* Force cursor to move */ SLtt_goto_rc (i, -1); /* Force cursor to move */
@ -723,21 +723,21 @@ void SLsmg_refresh (void)
trashed = 1; trashed = 1;
} }
else trashed = 0; else trashed = 0;
if (Cls_Flag || trashed) if (Cls_Flag || trashed)
{ {
int color = This_Color; int color = This_Color;
This_Color = 0; This_Color = 0;
blank_line (SL_Screen[i].old, Screen_Cols, ' '); blank_line (SL_Screen[i].old, Screen_Cols, ' ');
This_Color = color; This_Color = color;
} }
SL_Screen[i].old[Screen_Cols] = 0; SL_Screen[i].old[Screen_Cols] = 0;
SL_Screen[i].neew[Screen_Cols] = 0; SL_Screen[i].neew[Screen_Cols] = 0;
SLtt_smart_puts (SL_Screen[i].neew, SL_Screen[i].old, Screen_Cols, i); SLtt_smart_puts (SL_Screen[i].neew, SL_Screen[i].old, Screen_Cols, i);
SLMEMCPY ((char *) SL_Screen[i].old, (char *) SL_Screen[i].neew, SLMEMCPY ((char *) SL_Screen[i].old, (char *) SL_Screen[i].neew,
Screen_Cols * sizeof (short)); Screen_Cols * sizeof (short));
SL_Screen[i].flags = 0; SL_Screen[i].flags = 0;
@ -745,7 +745,7 @@ void SLsmg_refresh (void)
SL_Screen[i].old_hash = SL_Screen[i].new_hash; SL_Screen[i].old_hash = SL_Screen[i].new_hash;
#endif #endif
} }
if (point_visible (1)) SLtt_goto_rc (This_Row - Start_Row, This_Col - Start_Col); if (point_visible (1)) SLtt_goto_rc (This_Row - Start_Row, This_Col - Start_Col);
SLtt_flush_output (); SLtt_flush_output ();
Cls_Flag = 0; Cls_Flag = 0;
@ -755,12 +755,12 @@ static int compute_clip (int row, int n, int box_start, int box_end,
int *rmin, int *rmax) int *rmin, int *rmax)
{ {
int row_max; int row_max;
if (n < 0) return 0; if (n < 0) return 0;
if (row >= box_end) return 0; if (row >= box_end) return 0;
row_max = row + n; row_max = row + n;
if (row_max <= box_start) return 0; if (row_max <= box_start) return 0;
if (row < box_start) row = box_start; if (row < box_start) row = box_start;
if (row_max >= box_end) row_max = box_end; if (row_max >= box_end) row_max = box_end;
*rmin = row; *rmin = row;
@ -772,10 +772,10 @@ void SLsmg_touch_lines (int row, int n)
{ {
int i; int i;
int r1, r2; int r1, r2;
if (0 == compute_clip (row, n, Start_Row, Start_Row + Screen_Rows, &r1, &r2)) if (0 == compute_clip (row, n, Start_Row, Start_Row + Screen_Rows, &r1, &r2))
return; return;
r1 -= Start_Row; r1 -= Start_Row;
r2 -= Start_Row; r2 -= Start_Row;
for (i = r1; i < r2; i++) for (i = r1; i < r2; i++)
@ -791,17 +791,17 @@ static void init_alt_char_set (void)
{ {
int i; int i;
unsigned char *p, *pmax, ch; unsigned char *p, *pmax, ch;
if (Alt_Char_Set[128] == 128) return; if (Alt_Char_Set[128] == 128) return;
i = 32; i = 32;
memset ((char *)Alt_Char_Set, ' ', i); memset ((char *)Alt_Char_Set, ' ', i);
while (i <= 128) while (i <= 128)
{ {
Alt_Char_Set [i] = i; Alt_Char_Set [i] = i;
i++; i++;
} }
/* Map to VT100 */ /* Map to VT100 */
if (SLtt_Has_Alt_Charset) if (SLtt_Has_Alt_Charset)
{ {
@ -810,7 +810,7 @@ static void init_alt_char_set (void)
} }
else p = (unsigned char *) Fake_Alt_Char_Pairs; else p = (unsigned char *) Fake_Alt_Char_Pairs;
pmax = p + strlen ((char *) p); pmax = p + strlen ((char *) p);
/* Some systems have messed up entries for this */ /* Some systems have messed up entries for this */
while (p < pmax) while (p < pmax)
{ {
@ -840,7 +840,7 @@ void SLsmg_suspend_smg (void)
SLtt_reset_video (); SLtt_reset_video ();
Smg_Suspended = 1; Smg_Suspended = 1;
} }
UNBLOCK_SIGNALS UNBLOCK_SIGNALS
} }
@ -849,19 +849,19 @@ void SLsmg_resume_smg (void)
int i; int i;
BLOCK_SIGNALS BLOCK_SIGNALS
if (Smg_Suspended == 0) if (Smg_Suspended == 0)
{ {
UNBLOCK_SIGNALS UNBLOCK_SIGNALS
return; return;
} }
Smg_Suspended = 0; Smg_Suspended = 0;
SLtt_init_video (); SLtt_init_video ();
Cls_Flag = 1; Cls_Flag = 1;
for (i = 0; i < Screen_Rows; i++) for (i = 0; i < Screen_Rows; i++)
SL_Screen[i].flags |= TRASHED; SL_Screen[i].flags |= TRASHED;
SLsmg_refresh (); SLsmg_refresh ();
UNBLOCK_SIGNALS UNBLOCK_SIGNALS
} }
@ -870,7 +870,7 @@ int SLsmg_init_smg (void)
int i, len; int i, len;
unsigned short *old, *neew; unsigned short *old, *neew;
BLOCK_SIGNALS BLOCK_SIGNALS
if (Smg_Inited) SLsmg_reset_smg (); if (Smg_Inited) SLsmg_reset_smg ();
SLtt_init_video (); SLtt_init_video ();
Screen_Cols = SLtt_Screen_Cols; Screen_Cols = SLtt_Screen_Cols;
@ -913,8 +913,8 @@ void SLsmg_reset_smg (void)
{ {
int i; int i;
BLOCK_SIGNALS BLOCK_SIGNALS
if (Smg_Inited == 0) if (Smg_Inited == 0)
{ {
UNBLOCK_SIGNALS UNBLOCK_SIGNALS
return; return;
@ -928,7 +928,7 @@ void SLsmg_reset_smg (void)
SLtt_reset_video (); SLtt_reset_video ();
This_Alt_Char = This_Color = 0; This_Alt_Char = This_Color = 0;
Smg_Inited = 0; Smg_Inited = 0;
UNBLOCK_SIGNALS UNBLOCK_SIGNALS
} }
@ -946,16 +946,16 @@ unsigned short SLsmg_char_at (void)
void SLsmg_vprintf (char *fmt, va_list ap) void SLsmg_vprintf (char *fmt, va_list ap)
{ {
char p[1000]; char p[1000];
(void) vsprintf(p, fmt, ap); (void) vsprintf(p, fmt, ap);
SLsmg_write_string (p); SLsmg_write_string (p);
} }
void SLsmg_set_screen_start (int *r, int *c) void SLsmg_set_screen_start (int *r, int *c)
{ {
int or = Start_Row, oc = Start_Col; int or = Start_Row, oc = Start_Col;
if (c == NULL) Start_Col = 0; if (c == NULL) Start_Col = 0;
else else
{ {
@ -973,7 +973,7 @@ void SLsmg_set_screen_start (int *r, int *c)
void SLsmg_draw_object (int r, int c, unsigned char object) void SLsmg_draw_object (int r, int c, unsigned char object)
{ {
This_Row = r; This_Col = c; This_Row = r; This_Col = c;
if (point_visible (1)) if (point_visible (1))
{ {
int color = This_Color; int color = This_Color;
@ -992,33 +992,33 @@ void SLsmg_draw_hline (int n)
int cmin, cmax; int cmin, cmax;
int final_col = This_Col + n; int final_col = This_Col + n;
int save_color; int save_color;
if ((This_Row < Start_Row) || (This_Row >= Start_Row + Screen_Rows) if ((This_Row < Start_Row) || (This_Row >= Start_Row + Screen_Rows)
|| (0 == compute_clip (This_Col, n, Start_Col, Start_Col + Screen_Cols, || (0 == compute_clip (This_Col, n, Start_Col, Start_Col + Screen_Cols,
&cmin, &cmax))) &cmin, &cmax)))
{ {
This_Col = final_col; This_Col = final_col;
return; return;
} }
if (hbuf[0] == 0) if (hbuf[0] == 0)
{ {
SLMEMSET ((char *) hbuf, SLSMG_HLINE_CHAR, 16); SLMEMSET ((char *) hbuf, SLSMG_HLINE_CHAR, 16);
} }
n = cmax - cmin; n = cmax - cmin;
count = n / 16; count = n / 16;
save_color = This_Color; save_color = This_Color;
This_Color |= ALT_CHAR_FLAG; This_Color |= ALT_CHAR_FLAG;
This_Col = cmin; This_Col = cmin;
SLsmg_write_nchars ((char *) hbuf, n % 16); SLsmg_write_nchars ((char *) hbuf, n % 16);
while (count-- > 0) while (count-- > 0)
{ {
SLsmg_write_nchars ((char *) hbuf, 16); SLsmg_write_nchars ((char *) hbuf, 16);
} }
This_Color = save_color; This_Color = save_color;
This_Col = final_col; This_Col = final_col;
} }
@ -1029,7 +1029,7 @@ void SLsmg_draw_vline (int n)
int c = This_Col, rmin, rmax; int c = This_Col, rmin, rmax;
int final_row = This_Row + n; int final_row = This_Row + n;
int save_color; int save_color;
if (((c < Start_Col) || (c >= Start_Col + Screen_Cols)) || if (((c < Start_Col) || (c >= Start_Col + Screen_Cols)) ||
(0 == compute_clip (This_Row, n, Start_Row, Start_Row + Screen_Rows, (0 == compute_clip (This_Row, n, Start_Row, Start_Row + Screen_Rows,
&rmin, &rmax))) &rmin, &rmax)))
@ -1037,52 +1037,52 @@ void SLsmg_draw_vline (int n)
This_Row = final_row; This_Row = final_row;
return; return;
} }
save_color = This_Color; save_color = This_Color;
This_Color |= ALT_CHAR_FLAG; This_Color |= ALT_CHAR_FLAG;
for (This_Row = rmin; This_Row < rmax; This_Row++) for (This_Row = rmin; This_Row < rmax; This_Row++)
{ {
This_Col = c; This_Col = c;
SLsmg_write_nchars ((char *) &ch, 1); SLsmg_write_nchars ((char *) &ch, 1);
} }
This_Col = c; This_Row = final_row; This_Col = c; This_Row = final_row;
This_Color = save_color; This_Color = save_color;
} }
void SLsmg_draw_box (int r, int c, int dr, int dc) void SLsmg_draw_box (int r, int c, int dr, int dc)
{ {
if (!dr || !dc) return; if (!dr || !dc) return;
This_Row = r; This_Col = c; This_Row = r; This_Col = c;
dr--; dc--; dr--; dc--;
SLsmg_draw_hline (dc); SLsmg_draw_hline (dc);
SLsmg_draw_vline (dr); SLsmg_draw_vline (dr);
This_Row = r; This_Col = c; This_Row = r; This_Col = c;
SLsmg_draw_vline (dr); SLsmg_draw_vline (dr);
SLsmg_draw_hline (dc); SLsmg_draw_hline (dc);
SLsmg_draw_object (r, c, SLSMG_ULCORN_CHAR); SLsmg_draw_object (r, c, SLSMG_ULCORN_CHAR);
SLsmg_draw_object (r, c + dc, SLSMG_URCORN_CHAR); SLsmg_draw_object (r, c + dc, SLSMG_URCORN_CHAR);
SLsmg_draw_object (r + dr, c, SLSMG_LLCORN_CHAR); SLsmg_draw_object (r + dr, c, SLSMG_LLCORN_CHAR);
SLsmg_draw_object (r + dr, c + dc, SLSMG_LRCORN_CHAR); SLsmg_draw_object (r + dr, c + dc, SLSMG_LRCORN_CHAR);
This_Row = r; This_Col = c; This_Row = r; This_Col = c;
} }
void SLsmg_fill_region (int r, int c, int dr, int dc, unsigned char ch) void SLsmg_fill_region (int r, int c, int dr, int dc, unsigned char ch)
{ {
static unsigned char hbuf[16]; static unsigned char hbuf[16];
int count; int count;
int dcmax, rmax; int dcmax, rmax;
if ((dc < 0) || (dr < 0)) return; if ((dc < 0) || (dr < 0)) return;
SLsmg_gotorc (r, c); SLsmg_gotorc (r, c);
r = This_Row; c = This_Col; r = This_Row; c = This_Col;
dcmax = Screen_Cols - This_Col; dcmax = Screen_Cols - This_Col;
if (dc > dcmax) dc = dcmax; if (dc > dcmax) dc = dcmax;
rmax = This_Row + dr; rmax = This_Row + dr;
if (rmax > Screen_Rows) rmax = Screen_Rows; if (rmax > Screen_Rows) rmax = Screen_Rows;
@ -1090,7 +1090,7 @@ void SLsmg_fill_region (int r, int c, int dr, int dc, unsigned char ch)
ch = Alt_Char_Set[ch]; ch = Alt_Char_Set[ch];
#endif #endif
if (ch != hbuf[0]) SLMEMSET ((char *) hbuf, (char) ch, 16); if (ch != hbuf[0]) SLMEMSET ((char *) hbuf, (char) ch, 16);
for (This_Row = r; This_Row < rmax; This_Row++) for (This_Row = r; This_Row < rmax; This_Row++)
{ {
This_Col = c; This_Col = c;
@ -1101,7 +1101,7 @@ void SLsmg_fill_region (int r, int c, int dr, int dc, unsigned char ch)
SLsmg_write_nchars ((char *) hbuf, 16); SLsmg_write_nchars ((char *) hbuf, 16);
} }
} }
This_Row = r; This_Row = r;
} }
@ -1115,21 +1115,21 @@ void SLsmg_write_color_chars (unsigned short *s, unsigned int len)
unsigned short *smax, sh; unsigned short *smax, sh;
char buf[32], *b, *bmax; char buf[32], *b, *bmax;
int color, save_color; int color, save_color;
smax = s + len; smax = s + len;
b = buf; b = buf;
bmax = b + sizeof (buf); bmax = b + sizeof (buf);
save_color = This_Color; save_color = This_Color;
while (s < smax) while (s < smax)
{ {
sh = *s++; sh = *s++;
color = sh >> 8; color = sh >> 8;
if ((color != This_Color) || (b == bmax)) if ((color != This_Color) || (b == bmax))
{ {
if (b != buf) if (b != buf)
{ {
SLsmg_write_nchars (buf, (int) (b - buf)); SLsmg_write_nchars (buf, (int) (b - buf));
b = buf; b = buf;
@ -1138,10 +1138,10 @@ void SLsmg_write_color_chars (unsigned short *s, unsigned int len)
} }
*b++ = (char) (sh & 0xFF); *b++ = (char) (sh & 0xFF);
} }
if (b != buf) if (b != buf)
SLsmg_write_nchars (buf, (int) (b - buf)); SLsmg_write_nchars (buf, (int) (b - buf));
This_Color = save_color; This_Color = save_color;
} }
@ -1150,13 +1150,13 @@ unsigned int SLsmg_read_raw (unsigned short *buf, unsigned int len)
unsigned int r, c; unsigned int r, c;
if (0 == point_visible (1)) return 0; if (0 == point_visible (1)) return 0;
r = (unsigned int) (This_Row - Start_Row); r = (unsigned int) (This_Row - Start_Row);
c = (unsigned int) (This_Col - Start_Col); c = (unsigned int) (This_Col - Start_Col);
if (c + len > (unsigned int) Screen_Cols) if (c + len > (unsigned int) Screen_Cols)
len = (unsigned int) Screen_Cols - c; len = (unsigned int) Screen_Cols - c;
memcpy ((char *) buf, (char *) (SL_Screen[r].neew + c), len * sizeof (short)); memcpy ((char *) buf, (char *) (SL_Screen[r].neew + c), len * sizeof (short));
return len; return len;
} }
@ -1165,19 +1165,19 @@ unsigned int SLsmg_write_raw (unsigned short *buf, unsigned int len)
{ {
unsigned int r, c; unsigned int r, c;
unsigned short *dest; unsigned short *dest;
if (0 == point_visible (1)) return 0; if (0 == point_visible (1)) return 0;
r = (unsigned int) (This_Row - Start_Row); r = (unsigned int) (This_Row - Start_Row);
c = (unsigned int) (This_Col - Start_Col); c = (unsigned int) (This_Col - Start_Col);
if (c + len > (unsigned int) Screen_Cols) if (c + len > (unsigned int) Screen_Cols)
len = (unsigned int) Screen_Cols - c; len = (unsigned int) Screen_Cols - c;
dest = SL_Screen[r].neew + c; dest = SL_Screen[r].neew + c;
if (0 != memcmp ((char *) dest, (char *) buf, len * sizeof (short))) if (0 != memcmp ((char *) dest, (char *) buf, len * sizeof (short)))
{ {
memcpy ((char *) dest, (char *) buf, len * sizeof (short)); memcpy ((char *) dest, (char *) buf, len * sizeof (short));
SL_Screen[r].flags |= TOUCHED; SL_Screen[r].flags |= TOUCHED;
} }

View file

@ -4,7 +4,7 @@
/* Copyright (c) 1992, 1995 John E. Davis /* Copyright (c) 1992, 1995 John E. Davis
* All rights reserved. * All rights reserved.
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Perl Artistic License. * License or the Perl Artistic License.
*/ */
@ -24,7 +24,7 @@
* The majority of the comments found in the file were taken from the * The majority of the comments found in the file were taken from the
* term(4) man page on an SGI. * term(4) man page on an SGI.
*/ */
/* Short integers are stored in two 8-bit bytes. The first byte contains /* Short integers are stored in two 8-bit bytes. The first byte contains
* the least significant 8 bits of the value, and the second byte contains * the least significant 8 bits of the value, and the second byte contains
* the most significant 8 bits. (Thus, the value represented is * the most significant 8 bits. (Thus, the value represented is
@ -53,7 +53,7 @@ static int make_integer (unsigned char *buf)
* tic, and read by the routine setupterm [see curses(3X).] The file is * tic, and read by the routine setupterm [see curses(3X).] The file is
* divided into six parts in the following order: the header, terminal * divided into six parts in the following order: the header, terminal
* names, boolean flags, numbers, strings, and string table. * names, boolean flags, numbers, strings, and string table.
* *
* The header section begins the file. This section contains six short * The header section begins the file. This section contains six short
* integers in the format described below. These integers are (1) the magic * integers in the format described below. These integers are (1) the magic
* number (octal 0432); (2) the size, in bytes, of the names section; (3) * number (octal 0432); (2) the size, in bytes, of the names section; (3)
@ -65,7 +65,7 @@ static int make_integer (unsigned char *buf)
#define MAGIC 0432 #define MAGIC 0432
/* In this structure, all char * fields are malloced EXCEPT if the /* In this structure, all char * fields are malloced EXCEPT if the
* structure is SLTERMCAP. In that case, only terminal_names is malloced * structure is SLTERMCAP. In that case, only terminal_names is malloced
* and the other fields are pointers into it. * and the other fields are pointers into it.
*/ */
@ -77,19 +77,19 @@ typedef struct
unsigned int name_section_size; unsigned int name_section_size;
char *terminal_names; char *terminal_names;
unsigned int boolean_section_size; unsigned int boolean_section_size;
unsigned char *boolean_flags; unsigned char *boolean_flags;
unsigned int num_numbers; unsigned int num_numbers;
unsigned char *numbers; unsigned char *numbers;
unsigned int num_string_offsets; unsigned int num_string_offsets;
unsigned char *string_offsets; unsigned char *string_offsets;
unsigned int string_table_size; unsigned int string_table_size;
char *string_table; char *string_table;
} Terminfo_Type; } Terminfo_Type;
static char *tcap_getstr (char *, Terminfo_Type *); static char *tcap_getstr (char *, Terminfo_Type *);
@ -101,10 +101,10 @@ static FILE *open_terminfo (char *file, Terminfo_Type *h)
{ {
FILE *fp; FILE *fp;
unsigned char buf[12]; unsigned char buf[12];
fp = fopen (file, "rb"); fp = fopen (file, "rb");
if (fp == NULL) return NULL; if (fp == NULL) return NULL;
if ((12 == fread ((char *) buf, 1, 12, fp) && (MAGIC == make_integer (buf)))) if ((12 == fread ((char *) buf, 1, 12, fp) && (MAGIC == make_integer (buf))))
{ {
h->name_section_size = make_integer (buf + 2); h->name_section_size = make_integer (buf + 2);
@ -113,15 +113,15 @@ static FILE *open_terminfo (char *file, Terminfo_Type *h)
h->num_string_offsets = make_integer (buf + 8); h->num_string_offsets = make_integer (buf + 8);
h->string_table_size = make_integer (buf + 10); h->string_table_size = make_integer (buf + 10);
} }
else else
{ {
fclose (fp); fclose (fp);
fp = NULL; fp = NULL;
} }
return fp; return fp;
} }
/* /*
* The terminal names section comes next. It contains the first line of the * The terminal names section comes next. It contains the first line of the
* terminfo description, listing the various names for the terminal, * terminfo description, listing the various names for the terminal,
* separated by the bar ( | ) character (see term(5)). The section is * separated by the bar ( | ) character (see term(5)). The section is
@ -132,7 +132,7 @@ static FILE *open_terminfo (char *file, Terminfo_Type *h)
static unsigned char *read_terminfo_section (FILE *fp, unsigned int size) static unsigned char *read_terminfo_section (FILE *fp, unsigned int size)
{ {
char *s; char *s;
if (NULL == (s = (char *) SLMALLOC (size))) return NULL; if (NULL == (s = (char *) SLMALLOC (size))) return NULL;
if (size != fread (s, 1, size, fp)) if (size != fread (s, 1, size, fp))
{ {
@ -161,16 +161,16 @@ static unsigned char *read_boolean_flags (FILE *fp, Terminfo_Type *t)
* even byte offset. All short integers are aligned on a short word * even byte offset. All short integers are aligned on a short word
* boundary. * boundary.
*/ */
unsigned int size = (t->name_section_size + t->boolean_section_size) % 2; unsigned int size = (t->name_section_size + t->boolean_section_size) % 2;
size += t->boolean_section_size; size += t->boolean_section_size;
return t->boolean_flags = read_terminfo_section (fp, size); return t->boolean_flags = read_terminfo_section (fp, size);
} }
/* /*
* The numbers section is similar to the boolean flags section. Each * The numbers section is similar to the boolean flags section. Each
* capability takes up two bytes, and is stored as a short integer. If the * capability takes up two bytes, and is stored as a short integer. If the
* value represented is -1 or -2, the capability is taken to be missing. * value represented is -1 or -2, the capability is taken to be missing.
@ -219,7 +219,7 @@ static char *read_string_table (FILE *fp, Terminfo_Type *t)
*/ */
#define MAX_TI_DIRS 7 #define MAX_TI_DIRS 7
static char *Terminfo_Dirs [MAX_TI_DIRS] = static char *Terminfo_Dirs [MAX_TI_DIRS] =
{ {
NULL, NULL,
"/usr/lib/terminfo", "/usr/lib/terminfo",
@ -232,25 +232,25 @@ static char *Terminfo_Dirs [MAX_TI_DIRS] =
char *SLtt_tigetent (char *term) char *SLtt_tigetent (char *term)
{ {
char *tidir; char *tidir;
int i; int i;
FILE *fp = NULL; FILE *fp = NULL;
char file[256]; char file[256];
Terminfo_Type *ti; Terminfo_Type *ti;
if ( if (
(term == NULL) (term == NULL)
#ifdef SLANG_UNTIC #ifdef SLANG_UNTIC
&& (SLang_Untic_Terminfo_File == NULL) && (SLang_Untic_Terminfo_File == NULL)
#endif #endif
) )
return NULL; return NULL;
if (NULL == (ti = (Terminfo_Type *) SLMALLOC (sizeof (Terminfo_Type)))) if (NULL == (ti = (Terminfo_Type *) SLMALLOC (sizeof (Terminfo_Type))))
{ {
return NULL; return NULL;
} }
#ifdef SLANG_UNTIC #ifdef SLANG_UNTIC
if (SLang_Untic_Terminfo_File != NULL) if (SLang_Untic_Terminfo_File != NULL)
{ {
@ -261,7 +261,7 @@ char *SLtt_tigetent (char *term)
#endif #endif
/* If we are on a termcap based system, use termcap */ /* If we are on a termcap based system, use termcap */
if (0 == tcap_getent (term, ti)) return (char *) ti; if (0 == tcap_getent (term, ti)) return (char *) ti;
Terminfo_Dirs[0] = getenv ("TERMINFO"); Terminfo_Dirs[0] = getenv ("TERMINFO");
i = 0; i = 0;
while (i < MAX_TI_DIRS) while (i < MAX_TI_DIRS)
@ -277,8 +277,8 @@ char *SLtt_tigetent (char *term)
#ifdef SLANG_UNTIC #ifdef SLANG_UNTIC
fp_open_label: fp_open_label:
#endif #endif
if (fp != NULL) if (fp != NULL)
{ {
if (NULL != read_terminal_names (fp, ti)) if (NULL != read_terminal_names (fp, ti))
{ {
@ -305,7 +305,7 @@ char *SLtt_tigetent (char *term)
} }
fclose (fp); fclose (fp);
} }
SLFREE (ti); SLFREE (ti);
return NULL; return NULL;
} }
@ -316,7 +316,7 @@ char *SLtt_tigetent (char *term)
# define UNTIC_COMMENT(x) # define UNTIC_COMMENT(x)
#endif #endif
typedef struct typedef struct
{ {
char name[3]; char name[3];
int offset; int offset;
@ -413,7 +413,7 @@ static int compute_cap_offset (char *cap, Terminfo_Type *t, Tgetstr_Map_Type *ma
(void) t; (void) t;
cha = *cap++; chb = *cap; cha = *cap++; chb = *cap;
while (*map->name != 0) while (*map->name != 0)
{ {
if ((cha == *map->name) && (chb == *(map->name + 1))) if ((cha == *map->name) && (chb == *(map->name + 1)))
@ -426,16 +426,16 @@ static int compute_cap_offset (char *cap, Terminfo_Type *t, Tgetstr_Map_Type *ma
return -1; return -1;
} }
char *SLtt_tigetstr (char *cap, char **pp) char *SLtt_tigetstr (char *cap, char **pp)
{ {
int offset; int offset;
Terminfo_Type *t; Terminfo_Type *t;
if ((pp == NULL) || (NULL == (t = (Terminfo_Type *) *pp))) return NULL; if ((pp == NULL) || (NULL == (t = (Terminfo_Type *) *pp))) return NULL;
if (t->flags == SLTERMCAP) return tcap_getstr (cap, t); if (t->flags == SLTERMCAP) return tcap_getstr (cap, t);
offset = compute_cap_offset (cap, t, Tgetstr_Map, t->num_string_offsets); offset = compute_cap_offset (cap, t, Tgetstr_Map, t->num_string_offsets);
if (offset < 0) return NULL; if (offset < 0) return NULL;
offset = make_integer (t->string_offsets + 2 * offset); offset = make_integer (t->string_offsets + 2 * offset);
@ -458,7 +458,7 @@ int SLtt_tigetnum (char *cap, char **pp)
{ {
int offset; int offset;
Terminfo_Type *t; Terminfo_Type *t;
if ((pp == NULL) || (NULL == (t = (Terminfo_Type *) *pp))) return -1; if ((pp == NULL) || (NULL == (t = (Terminfo_Type *) *pp))) return -1;
if (t->flags == SLTERMCAP) return tcap_getnum (cap, t); if (t->flags == SLTERMCAP) return tcap_getnum (cap, t);
@ -483,13 +483,13 @@ int SLtt_tigetflag (char *cap, char **pp)
{ {
int offset; int offset;
Terminfo_Type *t; Terminfo_Type *t;
if ((pp == NULL) || (NULL == (t = (Terminfo_Type *) *pp))) return -1; if ((pp == NULL) || (NULL == (t = (Terminfo_Type *) *pp))) return -1;
if (t->flags == SLTERMCAP) return tcap_getflag (cap, t); if (t->flags == SLTERMCAP) return tcap_getflag (cap, t);
offset = compute_cap_offset (cap, t, Tgetflag_Map, t->boolean_section_size); offset = compute_cap_offset (cap, t, Tgetflag_Map, t->boolean_section_size);
if (offset < 0) return -1; if (offset < 0) return -1;
return (int) *(t->boolean_flags + offset); return (int) *(t->boolean_flags + offset);
} }
@ -505,7 +505,7 @@ static int tcap_getflag (char *cap, Terminfo_Type *t)
char a, b; char a, b;
char *f = (char *) t->boolean_flags; char *f = (char *) t->boolean_flags;
char *fmax; char *fmax;
if (f == NULL) return 0; if (f == NULL) return 0;
fmax = f + t->boolean_section_size; fmax = f + t->boolean_section_size;
@ -524,10 +524,10 @@ static char *tcap_get_cap (unsigned char *cap, unsigned char *caps, unsigned int
{ {
unsigned char c0, c1; unsigned char c0, c1;
unsigned char *caps_max; unsigned char *caps_max;
c0 = cap[0]; c0 = cap[0];
c1 = cap[1]; c1 = cap[1];
if (caps == NULL) return NULL; if (caps == NULL) return NULL;
caps_max = caps + len; caps_max = caps + len;
while (caps < caps_max) while (caps < caps_max)
@ -541,7 +541,7 @@ static char *tcap_get_cap (unsigned char *cap, unsigned char *caps, unsigned int
return NULL; return NULL;
} }
static int tcap_getnum (char *cap, Terminfo_Type *t) static int tcap_getnum (char *cap, Terminfo_Type *t)
{ {
cap = tcap_get_cap ((unsigned char *) cap, t->numbers, t->num_numbers); cap = tcap_get_cap ((unsigned char *) cap, t->numbers, t->num_numbers);
@ -569,7 +569,7 @@ static int tcap_getent (char *term, Terminfo_Type *ti)
unsigned char *buf, *b; unsigned char *buf, *b;
unsigned char *t; unsigned char *t;
int len; int len;
if (SLtt_Try_Termcap == 0) return -1; if (SLtt_Try_Termcap == 0) return -1;
#if 1 #if 1
/* XFREE86 xterm sets the TERMCAP environment variable to an invalid /* XFREE86 xterm sets the TERMCAP environment variable to an invalid
@ -580,8 +580,8 @@ static int tcap_getent (char *term, Terminfo_Type *ti)
#endif #endif
termcap = (unsigned char *) getenv ("TERMCAP"); termcap = (unsigned char *) getenv ("TERMCAP");
if ((termcap == NULL) || (*termcap == '/')) return -1; if ((termcap == NULL) || (*termcap == '/')) return -1;
/* We have a termcap so lets use it provided it does not have a reference /* We have a termcap so lets use it provided it does not have a reference
* to another terminal via tc=. In that case, user terminfo. The alternative * to another terminal via tc=. In that case, user terminfo. The alternative
* would be to parse the termcap file which I do not want to do right now. * would be to parse the termcap file which I do not want to do right now.
* Besides, this is a terminfo based system and if the termcap were parsed * Besides, this is a terminfo based system and if the termcap were parsed
@ -595,17 +595,17 @@ static int tcap_getent (char *term, Terminfo_Type *ti)
return -1; return -1;
t += (len + 1); t += (len + 1);
} }
/* malloc some extra space just in case it is needed. */ /* malloc some extra space just in case it is needed. */
len = strlen ((char *) termcap) + 256; len = strlen ((char *) termcap) + 256;
if (NULL == (buf = (unsigned char *) SLMALLOC ((unsigned int) len))) return -1; if (NULL == (buf = (unsigned char *) SLMALLOC ((unsigned int) len))) return -1;
b = buf; b = buf;
/* The beginning of the termcap entry contains the names of the entry. /* The beginning of the termcap entry contains the names of the entry.
* It is terminated by a colon. * It is terminated by a colon.
*/ */
ti->terminal_names = (char *) b; ti->terminal_names = (char *) b;
t = termcap; t = termcap;
len = tcap_extract_field (t); len = tcap_extract_field (t);
@ -618,14 +618,14 @@ static int tcap_getent (char *term, Terminfo_Type *ti)
b[len] = 0; b[len] = 0;
b += len + 1; b += len + 1;
ti->name_section_size = len; ti->name_section_size = len;
/* Now, we are really at the start of the termcap entries. Point the /* Now, we are really at the start of the termcap entries. Point the
* termcap variable here since we want to refer to this a number of times. * termcap variable here since we want to refer to this a number of times.
*/ */
termcap = t + (len + 1); termcap = t + (len + 1);
/* Process strings first. */ /* Process strings first. */
ti->string_table = (char *) b; ti->string_table = (char *) b;
t = termcap; t = termcap;
@ -633,7 +633,7 @@ static int tcap_getent (char *term, Terminfo_Type *ti)
{ {
unsigned char *b1; unsigned char *b1;
unsigned char *tmax; unsigned char *tmax;
/* We are looking for: XX=something */ /* We are looking for: XX=something */
if ((len < 4) || (t[2] != '=') || (*t == '.')) if ((len < 4) || (t[2] != '=') || (*t == '.'))
{ {
@ -642,7 +642,7 @@ static int tcap_getent (char *term, Terminfo_Type *ti)
} }
tmax = t + len; tmax = t + len;
b1 = b; b1 = b;
while (t < tmax) while (t < tmax)
{ {
ch = *t++; ch = *t++;
@ -664,7 +664,7 @@ static int tcap_getent (char *term, Terminfo_Type *ti)
b1[2] = (unsigned char) len; /* replace the = by the length */ b1[2] = (unsigned char) len; /* replace the = by the length */
/* skip colon to next field. */ /* skip colon to next field. */
t++; t++;
} }
ti->string_table_size = (int) (b - (unsigned char *) ti->string_table); ti->string_table_size = (int) (b - (unsigned char *) ti->string_table);
/* Now process the numbers. */ /* Now process the numbers. */
@ -675,7 +675,7 @@ static int tcap_getent (char *term, Terminfo_Type *ti)
{ {
unsigned char *b1; unsigned char *b1;
unsigned char *tmax; unsigned char *tmax;
/* We are looking for: XX#NUMBER */ /* We are looking for: XX#NUMBER */
if ((len < 4) || (t[2] != '#') || (*t == '.')) if ((len < 4) || (t[2] != '#') || (*t == '.'))
{ {
@ -684,7 +684,7 @@ static int tcap_getent (char *term, Terminfo_Type *ti)
} }
tmax = t + len; tmax = t + len;
b1 = b; b1 = b;
while (t < tmax) while (t < tmax)
{ {
*b++ = *t++; *b++ = *t++;
@ -694,16 +694,16 @@ static int tcap_getent (char *term, Terminfo_Type *ti)
len = (int) (b - b1); len = (int) (b - b1);
b1[2] = (unsigned char) len; /* replace the # by the length */ b1[2] = (unsigned char) len; /* replace the # by the length */
t++; t++;
} }
ti->num_numbers = (int) (b - ti->numbers); ti->num_numbers = (int) (b - ti->numbers);
/* Now process the flags. */ /* Now process the flags. */
t = termcap; t = termcap;
ti->boolean_flags = b; ti->boolean_flags = b;
while (-1 != (len = tcap_extract_field (t))) while (-1 != (len = tcap_extract_field (t)))
{ {
/* We are looking for: XX#NUMBER */ /* We are looking for: XX#NUMBER */
if ((len != 2) || (*t == '.') || (*t <= ' ')) if ((len != 2) || (*t == '.') || (*t <= ' '))
{ {
t += len + 1; t += len + 1;
continue; continue;
@ -712,7 +712,7 @@ static int tcap_getent (char *term, Terminfo_Type *ti)
b[1] = t[1]; b[1] = t[1];
t += 3; t += 3;
b += 2; b += 2;
} }
ti->boolean_section_size = (int) (b - ti->boolean_flags); ti->boolean_section_size = (int) (b - ti->boolean_flags);
ti->flags = SLTERMCAP; ti->flags = SLTERMCAP;
return 0; return 0;

View file

@ -62,9 +62,9 @@ char *SLexpand_escaped_char(char *p, char *ch)
int i = 0; int i = 0;
int max = 0, num, base = 0; int max = 0, num, base = 0;
char ch1; char ch1;
ch1 = *p++; ch1 = *p++;
switch (ch1) switch (ch1)
{ {
default: num = ch1; break; default: num = ch1; break;
@ -75,23 +75,23 @@ char *SLexpand_escaped_char(char *p, char *ch)
case 'r': num = '\r'; break; case 'r': num = '\r'; break;
case 'f': num = '\f'; break; case 'f': num = '\f'; break;
case 'E': case 'e': num = 27; break; case 'E': case 'e': num = 27; break;
case 'a': num = 7; case 'a': num = 7;
break; break;
/* octal */ /* octal */
case '0': case '1': case '2': case '3': case '0': case '1': case '2': case '3':
case '4': case '5': case '6': case '7': case '4': case '5': case '6': case '7':
max = '7'; max = '7';
base = 8; i = 2; num = ch1 - '0'; base = 8; i = 2; num = ch1 - '0';
break; break;
case 'd': /* decimal -- S-Lang extension */ case 'd': /* decimal -- S-Lang extension */
base = 10; base = 10;
i = 3; i = 3;
max = '9'; max = '9';
num = 0; num = 0;
break; break;
case 'x': /* hex */ case 'x': /* hex */
base = 16; base = 16;
max = '9'; max = '9';
@ -99,11 +99,11 @@ char *SLexpand_escaped_char(char *p, char *ch)
num = 0; num = 0;
break; break;
} }
while (i--) while (i--)
{ {
ch1 = *p; ch1 = *p;
if ((ch1 <= max) && (ch1 >= '0')) if ((ch1 <= max) && (ch1 >= '0'))
{ {
num = base * num + (ch1 - '0'); num = base * num + (ch1 - '0');
@ -117,16 +117,16 @@ char *SLexpand_escaped_char(char *p, char *ch)
else break; else break;
p++; p++;
} }
*ch = (char) num; *ch = (char) num;
return p; return p;
} }
void SLexpand_escaped_string (register char *s, register char *t, void SLexpand_escaped_string (register char *s, register char *t,
register char *tmax) register char *tmax)
{ {
char ch; char ch;
while (t < tmax) while (t < tmax)
{ {
ch = *t++; ch = *t++;
@ -146,13 +146,13 @@ int SLang_extract_token (char **linep, char *word_parm, int byte_comp)
int string; int string;
char ch1; char ch1;
char *word_max; char *word_max;
word_max = word + 250; word_max = word + 250;
line = *linep; line = *linep;
/* skip white space */ /* skip white space */
while (((ch = *line) == ' ') while (((ch = *line) == ' ')
|| (ch == '\t')) line++; || (ch == '\t')) line++;
if ((!ch) || (ch == '\n')) if ((!ch) || (ch == '\n'))
@ -160,26 +160,26 @@ int SLang_extract_token (char **linep, char *word_parm, int byte_comp)
*linep = line; *linep = line;
return(0); return(0);
} }
*word++ = ch; *word++ = ch;
line++; line++;
/* Look for -something and rule out --something and -= something */ /* Look for -something and rule out --something and -= something */
if ((ch == '-') && if ((ch == '-') &&
(*line != '-') && (*line != '=') && ((*line > '9') || (*line < '0'))) (*line != '-') && (*line != '=') && ((*line > '9') || (*line < '0')))
{ {
*word = 0; *word = 0;
*linep = line; *linep = line;
return 1; return 1;
} }
if (ch == '"') string = 1; else string = 0; if (ch == '"') string = 1; else string = 0;
if (ch == '\'') if (ch == '\'')
{ {
if ((ch = *line++) != 0) if ((ch = *line++) != 0)
{ {
if (ch == '\\') if (ch == '\\')
{ {
line = SLexpand_escaped_char(line, &ch1); line = SLexpand_escaped_char(line, &ch1);
ch = ch1; ch = ch1;
@ -196,8 +196,8 @@ int SLang_extract_token (char **linep, char *word_parm, int byte_comp)
} }
else if (!special_chars[(unsigned char) ch]) else if (!special_chars[(unsigned char) ch])
{ {
while (ch = *line++, while (ch = *line++,
(ch > '"') || (ch > '"') ||
((ch != '\n') && (ch != 0) && (ch != '"'))) ((ch != '\n') && (ch != 0) && (ch != '"')))
{ {
if (string) if (string)
@ -207,7 +207,7 @@ int SLang_extract_token (char **linep, char *word_parm, int byte_comp)
ch = *line++; ch = *line++;
if ((ch == 0) || (ch == '\n')) break; if ((ch == 0) || (ch == '\n')) break;
if (byte_comp) *word++ = '\\'; if (byte_comp) *word++ = '\\';
else else
{ {
line = SLexpand_escaped_char(line - 1, &ch1); line = SLexpand_escaped_char(line - 1, &ch1);
ch = ch1; ch = ch1;
@ -219,7 +219,7 @@ int SLang_extract_token (char **linep, char *word_parm, int byte_comp)
line--; line--;
break; break;
} }
*word++ = ch; *word++ = ch;
if (word > word_max) if (word > word_max)
{ {
@ -228,7 +228,7 @@ int SLang_extract_token (char **linep, char *word_parm, int byte_comp)
} }
} }
} }
if ((!ch) || (ch == '\n')) line--; if ((!ch) || (ch == '\n')) line--;
if ((ch == '"') && string) *word++ = '"'; else if (string) SLang_Error = SYNTAX_ERROR; if ((ch == '"') && string) *word++ = '"'; else if (string) SLang_Error = SYNTAX_ERROR;
*word = 0; *word = 0;
@ -259,7 +259,7 @@ int SLang_guess_type (char *t)
if (*t == '-') t++; if (*t == '-') t++;
p = t; p = t;
#ifdef FLOAT_TYPE #ifdef FLOAT_TYPE
if (*p != '.') if (*p != '.')
{ {
#endif #endif
while ((*p >= '0') && (*p <= '9')) p++; while ((*p >= '0') && (*p <= '9')) p++;
@ -267,7 +267,7 @@ int SLang_guess_type (char *t)
if ((*p == 'x') && (p == t + 1)) /* 0x?? */ if ((*p == 'x') && (p == t + 1)) /* 0x?? */
{ {
p++; p++;
while (ch = *p, while (ch = *p,
((ch >= '0') && (ch <= '9')) ((ch >= '0') && (ch <= '9'))
|| (((ch | 0x20) >= 'a') && ((ch | 0x20) <= 'f'))) p++; || (((ch | 0x20) >= 'a') && ((ch | 0x20) <= 'f'))) p++;
} }
@ -276,7 +276,7 @@ int SLang_guess_type (char *t)
return(STRING_TYPE); return(STRING_TYPE);
#else #else
} }
/* now down to float case */ /* now down to float case */
if (*p == '.') if (*p == '.')
{ {
@ -297,24 +297,24 @@ int SLatoi (unsigned char *s)
register unsigned char ch; register unsigned char ch;
register unsigned int value; register unsigned int value;
register int base; register int base;
if (*s != '0') return atoi((char *) s); if (*s != '0') return atoi((char *) s);
/* look for 'x' which indicates hex */ /* look for 'x' which indicates hex */
s++; s++;
if ((*s | 0x20) == 'x') if ((*s | 0x20) == 'x')
{ {
base = 16; base = 16;
s++; s++;
if (*s == 0) if (*s == 0)
{ {
SLang_Error = SYNTAX_ERROR; SLang_Error = SYNTAX_ERROR;
return -1; return -1;
} }
} }
else base = 8; else base = 8;
value = 0; value = 0;
while ((ch = *s++) != 0) while ((ch = *s++) != 0)
{ {
@ -338,7 +338,7 @@ int SLatoi (unsigned char *s)
case '7': case '7':
ch1 -= '0'; ch1 -= '0';
break; break;
case 'a': case 'a':
case 'b': case 'b':
case 'c': case 'c':

View file

@ -1,7 +1,7 @@
/* slutty.c --- Unix Low level terminal (tty) functions for S-Lang */ /* slutty.c --- Unix Low level terminal (tty) functions for S-Lang */
/* Copyright (c) 1992, 1995 John E. Davis /* Copyright (c) 1992, 1995 John E. Davis
* All rights reserved. * All rights reserved.
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Perl Artistic License. * License or the Perl Artistic License.
*/ */
@ -104,27 +104,27 @@ typedef struct termios TTY_Termio_Type;
static TTY_Termio_Type Old_TTY; static TTY_Termio_Type Old_TTY;
#ifdef HAVE_TERMIOS_H #ifdef HAVE_TERMIOS_H
static struct static struct
{ {
speed_t key; speed_t key;
int value; int value;
} Baud_Rates[] = } Baud_Rates[] =
{ {
{B0, 0}, {B0, 0},
{B50, 50}, {B50, 50},
{B75, 75}, {B75, 75},
{B110, 110}, {B110, 110},
{B134, 134}, {B134, 134},
{B150, 150}, {B150, 150},
{B200, 200}, {B200, 200},
{B300, 300}, {B300, 300},
{B600, 600}, {B600, 600},
{B1200, 1200}, {B1200, 1200},
{B1800, 1800}, {B1800, 1800},
{B2400, 2400}, {B2400, 2400},
{B4800, 4800}, {B4800, 4800},
{B9600, 9600}, {B9600, 9600},
{B19200, 19200}, {B19200, 19200},
{B38400, 38400} {B38400, 38400}
#ifdef B57600 #ifdef B57600
, {B57600, 57600} , {B57600, 57600}
@ -175,7 +175,7 @@ static int
speed_t2baud_rate (speed_t s) speed_t2baud_rate (speed_t s)
{ {
int i; int i;
for (i = 0; i < sizeof (Baud_Rates)/sizeof (Baud_Rates[0]); i++) for (i = 0; i < sizeof (Baud_Rates)/sizeof (Baud_Rates[0]); i++)
if (Baud_Rates[i].key == s) if (Baud_Rates[i].key == s)
return (Baud_Rates[i].value); return (Baud_Rates[i].value);
@ -185,17 +185,17 @@ speed_t2baud_rate (speed_t s)
int SLang_init_tty (int abort_char, int no_flow_control, int opost) int SLang_init_tty (int abort_char, int no_flow_control, int opost)
{ {
TTY_Termio_Type newtty; TTY_Termio_Type newtty;
SLsig_block_signals (); SLsig_block_signals ();
if (TTY_Inited) if (TTY_Inited)
{ {
SLsig_unblock_signals (); SLsig_unblock_signals ();
return 0; return 0;
} }
TTY_Open = 0; TTY_Open = 0;
if ((SLang_TT_Read_FD == -1) if ((SLang_TT_Read_FD == -1)
|| (1 != isatty (SLang_TT_Read_FD))) || (1 != isatty (SLang_TT_Read_FD)))
{ {
@ -215,14 +215,14 @@ int SLang_init_tty (int abort_char, int no_flow_control, int opost)
#if 0 #if 0
/* In the Midnight Commander we bind stderr sometimes to a pipe. If we /* In the Midnight Commander we bind stderr sometimes to a pipe. If we
use stderr for terminal input and call SLang_getkey while stderr is use stderr for terminal input and call SLang_getkey while stderr is
bound to a pipe MC will hang completly in SLsys_input_pending. bound to a pipe MC will hang completly in SLsys_input_pending.
NOTE: There's an independent fix for this problem in src/slint.c for NOTE: There's an independent fix for this problem in src/slint.c for
the case that the Midnight Commander is linked against a shared slang the case that the Midnight Commander is linked against a shared slang
library compiled from different sources. library compiled from different sources.
*/ */
SLang_TT_Read_FD = fileno (stderr); SLang_TT_Read_FD = fileno (stderr);
if (1 != isatty (SLang_TT_Read_FD)) if (1 != isatty (SLang_TT_Read_FD))
#endif #endif
{ {
SLang_TT_Read_FD = fileno (stdin); SLang_TT_Read_FD = fileno (stdin);
if (1 != isatty (SLang_TT_Read_FD)) if (1 != isatty (SLang_TT_Read_FD))
@ -233,10 +233,10 @@ int SLang_init_tty (int abort_char, int no_flow_control, int opost)
} }
} }
} }
SLang_Abort_Char = abort_char; SLang_Abort_Char = abort_char;
/* Some systems may not permit signals to be blocked. As a result, the /* Some systems may not permit signals to be blocked. As a result, the
* return code must be checked. * return code must be checked.
*/ */
while (-1 == GET_TERMIOS(SLang_TT_Read_FD, &Old_TTY)) while (-1 == GET_TERMIOS(SLang_TT_Read_FD, &Old_TTY))
@ -247,7 +247,7 @@ int SLang_init_tty (int abort_char, int no_flow_control, int opost)
return -1; return -1;
} }
} }
while (-1 == GET_TERMIOS(SLang_TT_Read_FD, &newtty)) while (-1 == GET_TERMIOS(SLang_TT_Read_FD, &newtty))
{ {
if (errno != EINTR) if (errno != EINTR)
@ -256,7 +256,7 @@ int SLang_init_tty (int abort_char, int no_flow_control, int opost)
return -1; return -1;
} }
} }
#ifndef HAVE_TERMIOS_H #ifndef HAVE_TERMIOS_H
newtty.s.sg_flags &= ~(ECHO); newtty.s.sg_flags &= ~(ECHO);
newtty.s.sg_flags &= ~(CRMOD); newtty.s.sg_flags &= ~(CRMOD);
@ -270,9 +270,9 @@ int SLang_init_tty (int abort_char, int no_flow_control, int opost)
newtty.lt.t_lnextc = 255; newtty.lt.t_lnextc = 255;
newtty.s.sg_flags |= CBREAK; /* do I want cbreak or raw????? */ newtty.s.sg_flags |= CBREAK; /* do I want cbreak or raw????? */
#else #else
/* get baud rate */ /* get baud rate */
/* [not only QNX related !?!] /* [not only QNX related !?!]
* ECHO(0x08) is a c_lflag bit, it means here PARMRK(0x08) in c_iflag!!! * ECHO(0x08) is a c_lflag bit, it means here PARMRK(0x08) in c_iflag!!!
*/ */
@ -285,11 +285,11 @@ int SLang_init_tty (int abort_char, int no_flow_control, int opost)
if (SLang_TT_Baud_Rate == 0) if (SLang_TT_Baud_Rate == 0)
{ {
/* Note: if this generates an compiler error, simply remove /* Note: if this generates an compiler error, simply remove
the statement */ the statement */
#ifdef HAVE_CFGETOSPEED #ifdef HAVE_CFGETOSPEED
SLang_TT_Baud_Rate = cfgetospeed (&newtty); SLang_TT_Baud_Rate = cfgetospeed (&newtty);
#endif #endif
SLang_TT_Baud_Rate = speed_t2baud_rate (SLang_TT_Baud_Rate); SLang_TT_Baud_Rate = speed_t2baud_rate (SLang_TT_Baud_Rate);
} }
if (no_flow_control) newtty.c_iflag &= ~IXON; else newtty.c_iflag |= IXON; if (no_flow_control) newtty.c_iflag &= ~IXON; else newtty.c_iflag |= IXON;
@ -306,7 +306,7 @@ int SLang_init_tty (int abort_char, int no_flow_control, int opost)
newtty.c_cc[VSWTCH] = NULL_VALUE; /* to ignore who knows what */ newtty.c_cc[VSWTCH] = NULL_VALUE; /* to ignore who knows what */
#endif #endif
#endif /* NOT HAVE_TERMIOS_H */ #endif /* NOT HAVE_TERMIOS_H */
while (-1 == SET_TERMIOS(SLang_TT_Read_FD, &newtty)) while (-1 == SET_TERMIOS(SLang_TT_Read_FD, &newtty))
{ {
if (errno != EINTR) if (errno != EINTR)
@ -315,7 +315,7 @@ int SLang_init_tty (int abort_char, int no_flow_control, int opost)
return -1; return -1;
} }
} }
TTY_Inited = 1; TTY_Inited = 1;
SLsig_unblock_signals (); SLsig_unblock_signals ();
return 0; return 0;
@ -324,19 +324,19 @@ int SLang_init_tty (int abort_char, int no_flow_control, int opost)
void SLtty_set_suspend_state (int mode) void SLtty_set_suspend_state (int mode)
{ {
TTY_Termio_Type newtty; TTY_Termio_Type newtty;
SLsig_block_signals (); SLsig_block_signals ();
if (TTY_Inited == 0) if (TTY_Inited == 0)
{ {
SLsig_unblock_signals (); SLsig_unblock_signals ();
return; return;
} }
while ((-1 == GET_TERMIOS (SLang_TT_Read_FD, &newtty)) while ((-1 == GET_TERMIOS (SLang_TT_Read_FD, &newtty))
&& (errno == EINTR)) && (errno == EINTR))
; ;
#ifndef HAVE_TERMIOS_H #ifndef HAVE_TERMIOS_H
if (mode == 0) newtty.lt.t_suspc = 255; if (mode == 0) newtty.lt.t_suspc = 255;
else newtty.lt.t_suspc = Old_TTY.lt.t_suspc; else newtty.lt.t_suspc = Old_TTY.lt.t_suspc;
@ -344,7 +344,7 @@ void SLtty_set_suspend_state (int mode)
if (mode == 0) newtty.c_cc[VSUSP] = NULL_VALUE; if (mode == 0) newtty.c_cc[VSUSP] = NULL_VALUE;
else newtty.c_cc[VSUSP] = Old_TTY.c_cc[VSUSP]; else newtty.c_cc[VSUSP] = Old_TTY.c_cc[VSUSP];
#endif #endif
while ((-1 == SET_TERMIOS (SLang_TT_Read_FD, &newtty)) while ((-1 == SET_TERMIOS (SLang_TT_Read_FD, &newtty))
&& (errno == EINTR)) && (errno == EINTR))
; ;
@ -355,27 +355,27 @@ void SLtty_set_suspend_state (int mode)
void SLang_reset_tty (void) void SLang_reset_tty (void)
{ {
SLsig_block_signals (); SLsig_block_signals ();
if (TTY_Inited == 0) if (TTY_Inited == 0)
{ {
SLsig_unblock_signals (); SLsig_unblock_signals ();
return; return;
} }
while ((-1 == SET_TERMIOS(SLang_TT_Read_FD, &Old_TTY)) while ((-1 == SET_TERMIOS(SLang_TT_Read_FD, &Old_TTY))
&& (errno == EINTR)) && (errno == EINTR))
; ;
if (TTY_Open) if (TTY_Open)
{ {
while ((-1 == close (SLang_TT_Read_FD)) while ((-1 == close (SLang_TT_Read_FD))
&& (errno == EINTR)) && (errno == EINTR))
; ;
TTY_Open = 0; TTY_Open = 0;
SLang_TT_Read_FD = -1; SLang_TT_Read_FD = -1;
} }
TTY_Inited = 0; TTY_Inited = 0;
SLsig_unblock_signals (); SLsig_unblock_signals ();
} }
@ -383,7 +383,7 @@ void SLang_reset_tty (void)
static void default_sigint (int sig) static void default_sigint (int sig)
{ {
sig = errno; /* use parameter */ sig = errno; /* use parameter */
SLKeyBoard_Quit = 1; SLKeyBoard_Quit = 1;
if (SLang_Ignore_User_Abort == 0) SLang_Error = USER_BREAK; if (SLang_Ignore_User_Abort == 0) SLang_Error = USER_BREAK;
SLsignal_intr (SIGINT, default_sigint); SLsignal_intr (SIGINT, default_sigint);
@ -393,10 +393,10 @@ static void default_sigint (int sig)
void SLang_set_abort_signal (void (*hand)(int)) void SLang_set_abort_signal (void (*hand)(int))
{ {
int save_errno = errno; int save_errno = errno;
if (hand == NULL) hand = default_sigint; if (hand == NULL) hand = default_sigint;
SLsignal_intr (SIGINT, hand); SLsignal_intr (SIGINT, hand);
errno = save_errno; errno = save_errno;
} }
@ -418,7 +418,7 @@ int SLsys_input_pending(int tsecs)
long usecs, secs; long usecs, secs;
if (TTY_Inited == 0) return -1; if (TTY_Inited == 0) return -1;
if (tsecs >= 0) if (tsecs >= 0)
{ {
secs = tsecs / 10; secs = tsecs / 10;
@ -430,13 +430,13 @@ int SLsys_input_pending(int tsecs)
secs = tsecs / 1000; secs = tsecs / 1000;
usecs = (tsecs % 1000) * 1000; usecs = (tsecs % 1000) * 1000;
} }
wait.tv_sec = secs; wait.tv_sec = secs;
wait.tv_usec = usecs; wait.tv_usec = usecs;
FD_ZERO(&Read_FD_Set); FD_ZERO(&Read_FD_Set);
FD_SET(SLang_TT_Read_FD, &Read_FD_Set); FD_SET(SLang_TT_Read_FD, &Read_FD_Set);
return select(SLang_TT_Read_FD + 1, &Read_FD_Set, NULL, NULL, &wait); return select(SLang_TT_Read_FD + 1, &Read_FD_Set, NULL, NULL, &wait);
} }
@ -448,69 +448,69 @@ static int handle_interrupt (void)
if (SLang_getkey_intr_hook != NULL) if (SLang_getkey_intr_hook != NULL)
{ {
int save_tty_fd = SLang_TT_Read_FD; int save_tty_fd = SLang_TT_Read_FD;
if (-1 == (*SLang_getkey_intr_hook) ()) if (-1 == (*SLang_getkey_intr_hook) ())
return -1; return -1;
if (save_tty_fd != SLang_TT_Read_FD) if (save_tty_fd != SLang_TT_Read_FD)
return -1; return -1;
} }
return 0; return 0;
} }
unsigned int SLsys_getkey (void) unsigned int SLsys_getkey (void)
{ {
unsigned char c; unsigned char c;
if (TTY_Inited == 0) if (TTY_Inited == 0)
{ {
int ic = fgetc (stdin); int ic = fgetc (stdin);
if (ic == EOF) return SLANG_GETKEY_ERROR; if (ic == EOF) return SLANG_GETKEY_ERROR;
return (unsigned int) ic; return (unsigned int) ic;
} }
while (1) while (1)
{ {
int ret; int ret;
if (SLKeyBoard_Quit) if (SLKeyBoard_Quit)
return SLang_Abort_Char; return SLang_Abort_Char;
if (0 == (ret = SLsys_input_pending (100))) if (0 == (ret = SLsys_input_pending (100)))
continue; continue;
if (ret != -1) if (ret != -1)
break; break;
if (SLKeyBoard_Quit) if (SLKeyBoard_Quit)
return SLang_Abort_Char; return SLang_Abort_Char;
if (errno == EINTR) if (errno == EINTR)
{ {
if (-1 == handle_interrupt ()) if (-1 == handle_interrupt ())
return SLANG_GETKEY_ERROR; return SLANG_GETKEY_ERROR;
continue; continue;
} }
break; /* let read handle it */ break; /* let read handle it */
} }
while (-1 == read(SLang_TT_Read_FD, (char *) &c, 1)) while (-1 == read(SLang_TT_Read_FD, (char *) &c, 1))
{ {
if (errno == EINTR) if (errno == EINTR)
{ {
if (-1 == handle_interrupt ()) if (-1 == handle_interrupt ())
return SLANG_GETKEY_ERROR; return SLANG_GETKEY_ERROR;
if (SLKeyBoard_Quit) if (SLKeyBoard_Quit)
return SLang_Abort_Char; return SLang_Abort_Char;
continue; continue;
} }
#ifdef EAGAIN #ifdef EAGAIN
if (errno == EAGAIN) if (errno == EAGAIN)
{ {
sleep (1); sleep (1);
continue; continue;

View file

@ -1,6 +1,6 @@
/* Copyright (c) 1992, 1995 John E. Davis /* Copyright (c) 1992, 1995 John E. Davis
* All rights reserved. * All rights reserved.
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Perl Artistic License. * License or the Perl Artistic License.
*/ */
@ -85,7 +85,7 @@ static int Blink_Killed; /* high intensity background enabled */
#define JNORMAL_COLOR 0 #define JNORMAL_COLOR 0
#define JNO_COLOR -1 #define JNO_COLOR -1
static unsigned char Color_Map [JMAX_COLORS] = static unsigned char Color_Map [JMAX_COLORS] =
{ {
0x7, 0x70, 0x70, 0x70, 0x70, 0x7, 0x7, 0x7, 0x7, 0x70, 0x70, 0x70, 0x70, 0x7, 0x7, 0x7,
0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7,
@ -210,24 +210,24 @@ static int Saved_Cursor_Row;
static void save_screen (void) static void save_screen (void)
{ {
int row, col; int row, col;
if (Saved_Screen_Buffer != NULL) if (Saved_Screen_Buffer != NULL)
{ {
SLFREE (Saved_Screen_Buffer); SLFREE (Saved_Screen_Buffer);
Saved_Screen_Buffer = NULL; Saved_Screen_Buffer = NULL;
} }
#ifdef GO32_VIDEO #ifdef GO32_VIDEO
Saved_Screen_Buffer = SLMALLOC (sizeof (short) * Saved_Screen_Buffer = SLMALLOC (sizeof (short) *
ScreenCols () * ScreenRows ()); ScreenCols () * ScreenRows ());
if (Saved_Screen_Buffer == NULL) if (Saved_Screen_Buffer == NULL)
return; return;
ScreenRetrieve (Saved_Screen_Buffer); ScreenRetrieve (Saved_Screen_Buffer);
ScreenGetCursor (&row, &col); ScreenGetCursor (&row, &col);
Saved_Cursor_Row = row; Saved_Cursor_Row = row;
#endif #endif
} }
static void restore_screen (void) static void restore_screen (void)
@ -237,7 +237,7 @@ static void restore_screen (void)
ScreenUpdate (Saved_Screen_Buffer); ScreenUpdate (Saved_Screen_Buffer);
SLtt_goto_rc (Saved_Cursor_Row, 0); SLtt_goto_rc (Saved_Cursor_Row, 0);
#endif #endif
} }
#endif /* HAS_SAVE_SCREEN */ #endif /* HAS_SAVE_SCREEN */
/*----------------------------------------------------------------------*\ /*----------------------------------------------------------------------*\
@ -249,7 +249,7 @@ void SLtt_write_string (char *str)
{ {
#ifdef WIN32 #ifdef WIN32
unsigned long bytes; unsigned long bytes;
(void) WriteConsole(hStdout, str, strlen(str), &bytes, NULL); (void) WriteConsole(hStdout, str, strlen(str), &bytes, NULL);
#else #else
fputs (str, stdout); fputs (str, stdout);
@ -292,7 +292,7 @@ void SLtt_goto_rc (int row, int col)
newPosition.X = col; newPosition.X = col;
newPosition.Y = row; newPosition.Y = row;
#endif #endif
#if !defined (USE_ASM) #if !defined (USE_ASM)
if (row > SLtt_Screen_Rows) row = SLtt_Screen_Rows; if (row > SLtt_Screen_Rows) row = SLtt_Screen_Rows;
if (col > SLtt_Screen_Cols) col = SLtt_Screen_Cols; if (col > SLtt_Screen_Cols) col = SLtt_Screen_Cols;
@ -398,10 +398,10 @@ static void slvid_deleol (int x)
unsigned char *p, *pmax; unsigned char *p, *pmax;
int w = mkSpaceChar (); int w = mkSpaceChar ();
int count = SLtt_Screen_Cols - x; int count = SLtt_Screen_Cols - x;
p = Line_Buffer; p = Line_Buffer;
pmax = p + 2 * count; pmax = p + 2 * count;
while (p < pmax) while (p < pmax)
{ {
*p++ = (unsigned char) w; *p++ = (unsigned char) w;
@ -430,7 +430,7 @@ void SLtt_begin_insert (void)
slvid_getxy (); slvid_getxy ();
n = SLtt_Screen_Cols - Cursor_Col; n = SLtt_Screen_Cols - Cursor_Col;
/* Msdos_Insert_Mode = 1; */ /* Msdos_Insert_Mode = 1; */
# ifndef WIN32 # ifndef WIN32
# if defined (EMX_VIDEO) # if defined (EMX_VIDEO)
v_getline (Line_Buffer, Cursor_Col, Cursor_Row, n); v_getline (Line_Buffer, Cursor_Col, Cursor_Row, n);
@ -442,7 +442,7 @@ void SLtt_begin_insert (void)
VioWrtCellStr ((PCH)Line_Buffer, n, Cursor_Row, Cursor_Col + 1, 0); VioWrtCellStr ((PCH)Line_Buffer, n, Cursor_Row, Cursor_Col + 1, 0);
# else /* __os2__ */ # else /* __os2__ */
p = mkScreenPointer (Cursor_Row, SLtt_Screen_Cols - 1); p = mkScreenPointer (Cursor_Row, SLtt_Screen_Cols - 1);
# if defined (HAS_LINEAR_SCREEN) # if defined (HAS_LINEAR_SCREEN)
/* pmin = p - (n-1); */ /* pmin = p - (n-1); */
pmin = mkScreenPointer (Cursor_Row, Cursor_Col); pmin = mkScreenPointer (Cursor_Row, Cursor_Col);
@ -452,23 +452,23 @@ void SLtt_begin_insert (void)
asm mov ax, ds asm mov ax, ds
asm mov bx, di asm mov bx, di
asm mov dx, si asm mov dx, si
asm mov cx, n asm mov cx, n
asm les di, p asm les di, p
asm lds si, p asm lds si, p
asm sub si, 2 asm sub si, 2
asm std asm std
asm rep movsw asm rep movsw
asm mov ds, ax asm mov ds, ax
asm mov di, bx asm mov di, bx
asm mov si, dx asm mov si, dx
# endif /* HAS_LINEAR_SCREEN */ # endif /* HAS_LINEAR_SCREEN */
# endif /* __os2__ */ # endif /* __os2__ */
# endif /* EMX_VIDEO */ # endif /* EMX_VIDEO */
# endif /* WIN32 */ # endif /* WIN32 */
#endif /* not GO32_VIDEO */ #endif /* not GO32_VIDEO */
} }
@ -497,12 +497,12 @@ void SLtt_delete_char (void)
# endif # endif
# endif # endif
int n; int n;
slvid_getxy (); slvid_getxy ();
n = SLtt_Screen_Cols - Cursor_Col - 1; n = SLtt_Screen_Cols - Cursor_Col - 1;
# ifndef WIN32 # ifndef WIN32
# if defined (EMX_VIDEO) # if defined (EMX_VIDEO)
v_getline (Line_Buffer, Cursor_Col+1, Cursor_Row, n); v_getline (Line_Buffer, Cursor_Col+1, Cursor_Row, n);
v_putline (Line_Buffer, Cursor_Col, Cursor_Row, n); v_putline (Line_Buffer, Cursor_Col, Cursor_Row, n);
@ -514,7 +514,7 @@ void SLtt_delete_char (void)
return; return;
# else /* __os2__ */ # else /* __os2__ */
p = mkScreenPointer (Cursor_Row, Cursor_Col); p = mkScreenPointer (Cursor_Row, Cursor_Col);
# if defined (HAS_LINEAR_SCREEN) # if defined (HAS_LINEAR_SCREEN)
while (n--) while (n--)
{ {
@ -527,23 +527,23 @@ void SLtt_delete_char (void)
asm mov ax, ds asm mov ax, ds
asm mov bx, si asm mov bx, si
asm mov dx, di asm mov dx, di
asm mov cx, n asm mov cx, n
asm les di, p asm les di, p
asm lds si, p asm lds si, p
asm add si, 2 asm add si, 2
asm cld asm cld
asm rep movsw asm rep movsw
asm mov ds, ax asm mov ds, ax
asm mov si, bx asm mov si, bx
asm mov di, dx asm mov di, dx
# endif /* HAS_LINEAR_SCREEN */ # endif /* HAS_LINEAR_SCREEN */
# endif /* __os2__ */ # endif /* __os2__ */
# endif /* EMX_VIDEO */ # endif /* EMX_VIDEO */
# endif /* WIN32 */ # endif /* WIN32 */
#endif /* not GO32_VIDEO */ #endif /* not GO32_VIDEO */
} }
@ -555,9 +555,9 @@ void SLtt_delete_char (void)
\*----------------------------------------------------------------------*/ \*----------------------------------------------------------------------*/
void SLtt_erase_line (void) void SLtt_erase_line (void)
{ {
#ifndef WIN32 #ifndef WIN32
# if defined (GO32_VIDEO) || defined (EMX_VIDEO) # if defined (GO32_VIDEO) || defined (EMX_VIDEO)
Attribute_Byte = 0x07; Attribute_Byte = 0x07;
slvid_deleol (0); slvid_deleol (0);
@ -572,7 +572,7 @@ void SLtt_erase_line (void)
unsigned short *p = mkScreenPointer (Cursor_Row, 0); unsigned short *p = mkScreenPointer (Cursor_Row, 0);
# if defined (HAS_LINEAR_SCREEN) # if defined (HAS_LINEAR_SCREEN)
register unsigned short *pmax = p + SLtt_Screen_Cols; register unsigned short *pmax = p + SLtt_Screen_Cols;
Attribute_Byte = 0x07; Attribute_Byte = 0x07;
w = mkSpaceChar (); w = mkSpaceChar ();
while (p < pmax) *p++ = w; while (p < pmax) *p++ = w;
@ -591,9 +591,9 @@ void SLtt_erase_line (void)
# endif /* __os2__ */ # endif /* __os2__ */
# endif /* GO32_VIDEO or EMX_VIDEO */ # endif /* GO32_VIDEO or EMX_VIDEO */
Current_Color = JNO_COLOR; /* since we messed with attribute byte */ Current_Color = JNO_COLOR; /* since we messed with attribute byte */
#endif /* WIN32 */ #endif /* WIN32 */
} }
/*----------------------------------------------------------------------*\ /*----------------------------------------------------------------------*\
@ -604,9 +604,9 @@ void SLtt_erase_line (void)
void SLtt_delete_nlines (int nlines) void SLtt_delete_nlines (int nlines)
{ {
SLtt_normal_video (); SLtt_normal_video ();
#ifndef WIN32 #ifndef WIN32
# if defined (EMX_VIDEO) # if defined (EMX_VIDEO)
v_attrib (Attribute_Byte); v_attrib (Attribute_Byte);
v_scroll (0, Scroll_r1, SLtt_Screen_Cols-1, Scroll_r2, nlines, V_SCROLL_UP); v_scroll (0, Scroll_r1, SLtt_Screen_Cols-1, Scroll_r2, nlines, V_SCROLL_UP);
@ -649,9 +649,9 @@ void SLtt_delete_nlines (int nlines)
# endif /* USE_ASM */ # endif /* USE_ASM */
# endif /* __os2__ */ # endif /* __os2__ */
# endif /* EMX_VIDEO */ # endif /* EMX_VIDEO */
#endif /* WIN32 */ #endif /* WIN32 */
} }
/*----------------------------------------------------------------------*\ /*----------------------------------------------------------------------*\
@ -662,9 +662,9 @@ void SLtt_delete_nlines (int nlines)
void SLtt_reverse_index (int nlines) void SLtt_reverse_index (int nlines)
{ {
SLtt_normal_video (); SLtt_normal_video ();
#ifndef WIN32 #ifndef WIN32
# if defined (EMX_VIDEO) # if defined (EMX_VIDEO)
v_attrib (Attribute_Byte); v_attrib (Attribute_Byte);
v_scroll (0, Scroll_r1, SLtt_Screen_Cols-1, Scroll_r2, nlines, v_scroll (0, Scroll_r1, SLtt_Screen_Cols-1, Scroll_r2, nlines,
@ -706,9 +706,9 @@ void SLtt_reverse_index (int nlines)
# endif /* USE_ASM */ # endif /* USE_ASM */
# endif /* __os2__ */ # endif /* __os2__ */
# endif /* EMX_VIDEO */ # endif /* EMX_VIDEO */
#endif /* WIN32 */ #endif /* WIN32 */
} }
/*----------------------------------------------------------------------*\ /*----------------------------------------------------------------------*\
@ -718,12 +718,12 @@ void SLtt_reverse_index (int nlines)
\*----------------------------------------------------------------------*/ \*----------------------------------------------------------------------*/
static void slvid_invert_region (int top_row, int bot_row) static void slvid_invert_region (int top_row, int bot_row)
{ {
#ifndef WIN32 #ifndef WIN32
# if defined (EMX_VIDEO) # if defined (EMX_VIDEO)
int row, col; int row, col;
for (row = top_row; row < bot_row; row++) for (row = top_row; row < bot_row; row++)
{ {
v_getline (Line_Buffer, 0, row, SLtt_Screen_Cols); v_getline (Line_Buffer, 0, row, SLtt_Screen_Cols);
@ -735,7 +735,7 @@ static void slvid_invert_region (int top_row, int bot_row)
# ifdef __os2__ # ifdef __os2__
int row, col; int row, col;
USHORT length = SLtt_Screen_Cols * 2; USHORT length = SLtt_Screen_Cols * 2;
for (row = top_row; row < bot_row; row++) for (row = top_row; row < bot_row; row++)
{ {
VioReadCellStr ((PCH)Line_Buffer, &length, row, 0, 0); VioReadCellStr ((PCH)Line_Buffer, &length, row, 0, 0);
@ -747,7 +747,7 @@ static void slvid_invert_region (int top_row, int bot_row)
# if defined (__GO32__) || defined (__WATCOMC__) # if defined (__GO32__) || defined (__WATCOMC__)
unsigned char buf [2 * 180 * 80]; /* 180 cols x 80 rows */ unsigned char buf [2 * 180 * 80]; /* 180 cols x 80 rows */
unsigned char *b, *bmax; unsigned char *b, *bmax;
b = buf + 1 + 2 * SLtt_Screen_Cols * top_row; b = buf + 1 + 2 * SLtt_Screen_Cols * top_row;
bmax = buf + 1 + 2 * SLtt_Screen_Cols * bot_row; bmax = buf + 1 + 2 * SLtt_Screen_Cols * bot_row;
ScreenRetrieve (buf); ScreenRetrieve (buf);
@ -761,7 +761,7 @@ static void slvid_invert_region (int top_row, int bot_row)
register unsigned short ch, sh; register unsigned short ch, sh;
register unsigned short *pmin = mkScreenPointer (top_row, 0); register unsigned short *pmin = mkScreenPointer (top_row, 0);
register unsigned short *pmax = mkScreenPointer (bot_row, 0); register unsigned short *pmax = mkScreenPointer (bot_row, 0);
while (pmin < pmax) while (pmin < pmax)
{ {
sh = *pmin; sh = *pmin;
@ -773,9 +773,9 @@ static void slvid_invert_region (int top_row, int bot_row)
# endif /* __GO32__ or __WATCOMC__ */ # endif /* __GO32__ or __WATCOMC__ */
# endif /* __os2__ */ # endif /* __os2__ */
# endif /* EMX_VIDEO */ # endif /* EMX_VIDEO */
#endif /* WIN32 */ #endif /* WIN32 */
} }
/*----------------------------------------------------------------------*\ /*----------------------------------------------------------------------*\
@ -800,7 +800,7 @@ void SLtt_beep (void)
int special = 0; /* first row to invert */ int special = 0; /* first row to invert */
int visual = 0; /* final row to invert */ int visual = 0; /* final row to invert */
if (!SLtt_Ignore_Beep) return; if (!SLtt_Ignore_Beep) return;
audible = (SLtt_Ignore_Beep & 1); audible = (SLtt_Ignore_Beep & 1);
if ( (SLtt_Ignore_Beep & 4) ) if ( (SLtt_Ignore_Beep & 4) )
{ {
@ -811,16 +811,16 @@ void SLtt_beep (void)
{ {
visual = SLtt_Screen_Rows; visual = SLtt_Screen_Rows;
} }
if (visual) slvid_invert_region (special, visual); if (visual) slvid_invert_region (special, visual);
#if defined (EMX_VIDEO) #if defined (EMX_VIDEO)
if (audible) /*sound (1500)*/; _sleep2 (100); if (audible) /* nosound () */; if (audible) /*sound (1500)*/; _sleep2 (100); if (audible) /* nosound () */;
#else #else
# ifdef __os2__ # ifdef __os2__
if (audible) DosBeep (1500, 100); else DosSleep (100); if (audible) DosBeep (1500, 100); else DosSleep (100);
# elif defined(WIN32) # elif defined(WIN32)
# else # else
if (audible) sound (1500); delay (100); if (audible) nosound (); if (audible) sound (1500); delay (100); if (audible) nosound ();
# endif # endif
@ -835,9 +835,9 @@ void SLtt_beep (void)
\*----------------------------------------------------------------------*/ \*----------------------------------------------------------------------*/
void SLtt_del_eol (void) void SLtt_del_eol (void)
{ {
#ifndef WIN32 #ifndef WIN32
# if defined (GO32_VIDEO) || defined (EMX_VIDEO) # if defined (GO32_VIDEO) || defined (EMX_VIDEO)
if (Current_Color != JNO_COLOR) SLtt_normal_video (); if (Current_Color != JNO_COLOR) SLtt_normal_video ();
slvid_deleol (Cursor_Col); slvid_deleol (Cursor_Col);
@ -854,7 +854,7 @@ void SLtt_del_eol (void)
unsigned short w; unsigned short w;
# if defined (HAS_LINEAR_SCREEN) # if defined (HAS_LINEAR_SCREEN)
unsigned short *pmax = p + n; unsigned short *pmax = p + n;
if (Current_Color != JNO_COLOR) SLtt_normal_video (); if (Current_Color != JNO_COLOR) SLtt_normal_video ();
w = mkSpaceChar (); w = mkSpaceChar ();
while (p < pmax) *p++ = w; while (p < pmax) *p++ = w;
@ -868,14 +868,14 @@ void SLtt_del_eol (void)
asm mov cx, n asm mov cx, n
asm cld asm cld
asm rep stosw asm rep stosw
asm mov di, dx asm mov di, dx
# endif /* HAS_LINEAR_SCREEN */ # endif /* HAS_LINEAR_SCREEN */
# endif /* __os2__ */ # endif /* __os2__ */
# endif /* GO32_VIDEO or EMX_VIDEO */ # endif /* GO32_VIDEO or EMX_VIDEO */
#endif /* WIN32 */ #endif /* WIN32 */
} }
/*----------------------------------------------------------------------*\ /*----------------------------------------------------------------------*\
@ -918,57 +918,57 @@ static unsigned short *video_write (register unsigned char *pp,
register unsigned short *pos) register unsigned short *pos)
{ {
int n = (int) (p - pp); /* num of characters of PP to write */ int n = (int) (p - pp); /* num of characters of PP to write */
asm push si asm push si
asm push ds asm push ds
asm push di asm push di
/* set up register for BOTH fast and slow */ /* set up register for BOTH fast and slow */
asm mov bx, SLtt_Msdos_Cheap_Video asm mov bx, SLtt_Msdos_Cheap_Video
/* These are the registers needed for both fast AND slow */ /* These are the registers needed for both fast AND slow */
asm mov ah, byte ptr Attribute_Byte asm mov ah, byte ptr Attribute_Byte
asm mov cx, n asm mov cx, n
asm lds si, dword ptr pp asm lds si, dword ptr pp
asm les di, dword ptr pos asm les di, dword ptr pos
asm cld asm cld
asm cmp bx, 0 /* cheap video test */ asm cmp bx, 0 /* cheap video test */
asm je L_fast asm je L_fast
asm mov bx, ax asm mov bx, ax
asm mov dx, CGA_STATUS asm mov dx, CGA_STATUS
asm jg L_slow_blank asm jg L_slow_blank
/* slow video */ /* slow video */
asm cli asm cli
/* wait for retrace */ /* wait for retrace */
L_slow: L_slow:
asm in al, dx asm in al, dx
asm test al, 1 asm test al, 1
asm jnz L_slow asm jnz L_slow
L_slow1: L_slow1:
asm in al, dx asm in al, dx
asm test al, 1 asm test al, 1
asm jz L_slow1 asm jz L_slow1
/* move a character out */ /* move a character out */
asm mov ah, bh asm mov ah, bh
asm lodsb asm lodsb
asm stosw asm stosw
asm loop L_slow asm loop L_slow
asm sti asm sti
asm jmp done asm jmp done
/* -------------- slow video, vertical retace and pump --------------*/ /* -------------- slow video, vertical retace and pump --------------*/
L_slow_blank: L_slow_blank:
L_slow_blank_loop: L_slow_blank_loop:
asm in al, dx asm in al, dx
asm test al, 8 asm test al, 8
asm jnz L_slow_blank_loop asm jnz L_slow_blank_loop
L_slow_blank1: L_slow_blank1:
asm in al, dx asm in al, dx
asm test al, 8 asm test al, 8
@ -979,10 +979,10 @@ static unsigned short *video_write (register unsigned char *pp,
asm lodsb asm lodsb
asm stosw asm stosw
asm loop L_slow_blank2 asm loop L_slow_blank2
asm jmp done asm jmp done
/*-------------- Fast video --------------*/ /*-------------- Fast video --------------*/
L_fast: L_fast:
asm lodsb asm lodsb
asm stosw asm stosw
@ -1026,7 +1026,7 @@ static void write_attributes (unsigned short *src, int count)
register unsigned short *pos = mkScreenPointer (Cursor_Row, 0); register unsigned short *pos = mkScreenPointer (Cursor_Row, 0);
# endif # endif
int n = count; int n = count;
/* write into a character/attribute pair */ /* write into a character/attribute pair */
while (n-- > 0) while (n-- > 0)
{ {
@ -1044,7 +1044,7 @@ static void write_attributes (unsigned short *src, int count)
# endif # endif
# endif # endif
} }
# if !defined (HAS_LINEAR_SCREEN) # if !defined (HAS_LINEAR_SCREEN)
# if defined (EMX_VIDEO) # if defined (EMX_VIDEO)
v_putline (Line_Buffer, Cursor_Col, Cursor_Row, count); v_putline (Line_Buffer, Cursor_Col, Cursor_Row, count);
@ -1058,12 +1058,12 @@ static void write_attributes (unsigned short *src, int count)
coord.X = Cursor_Col; coord.X = Cursor_Col;
coord.Y = Cursor_Row; coord.Y = Cursor_Row;
WriteConsoleOutputCharacter(hStdout, p, count, coord, &bytes); WriteConsoleOutputCharacter(hStdout, p, count, coord, &bytes);
/* write color attributes */ /* write color attributes */
p = Line_Buffer; p = Line_Buffer;
n = count; n = count;
src = (unsigned short*)org_src; /* restart the src pointer */ src = (unsigned short*)org_src; /* restart the src pointer */
/* write into attributes only */ /* write into attributes only */
while (n-- > 0) while (n-- > 0)
{ {
@ -1072,7 +1072,7 @@ static void write_attributes (unsigned short *src, int count)
*(p++) = Attribute_Byte; /* attribute byte */ *(p++) = Attribute_Byte; /* attribute byte */
*(p++) = 0; /* what's this for? */ *(p++) = 0; /* what's this for? */
} }
WriteConsoleOutputAttribute(hStdout, (WORD*)Line_Buffer, count, coord, &bytes); WriteConsoleOutputAttribute(hStdout, (WORD*)Line_Buffer, count, coord, &bytes);
# else /* __os2__ */ # else /* __os2__ */
/* ScreenUpdateLine (void *virtual_screen_line, int row); */ /* ScreenUpdateLine (void *virtual_screen_line, int row); */
@ -1089,7 +1089,7 @@ static void write_attributes (unsigned short *src, int count)
#else /* not USE_ASM */ #else /* not USE_ASM */
unsigned char ch, color; unsigned char ch, color;
register unsigned short *pos = mkScreenPointer (Cursor_Row, 0); register unsigned short *pos = mkScreenPointer (Cursor_Row, 0);
while (count--) while (count--)
{ {
pair = *(src++); /* character/color pair */ pair = *(src++); /* character/color pair */
@ -1181,15 +1181,15 @@ void SLtt_cls (void)
/* clear the WIN32 screen in one shot */ /* clear the WIN32 screen in one shot */
coord.X = 0; coord.X = 0;
coord.Y = 0; coord.Y = 0;
ch = ' '; ch = ' ';
(void) FillConsoleOutputCharacter(hStdout, (void) FillConsoleOutputCharacter(hStdout,
ch, ch,
csbiInfo.dwMaximumWindowSize.Y * csbiInfo.dwMaximumWindowSize.X, csbiInfo.dwMaximumWindowSize.Y * csbiInfo.dwMaximumWindowSize.X,
coord, coord,
&bytes); &bytes);
/* now set screen to the current attribute */ /* now set screen to the current attribute */
ch = Attribute_Byte; ch = Attribute_Byte;
(void) FillConsoleOutputAttribute(hStdout, (void) FillConsoleOutputAttribute(hStdout,
@ -1227,7 +1227,7 @@ void SLtt_putchar (char ch)
long bytes; long bytes;
# endif # endif
#endif #endif
if (Current_Color) SLtt_normal_video (); if (Current_Color) SLtt_normal_video ();
slvid_getxy (); /* get current position */ slvid_getxy (); /* get current position */
switch (ch) switch (ch)
@ -1253,7 +1253,7 @@ void SLtt_putchar (char ch)
# else /* GO32_VIDEO */ # else /* GO32_VIDEO */
pp = mkScreenPointer (Cursor_Row, Cursor_Col); pp = mkScreenPointer (Cursor_Row, Cursor_Col);
p = (Attribute_Byte << 8) | (unsigned char) ch; p = (Attribute_Byte << 8) | (unsigned char) ch;
# ifdef USE_ASM # ifdef USE_ASM
SNOW_CHECK; SNOW_CHECK;
# endif # endif
@ -1280,12 +1280,12 @@ void SLtt_set_color (int obj, char *what, char *fg, char *bg)
#ifdef WIN32 #ifdef WIN32
int newcolor; int newcolor;
#endif #endif
(void) what; (void) what;
if ( !IsColor || (obj < 0) || (obj >= JMAX_COLORS)) if ( !IsColor || (obj < 0) || (obj >= JMAX_COLORS))
return; return;
for (i = 0; i < JMAX_COLOR_NAMES; i++ ) for (i = 0; i < JMAX_COLOR_NAMES; i++ )
{ {
if (!strcmp (fg, Color_Names [i])) if (!strcmp (fg, Color_Names [i]))
@ -1294,7 +1294,7 @@ void SLtt_set_color (int obj, char *what, char *fg, char *bg)
break; break;
} }
} }
for (i = 0; i < JMAX_COLOR_NAMES; i++) for (i = 0; i < JMAX_COLOR_NAMES; i++)
{ {
if (!strcmp (bg, Color_Names [i])) if (!strcmp (bg, Color_Names [i]))
@ -1307,7 +1307,7 @@ void SLtt_set_color (int obj, char *what, char *fg, char *bg)
#if 1 #if 1
Color_Map [obj] = (b << 4) | f; Color_Map [obj] = (b << 4) | f;
#else #else
/* /*
0 1 2 3 0 1 2 3
"black", "blue", "green", "cyan", "black", "blue", "green", "cyan",
@ -1318,32 +1318,32 @@ void SLtt_set_color (int obj, char *what, char *fg, char *bg)
12 13 14 15 12 13 14 15
"brightred", "brightmagenta", "yellow", "white" "brightred", "brightmagenta", "yellow", "white"
*/ */
/* these aren't all right yet */ /* these aren't all right yet */
switch (f) switch (f)
{ {
case 0: newcolor = 0; break; case 0: newcolor = 0; break;
case 1: newcolor = FOREGROUND_BLUE; break; case 1: newcolor = FOREGROUND_BLUE; break;
case 2: newcolor = FOREGROUND_GREEN; break; case 2: newcolor = FOREGROUND_GREEN; break;
case 3: newcolor = FOREGROUND_GREEN | FOREGROUND_BLUE; break; case 3: newcolor = FOREGROUND_GREEN | FOREGROUND_BLUE; break;
case 4: newcolor = FOREGROUND_RED; break; case 4: newcolor = FOREGROUND_RED; break;
case 5: newcolor = FOREGROUND_RED | FOREGROUND_BLUE; break; case 5: newcolor = FOREGROUND_RED | FOREGROUND_BLUE; break;
case 6: newcolor = FOREGROUND_GREEN | FOREGROUND_RED; break; case 6: newcolor = FOREGROUND_GREEN | FOREGROUND_RED; break;
case 7: newcolor = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY; break; case 7: newcolor = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY; break;
case 8: newcolor = FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN; break; case 8: newcolor = FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN; break;
case 9: newcolor = FOREGROUND_BLUE | FOREGROUND_INTENSITY; break; case 9: newcolor = FOREGROUND_BLUE | FOREGROUND_INTENSITY; break;
case 10: newcolor = FOREGROUND_GREEN | FOREGROUND_INTENSITY; break; case 10: newcolor = FOREGROUND_GREEN | FOREGROUND_INTENSITY; break;
case 11: newcolor = FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY; break; case 11: newcolor = FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY; break;
case 12: newcolor = FOREGROUND_RED | FOREGROUND_INTENSITY; break; case 12: newcolor = FOREGROUND_RED | FOREGROUND_INTENSITY; break;
case 13: newcolor = FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY; break; case 13: newcolor = FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY; break;
case 14: newcolor = FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY; break; case 14: newcolor = FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY; break;
case 15: newcolor = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY; break; case 15: newcolor = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY; break;
} }
// switch // switch
/* /*
0 1 2 3 0 1 2 3
"black", "blue", "green", "cyan", "black", "blue", "green", "cyan",
@ -1354,37 +1354,37 @@ void SLtt_set_color (int obj, char *what, char *fg, char *bg)
12 13 14 15 12 13 14 15
"brightred", "brightmagenta", "yellow", "white" "brightred", "brightmagenta", "yellow", "white"
*/ */
switch (b) switch (b)
{ {
case 0: newcolor |= 0; break; case 0: newcolor |= 0; break;
case 1: newcolor |= BACKGROUND_BLUE; break; case 1: newcolor |= BACKGROUND_BLUE; break;
case 2: newcolor |= BACKGROUND_GREEN; break; case 2: newcolor |= BACKGROUND_GREEN; break;
case 3: newcolor |= BACKGROUND_GREEN | BACKGROUND_BLUE; break; case 3: newcolor |= BACKGROUND_GREEN | BACKGROUND_BLUE; break;
case 4: newcolor |= BACKGROUND_RED; break; case 4: newcolor |= BACKGROUND_RED; break;
case 5: newcolor |= BACKGROUND_RED | BACKGROUND_BLUE; break; case 5: newcolor |= BACKGROUND_RED | BACKGROUND_BLUE; break;
case 6: newcolor |= BACKGROUND_GREEN | BACKGROUND_RED; break; case 6: newcolor |= BACKGROUND_GREEN | BACKGROUND_RED; break;
case 7: newcolor |= BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY; break; case 7: newcolor |= BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY; break;
case 8: newcolor |= BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE; break; case 8: newcolor |= BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE; break;
case 9: newcolor |= BACKGROUND_BLUE | BACKGROUND_INTENSITY; break; case 9: newcolor |= BACKGROUND_BLUE | BACKGROUND_INTENSITY; break;
case 10: newcolor |= BACKGROUND_GREEN | BACKGROUND_INTENSITY; break; case 10: newcolor |= BACKGROUND_GREEN | BACKGROUND_INTENSITY; break;
case 11: newcolor |= BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY; break; case 11: newcolor |= BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY; break;
case 12: newcolor |= BACKGROUND_RED | BACKGROUND_INTENSITY; break; case 12: newcolor |= BACKGROUND_RED | BACKGROUND_INTENSITY; break;
case 13: newcolor |= BACKGROUND_RED | BACKGROUND_BLUE | BACKGROUND_INTENSITY; break; case 13: newcolor |= BACKGROUND_RED | BACKGROUND_BLUE | BACKGROUND_INTENSITY; break;
case 14: newcolor |= BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY; break; case 14: newcolor |= BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY; break;
case 15: newcolor |= BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY; break; case 15: newcolor |= BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY; break;
} }
// switch // switch
Color_Map [obj] = newcolor; Color_Map [obj] = newcolor;
#endif #endif
/* if we're setting the normal color, and the attribute byte hasn't /* if we're setting the normal color, and the attribute byte hasn't
been set yet, set it to the new color */ been set yet, set it to the new color */
if ((obj == 0) && (Attribute_Byte == 0)) if ((obj == 0) && (Attribute_Byte == 0))
SLtt_reverse_video (0); SLtt_reverse_video (0);
} }
@ -1411,15 +1411,15 @@ void SLtt_init_video (void)
#if defined (EMX_VIDEO) #if defined (EMX_VIDEO)
int OldCol, OldRow; int OldCol, OldRow;
#endif #endif
#ifdef HAS_SAVE_SCREEN #ifdef HAS_SAVE_SCREEN
save_screen (); save_screen ();
#endif #endif
Cursor_Row = Cursor_Col = 0; Cursor_Row = Cursor_Col = 0;
#if defined (EMX_VIDEO) #if defined (EMX_VIDEO)
v_init (); v_init ();
if ( v_hardware () != V_MONOCHROME ) IsColor = 1; else IsColor = 0; if ( v_hardware () != V_MONOCHROME ) IsColor = 1; else IsColor = 0;
@ -1444,7 +1444,7 @@ void SLtt_init_video (void)
Blink_Killed = 1; /* seems to work */ Blink_Killed = 1; /* seems to work */
} }
} }
if (!Attribute_Byte) if (!Attribute_Byte)
{ {
/* find the attribute currently under the cursor */ /* find the attribute currently under the cursor */
@ -1452,7 +1452,7 @@ void SLtt_init_video (void)
Attribute_Byte = Line_Buffer[1]; Attribute_Byte = Line_Buffer[1];
set_color_from_attribute (Attribute_Byte); set_color_from_attribute (Attribute_Byte);
} }
v_attrib (Attribute_Byte); v_attrib (Attribute_Byte);
/* SLtt_Term_Cannot_Insert = 1; */ /* SLtt_Term_Cannot_Insert = 1; */
#else /* EMX_VIDEO */ #else /* EMX_VIDEO */
@ -1466,7 +1466,7 @@ void SLtt_init_video (void)
VioSetState (&RequestBlock, 0); /* nop if !fullscreen */ VioSetState (&RequestBlock, 0); /* nop if !fullscreen */
Blink_Killed = 1; Blink_Killed = 1;
} }
if (!Attribute_Byte) if (!Attribute_Byte)
{ {
/* find the attribute currently under the cursor */ /* find the attribute currently under the cursor */
@ -1488,7 +1488,7 @@ void SLtt_init_video (void)
# endif # endif
if (!Attribute_Byte) Attribute_Byte = 0x17; if (!Attribute_Byte) Attribute_Byte = 0x17;
IsColor = 1; /* is it really? */ IsColor = 1; /* is it really? */
if (IsColor) if (IsColor)
{ {
union REGS r; union REGS r;
@ -1516,11 +1516,11 @@ void SLtt_init_video (void)
IsColor = 1; IsColor = 1;
} }
} }
/* test for video adapter type. Of primary interest is whether there is /* test for video adapter type. Of primary interest is whether there is
* snow or not. Assume snow if the card is color and not EGA or greater. * snow or not. Assume snow if the card is color and not EGA or greater.
*/ */
/* Use Ralf Brown test for EGA or greater */ /* Use Ralf Brown test for EGA or greater */
asm mov ah, 0x12 asm mov ah, 0x12
asm mov bl, 0x10 asm mov bl, 0x10
@ -1528,7 +1528,7 @@ void SLtt_init_video (void)
asm int 10h asm int 10h
asm cmp bh, 0xFF asm cmp bh, 0xFF
asm je L1 asm je L1
/* (V)EGA */ /* (V)EGA */
asm xor bx, bx asm xor bx, bx
asm mov SLtt_Msdos_Cheap_Video, bx asm mov SLtt_Msdos_Cheap_Video, bx
@ -1538,7 +1538,7 @@ void SLtt_init_video (void)
asm mov ax, 0x17 asm mov ax, 0x17
asm mov Attribute_Byte, ax asm mov Attribute_Byte, ax
asm jmp L2 asm jmp L2
L1: L1:
/* Not (V)EGA */ /* Not (V)EGA */
asm mov ah, 0x0F asm mov ah, 0x0F

View file

@ -1,6 +1,6 @@
/* Copyright (c) 1992, 1995 John E. Davis /* Copyright (c) 1992, 1995 John E. Davis
* All rights reserved. * All rights reserved.
* *
* You may distribute under the terms of either the GNU General Public * You may distribute under the terms of either the GNU General Public
* License or the Perl Artistic License. * License or the Perl Artistic License.
*/ */
@ -105,9 +105,9 @@ int SLang_init_tty (int abort_char, int no_flow_control, int opost)
if (flags & ENABLE_PROCESSED_INPUT) { if (flags & ENABLE_PROCESSED_INPUT) {
return -1; return -1;
} }
} }
(void) SetConsoleCursorPosition(hStdout, newPosition); (void) SetConsoleCursorPosition(hStdout, newPosition);
/* success */ /* success */
return 0; return 0;
@ -136,17 +136,17 @@ int SLsys_input_pending (int tsecs)
while (1) while (1)
{ {
if (PeekConsoleInput(hStdin, &record, 1, &bytesRead)) if (PeekConsoleInput(hStdin, &record, 1, &bytesRead))
{ {
if (bytesRead == 1) if (bytesRead == 1)
{ {
if ((record.EventType == KEY_EVENT) if ((record.EventType == KEY_EVENT)
&& record.Event.KeyEvent.bKeyDown) && record.Event.KeyEvent.bKeyDown)
{ {
/* ok, there is a keypress here */ /* ok, there is a keypress here */
return 1; return 1;
} }
else else
{ {
/* something else is here, so read it and try again */ /* something else is here, so read it and try again */
(void) ReadConsoleInput(hStdin, &record, 1, &bytesRead); (void) ReadConsoleInput(hStdin, &record, 1, &bytesRead);
@ -173,7 +173,7 @@ int SLsys_input_pending (int tsecs)
if (keyWaiting()) return 1; if (keyWaiting()) return 1;
while (count > 0) while (count > 0)
{ {
delay (20); 20 ms or 1/50 sec delay (20); 20 ms or 1/50 sec
if (keyWaiting()) break; if (keyWaiting()) break;
count--; count--;
} }

View file

@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <config.h> #include <config.h>
@ -163,7 +163,7 @@ static umode_t get_perm (char *s, int base)
m |= (s [1] == '-') ? 0 : m |= (s [1] == '-') ? 0 :
((s[1] == '+') ? (1 << (base + 1)) : (1 << (base + 1)) & ch_cmode); ((s[1] == '+') ? (1 << (base + 1)) : (1 << (base + 1)) & ch_cmode);
m |= (s [2] == '-') ? 0 : m |= (s [2] == '-') ? 0 :
((s[2] == '+') ? (1 << base) : (1 << base) & ch_cmode); ((s[2] == '+') ? (1 << base) : (1 << base) & ch_cmode);
@ -192,12 +192,12 @@ static void print_flags (void)
dlg_move (ch_dlg, BY+1, 9+i); dlg_move (ch_dlg, BY+1, 9+i);
addch (ch_flags [i]); addch (ch_flags [i]);
} }
for (i = 0; i < 3; i++){ for (i = 0; i < 3; i++){
dlg_move (ch_dlg, BY + 1, 17 + i); dlg_move (ch_dlg, BY + 1, 17 + i);
addch (ch_flags [i+3]); addch (ch_flags [i+3]);
} }
for (i = 0; i < 3; i++){ for (i = 0; i < 3; i++){
dlg_move (ch_dlg, BY + 1, 25 + i); dlg_move (ch_dlg, BY + 1, 25 + i);
addch (ch_flags [i+6]); addch (ch_flags [i+6]);
@ -239,7 +239,7 @@ static int chl_callback (Dlg_head * h, int Par, int Msg)
dlg_erase (h); dlg_erase (h);
draw_box (h, 0, 0, 13, 17); draw_box (h, 0, 0, 13, 17);
break; break;
case DLG_KEY: case DLG_KEY:
switch (Par) { switch (Par) {
case KEY_LEFT: case KEY_LEFT:
@ -259,20 +259,20 @@ static void do_enter_key (Dlg_head *h, int f_pos)
struct group *chl_grp; struct group *chl_grp;
WLEntry *fe; WLEntry *fe;
int lxx, lyy, chl_end, b_pos; int lxx, lyy, chl_end, b_pos;
do { do {
lxx = (COLS - 74) / 2 + ((f_pos == 3) ? 35 : 53); lxx = (COLS - 74) / 2 + ((f_pos == 3) ? 35 : 53);
lyy = (LINES - 13) / 2; lyy = (LINES - 13) / 2;
chl_end = 0; chl_end = 0;
chl_dlg = create_dlg (lyy, lxx, 13, 17, dialog_colors, chl_callback, chl_dlg = create_dlg (lyy, lxx, 13, 17, dialog_colors, chl_callback,
"[Chown-advanced]", "achown_enter", DLG_NONE); "[Chown-advanced]", "achown_enter", DLG_NONE);
/* get new listboxes */ /* get new listboxes */
chl_list = listbox_new (1, 1, 15, 11, 0, l_call, NULL); chl_list = listbox_new (1, 1, 15, 11, 0, l_call, NULL);
listbox_add_item (chl_list, 0, 0, "<Unknown>", NULL); listbox_add_item (chl_list, 0, 0, "<Unknown>", NULL);
if (f_pos == 3) { if (f_pos == 3) {
/* get and put user names in the listbox */ /* get and put user names in the listbox */
setpwent (); setpwent ();
@ -284,22 +284,22 @@ static void do_enter_key (Dlg_head *h, int f_pos)
else else
{ {
/* get and put group names in the listbox */ /* get and put group names in the listbox */
setgrent (); setgrent ();
while ((chl_grp = getgrent ())) { while ((chl_grp = getgrent ())) {
listbox_add_item (chl_list, 0, 0, chl_grp->gr_name, NULL); listbox_add_item (chl_list, 0, 0, chl_grp->gr_name, NULL);
} }
endgrent (); endgrent ();
fe = listbox_search_text (chl_list, get_group (sf_stat->st_gid)); fe = listbox_search_text (chl_list, get_group (sf_stat->st_gid));
} }
if (fe) if (fe)
listbox_select_entry (chl_list, fe); listbox_select_entry (chl_list, fe);
b_pos = chl_list->pos; b_pos = chl_list->pos;
add_widget (chl_dlg, chl_list); add_widget (chl_dlg, chl_list);
run_dlg (chl_dlg); run_dlg (chl_dlg);
if (b_pos != chl_list->pos){ if (b_pos != chl_list->pos){
int ok = 0; int ok = 0;
if (f_pos == 3){ if (f_pos == 3){
@ -352,19 +352,19 @@ static void chown_refresh (void)
addstr (_("group")); addstr (_("group"));
dlg_move (ch_dlg, BY - 1, 24); dlg_move (ch_dlg, BY - 1, 24);
addstr (_("other")); addstr (_("other"));
dlg_move (ch_dlg, BY - 1, 35); dlg_move (ch_dlg, BY - 1, 35);
addstr (_("owner")); addstr (_("owner"));
dlg_move (ch_dlg, BY - 1, 53); dlg_move (ch_dlg, BY - 1, 53);
addstr (_("group")); addstr (_("group"));
dlg_move (ch_dlg, 3, 4); dlg_move (ch_dlg, 3, 4);
addstr (_("On")); addstr (_("On"));
dlg_move (ch_dlg, BY + 1, 4); dlg_move (ch_dlg, BY + 1, 4);
addstr (_("Flag")); addstr (_("Flag"));
dlg_move (ch_dlg, BY + 2, 4); dlg_move (ch_dlg, BY + 2, 4);
addstr (_("Mode")); addstr (_("Mode"));
if (!single_set){ if (!single_set){
dlg_move (ch_dlg, 3, 54); dlg_move (ch_dlg, 3, 54);
@ -383,13 +383,13 @@ static void chown_info_update ()
{ {
/* display file info */ /* display file info */
attrset (COLOR_NORMAL); attrset (COLOR_NORMAL);
/* name && mode */ /* name && mode */
dlg_move (ch_dlg, 3, 8); dlg_move (ch_dlg, 3, 8);
printw ("%s", name_trunc (fname, 45)); printw ("%s", name_trunc (fname, 45));
dlg_move (ch_dlg, BY + 2, 9); dlg_move (ch_dlg, BY + 2, 9);
printw ("%12o", get_mode ()); printw ("%12o", get_mode ());
/* permissions */ /* permissions */
set_perm (b_att[0]->text, sf_stat->st_mode >> 6); set_perm (b_att[0]->text, sf_stat->st_mode >> 6);
set_perm (b_att[1]->text, sf_stat->st_mode >> 3); set_perm (b_att[1]->text, sf_stat->st_mode >> 3);
@ -412,7 +412,7 @@ static int advanced_chown_callback (Dlg_head * h, int Par, int Msg)
chown_refresh (); chown_refresh ();
chown_info_update (); chown_info_update ();
return 1; return 1;
case DLG_POST_KEY: case DLG_POST_KEY:
if (f_pos < 3) if (f_pos < 3)
b_setpos (f_pos); b_setpos (f_pos);
@ -429,37 +429,37 @@ static int advanced_chown_callback (Dlg_head * h, int Par, int Msg)
case DLG_KEY: case DLG_KEY:
switch (Par) { switch (Par) {
case XCTRL('b'): case XCTRL('b'):
case KEY_LEFT: case KEY_LEFT:
if (f_pos < 5) if (f_pos < 5)
return (dec_flag_pos (f_pos)); return (dec_flag_pos (f_pos));
break; break;
case XCTRL('f'): case XCTRL('f'):
case KEY_RIGHT: case KEY_RIGHT:
if (f_pos < 5) if (f_pos < 5)
return (inc_flag_pos (f_pos)); return (inc_flag_pos (f_pos));
break; break;
case ' ': case ' ':
if (f_pos < 3) if (f_pos < 3)
return 1; return 1;
break; break;
case '\n': case '\n':
case KEY_ENTER: case KEY_ENTER:
if (f_pos <= 2 || f_pos >= 5) if (f_pos <= 2 || f_pos >= 5)
break; break;
do_enter_key (h, f_pos); do_enter_key (h, f_pos);
return 1; return 1;
case ALT ('x'): case ALT ('x'):
i++; i++;
case ALT ('w'): case ALT ('w'):
i++; i++;
case ALT ('r'): case ALT ('r'):
Par = i + 3; Par = i + 3;
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
@ -469,13 +469,13 @@ static int advanced_chown_callback (Dlg_head * h, int Par, int Msg)
dlg_broadcast_msg (h, WIDGET_DRAW, 0); dlg_broadcast_msg (h, WIDGET_DRAW, 0);
send_message (h, h->current->widget, WIDGET_FOCUS, 0); send_message (h, h->current->widget, WIDGET_FOCUS, 0);
break; break;
case XCTRL ('x'): case XCTRL ('x'):
i++; i++;
case XCTRL ('w'): case XCTRL ('w'):
i++; i++;
case XCTRL ('r'): case XCTRL ('r'):
Par = i; Par = i;
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
@ -485,13 +485,13 @@ static int advanced_chown_callback (Dlg_head * h, int Par, int Msg)
dlg_broadcast_msg (h, WIDGET_DRAW, 0); dlg_broadcast_msg (h, WIDGET_DRAW, 0);
send_message (h, h->current->widget, WIDGET_FOCUS, 0); send_message (h, h->current->widget, WIDGET_FOCUS, 0);
break; break;
case 'x': case 'x':
i++; i++;
case 'w': case 'w':
i++; i++;
case 'r': case 'r':
if (f_pos > 2) if (f_pos > 2)
break; break;
@ -505,10 +505,10 @@ static int advanced_chown_callback (Dlg_head * h, int Par, int Msg)
case '4': case '4':
i++; i++;
case '2': case '2':
i++; i++;
case '1': case '1':
if (f_pos > 2) if (f_pos > 2)
break; break;
@ -516,15 +516,15 @@ static int advanced_chown_callback (Dlg_head * h, int Par, int Msg)
ch_flags[flag_pos] = '='; ch_flags[flag_pos] = '=';
update_mode (h); update_mode (h);
break; break;
case '-': case '-':
if (f_pos > 2) if (f_pos > 2)
break; break;
case '*': case '*':
if (Par == '*') if (Par == '*')
Par = '='; Par = '=';
case '=': case '=':
case '+': case '+':
if (f_pos > 4) if (f_pos > 4)

View file

@ -2,14 +2,14 @@
/* Background support. /* Background support.
Copyright (C) 1996 The Free Software Foundation Copyright (C) 1996 The Free Software Foundation
Written by: 1996 Miguel de Icaza Written by: 1996 Miguel de Icaza
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -78,7 +78,7 @@ static int parent_fd;
#define mymsg "Desde el hijo\n\r" #define mymsg "Desde el hijo\n\r"
struct TaskList *task_list = NULL; struct TaskList *task_list = NULL;
void void
register_task_running (pid_t pid, int fd, char *info) register_task_running (pid_t pid, int fd, char *info)
{ {
@ -130,19 +130,19 @@ do_background (char *info)
{ {
int comm [2]; /* control connection stream */ int comm [2]; /* control connection stream */
int pid; int pid;
if (socketpair (AF_UNIX, SOCK_STREAM, 0, comm) == -1) if (socketpair (AF_UNIX, SOCK_STREAM, 0, comm) == -1)
return -1; return -1;
if ((pid = fork ()) == -1) if ((pid = fork ()) == -1)
return -1; return -1;
if (pid == 0){ if (pid == 0){
int nullfd; int nullfd;
parent_fd = comm [1]; parent_fd = comm [1];
we_are_background = 1; we_are_background = 1;
/* Make stdin/stdout/stderr point somewhere */ /* Make stdin/stdout/stderr point somewhere */
close (0); close (0);
close (1); close (1);
@ -157,11 +157,11 @@ do_background (char *info)
/* To make it obvious if it fails, there is a bug report on this */ /* To make it obvious if it fails, there is a bug report on this */
write (2, mymsg, sizeof (mymsg)); write (2, mymsg, sizeof (mymsg));
write (1, mymsg, sizeof (mymsg)); write (1, mymsg, sizeof (mymsg));
/* Just for debugging the background back end */ /* Just for debugging the background back end */
if (background_wait){ if (background_wait){
volatile int i = 1; volatile int i = 1;
while (i) while (i)
; ;
} }
@ -186,12 +186,12 @@ void
real_message_1s (enum OperationMode mode, int *flags, char *title, char *str1) real_message_1s (enum OperationMode mode, int *flags, char *title, char *str1)
{ {
char *full_title; char *full_title;
if (mode == Background) if (mode == Background)
full_title = background_title (title); full_title = background_title (title);
else else
full_title = title; full_title = title;
message (*flags, title, str1); message (*flags, title, str1);
if (title != full_title) if (title != full_title)
@ -202,14 +202,14 @@ void
real_message_2s (enum OperationMode mode, int *flags, char *title, char *str1, char *str2) real_message_2s (enum OperationMode mode, int *flags, char *title, char *str1, char *str2)
{ {
char *full_title; char *full_title;
if (mode == Background) if (mode == Background)
full_title = background_title (title); full_title = background_title (title);
else else
full_title = title; full_title = title;
message (*flags, title, str1, str2); message (*flags, title, str1, str2);
if (title != full_title) if (title != full_title)
free (full_title); free (full_title);
} }
@ -218,14 +218,14 @@ void
real_message_3s (enum OperationMode mode, int *flags, char *title, char *str1, char *str2, const char *str3) real_message_3s (enum OperationMode mode, int *flags, char *title, char *str1, char *str2, const char *str3)
{ {
char *full_title; char *full_title;
if (mode == Background) if (mode == Background)
full_title = background_title (title); full_title = background_title (title);
else else
full_title = title; full_title = title;
message (*flags, title, str1, str2, str3); message (*flags, title, str1, str2, str3);
if (title != full_title) if (title != full_title)
free (full_title); free (full_title);
} }
@ -268,7 +268,7 @@ real_message_3s (enum OperationMode mode, int *flags, char *title, char *str1, c
*/ */
/* /*
* Receive requests from background process and invoke the * Receive requests from background process and invoke the
* specified routine * specified routine
*/ */
int int
@ -282,7 +282,7 @@ background_attention (int fd, void *xpid)
int bytes; int bytes;
enum ReturnType type; enum ReturnType type;
char *background_process_error = _(" Background process error "); char *background_process_error = _(" Background process error ");
bytes = read (fd, &routine, sizeof (routine)); bytes = read (fd, &routine, sizeof (routine));
if (bytes < (sizeof (routine))){ if (bytes < (sizeof (routine))){
if (errno == ECHILD) if (errno == ECHILD)
@ -300,7 +300,7 @@ background_attention (int fd, void *xpid)
waitpid (pid, &status, 0); waitpid (pid, &status, 0);
return 0; return 0;
} }
read (fd, &argc, sizeof (argc)); read (fd, &argc, sizeof (argc));
if (argc > MAXCALLARGS){ if (argc > MAXCALLARGS){
message (1, _(" Background protocol error "), message (1, _(" Background protocol error "),
@ -308,14 +308,14 @@ background_attention (int fd, void *xpid)
" than we can handle. \n")); " than we can handle. \n"));
} }
read (fd, &type, sizeof (type)); read (fd, &type, sizeof (type));
for (i = 0; i < argc; i++){ for (i = 0; i < argc; i++){
int size; int size;
read (fd, &size, sizeof (size)); read (fd, &size, sizeof (size));
data [i] = xmalloc (size+1, "RPC Arguments"); data [i] = xmalloc (size+1, "RPC Arguments");
read (fd, data [i], size); read (fd, data [i], size);
data [i][size] = 0; /* NULL terminate the blocks (they could be strings) */ data [i][size] = 0; /* NULL terminate the blocks (they could be strings) */
} }
@ -338,12 +338,12 @@ background_attention (int fd, void *xpid)
(Background, data [0], data [1], data [2], data [3]); (Background, data [0], data [1], data [2], data [3]);
break; break;
} }
/* Send the result code and the value for shared variables */ /* Send the result code and the value for shared variables */
write (fd, &result, sizeof (int)); write (fd, &result, sizeof (int));
write (fd, &do_append, sizeof (do_append)); write (fd, &do_append, sizeof (do_append));
write (fd, &recursive_result, sizeof (recursive_result)); write (fd, &recursive_result, sizeof (recursive_result));
} else if (type == Return_String) { } else if (type == Return_String) {
int len; int len;
@ -407,7 +407,7 @@ parent_call (void *routine, int argc, ...)
{ {
va_list ap; va_list ap;
int i; int i;
va_start (ap, argc); va_start (ap, argc);
parent_call_header (routine, argc, Return_Integer); parent_call_header (routine, argc, Return_Integer);
for (i = 0; i < argc; i++){ for (i = 0; i < argc; i++){
@ -419,7 +419,7 @@ parent_call (void *routine, int argc, ...)
write (parent_fd, &len, sizeof (int)); write (parent_fd, &len, sizeof (int));
write (parent_fd, value, len); write (parent_fd, value, len);
} }
/* Besides the regular result, get the value for /* Besides the regular result, get the value for
* variables that may be modified in the parent that affect our behaviour * variables that may be modified in the parent that affect our behaviour
*/ */
read (parent_fd, &i, sizeof (int)); read (parent_fd, &i, sizeof (int));
@ -434,7 +434,7 @@ parent_call_string (void *routine, int argc, ...)
va_list ap; va_list ap;
char *str; char *str;
int i; int i;
va_start (ap, argc); va_start (ap, argc);
parent_call_header (routine, argc, Return_String); parent_call_header (routine, argc, Return_String);
for (i = 0; i < argc; i++){ for (i = 0; i < argc; i++){
@ -466,7 +466,7 @@ call_1s (int (*routine)(enum OperationMode, char *), char *str)
{ {
if (we_are_background) if (we_are_background)
return parent_call ((void *)routine, 1, strlen (str), str); return parent_call ((void *)routine, 1, strlen (str), str);
else else
return (*routine)(Foreground, str); return (*routine)(Foreground, str);
} }

View file

@ -1,15 +1,15 @@
/* Some misc dialog boxes for the program. /* Some misc dialog boxes for the program.
Copyright (C) 1994, 1995 the Free Software Foundation Copyright (C) 1994, 1995 the Free Software Foundation
Authors: 1994, 1995 Miguel de Icaza Authors: 1994, 1995 Miguel de Icaza
1995 Jakub Jelinek 1995 Jakub Jelinek
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -82,7 +82,7 @@ static int display_callback (struct Dlg_head *h, int id, int Msg)
#ifndef HAVE_X #ifndef HAVE_X
char *text; char *text;
WInput *input; WInput *input;
switch (Msg){ switch (Msg){
case DLG_DRAW: case DLG_DRAW:
attrset (COLOR_NORMAL); attrset (COLOR_NORMAL);
@ -101,7 +101,7 @@ static int display_callback (struct Dlg_head *h, int id, int Msg)
input_set_point (status, 0); input_set_point (status, 0);
} }
break; break;
case DLG_KEY: case DLG_KEY:
if (id == '\n'){ if (id == '\n'){
if((WRadio *) h->current->widget == my_radio){ if((WRadio *) h->current->widget == my_radio){
@ -109,13 +109,13 @@ static int display_callback (struct Dlg_head *h, int id, int Msg)
dlg_stop (h); dlg_stop (h);
break; break;
} }
if ((WInput *) h->current->widget == user){ if ((WInput *) h->current->widget == user){
h->ret_value = B_USER + 6; h->ret_value = B_USER + 6;
dlg_stop (h); dlg_stop (h);
break; break;
} }
if ((WInput *) h->current->widget == status){ if ((WInput *) h->current->widget == status){
h->ret_value = B_USER + 7; h->ret_value = B_USER + 7;
dlg_stop (h); dlg_stop (h);
@ -131,7 +131,7 @@ static int display_callback (struct Dlg_head *h, int id, int Msg)
return MSG_HANDLED; return MSG_HANDLED;
} }
} }
#endif #endif
return MSG_NOT_HANDLED; return MSG_NOT_HANDLED;
} }
@ -141,9 +141,9 @@ static void display_init (int radio_sel, char *init_text,
char* user_mini_status = _("user &Mini status"); char* user_mini_status = _("user &Mini status");
char* ok_button = _("&Ok"); char* ok_button = _("&Ok");
char* cancel_button = _("&Cancel"); char* cancel_button = _("&Cancel");
static int button_start = 30; static int button_start = 30;
displays_status = _status; displays_status = _status;
if (!i18n_displays_flag){ if (!i18n_displays_flag){
@ -169,13 +169,13 @@ static void display_init (int radio_sel, char *init_text,
i = strlen (user_mini_status) + 13; i = strlen (user_mini_status) + 13;
if (i > DISPLAY_X) if (i > DISPLAY_X)
DISPLAY_X = i; DISPLAY_X = i;
i = strlen (display_title) + 8; i = strlen (display_title) + 8;
if (i > DISPLAY_X) if (i > DISPLAY_X)
DISPLAY_X = i; DISPLAY_X = i;
button_start = DISPLAY_X - l - 5; button_start = DISPLAY_X - l - 5;
/* get hotkey of user-defined format string */ /* get hotkey of user-defined format string */
cp = strchr(displays[LIST_TYPES-1],'&'); cp = strchr(displays[LIST_TYPES-1],'&');
if (cp != NULL && *++cp != '\0') if (cp != NULL && *++cp != '\0')
@ -189,12 +189,12 @@ static void display_init (int radio_sel, char *init_text,
x_set_dialog_title (dd, _("Listing mode")); x_set_dialog_title (dd, _("Listing mode"));
add_widgetl (dd, add_widgetl (dd,
button_new (4, button_start, B_CANCEL, button_new (4, button_start, B_CANCEL,
NORMAL_BUTTON, cancel_button, 0, 0, "cancel-button"), NORMAL_BUTTON, cancel_button, 0, 0, "cancel-button"),
XV_WLAY_RIGHTOF); XV_WLAY_RIGHTOF);
add_widgetl (dd, add_widgetl (dd,
button_new (3, button_start, B_ENTER, button_new (3, button_start, B_ENTER,
DEFPUSH_BUTTON, ok_button, 0, 0, "ok-button"), DEFPUSH_BUTTON, ok_button, 0, 0, "ok-button"),
XV_WLAY_CENTERROW); XV_WLAY_CENTERROW);
@ -204,7 +204,7 @@ static void display_init (int radio_sel, char *init_text,
check_status = check_new (9, 5, _check_status, user_mini_status, "mini-status"); check_status = check_new (9, 5, _check_status, user_mini_status, "mini-status");
add_widgetl (dd, check_status, XV_WLAY_NEXTROW); add_widgetl (dd, check_status, XV_WLAY_NEXTROW);
user = input_new (7, 9, INPUT_COLOR, DISPLAY_X-14, init_text, "user-fmt-input"); user = input_new (7, 9, INPUT_COLOR, DISPLAY_X-14, init_text, "user-fmt-input");
add_widgetl (dd, user, XV_WLAY_RIGHTDOWN); add_widgetl (dd, user, XV_WLAY_RIGHTDOWN);
input_set_point (user, 0); input_set_point (user, 0);
@ -243,20 +243,20 @@ int display_box (WPanel *panel, char **userp, char **minip, int *use_msformat,
} }
current_mode = panel->list_type; current_mode = panel->list_type;
display_init (current_mode, panel->user_format, display_init (current_mode, panel->user_format,
panel->user_mini_status, panel->user_status_format); panel->user_mini_status, panel->user_status_format);
run_dlg (dd); run_dlg (dd);
result = -1; result = -1;
if (section) { if (section) {
free (panel->user_format); free (panel->user_format);
for (i = 0; i < LIST_TYPES; i++) for (i = 0; i < LIST_TYPES; i++)
free (panel->user_status_format [i]); free (panel->user_status_format [i]);
free (panel); free (panel);
} }
if (dd->ret_value != B_CANCEL){ if (dd->ret_value != B_CANCEL){
result = my_radio->sel; result = my_radio->sel;
*userp = strdup (user->buffer); *userp = strdup (user->buffer);
@ -303,12 +303,12 @@ sortfn *sort_box (sortfn *sort_fn, int *reverse, int *case_sensitive)
i = strlen (case_label) + 4; i = strlen (case_label) + 4;
if (i > r) if (i > r)
r = i; r = i;
l = strlen (ok_button) + 6; l = strlen (ok_button) + 6;
i = strlen (cancel_button) + 4; i = strlen (cancel_button) + 4;
if (i > l) if (i > l)
l = i; l = i;
i = check_pos + max(r,l) + 2; i = check_pos + max(r,l) + 2;
if (i > SORT_X) if (i > SORT_X)
@ -324,23 +324,23 @@ sortfn *sort_box (sortfn *sort_fn, int *reverse, int *case_sensitive)
} }
result = 0; result = 0;
for (i = 0; i < SORT_TYPES; i++) for (i = 0; i < SORT_TYPES; i++)
if ((sortfn *) (sort_orders [i].sort_fn) == sort_fn){ if ((sortfn *) (sort_orders [i].sort_fn) == sort_fn){
current_mode = i; current_mode = i;
break; break;
} }
dd = create_dlg (0, 0, SORT_Y, SORT_X, dialog_colors, common_dialog_callback, dd = create_dlg (0, 0, SORT_Y, SORT_X, dialog_colors, common_dialog_callback,
"[Left and Right Menus]", "sort", DLG_CENTER | DLG_GRID); "[Left and Right Menus]", "sort", DLG_CENTER | DLG_GRID);
x_set_dialog_title (dd, sort_title); x_set_dialog_title (dd, sort_title);
add_widgetl (dd, add_widgetl (dd,
button_new (10, button_pos, B_CANCEL, NORMAL_BUTTON, cancel_button, button_new (10, button_pos, B_CANCEL, NORMAL_BUTTON, cancel_button,
0, 0, "cancel-button"), XV_WLAY_CENTERROW); 0, 0, "cancel-button"), XV_WLAY_CENTERROW);
add_widgetl (dd, add_widgetl (dd,
button_new (9, button_pos, B_ENTER, DEFPUSH_BUTTON, ok_button, button_new (9, button_pos, B_ENTER, DEFPUSH_BUTTON, ok_button,
0, 0, "ok-button"), XV_WLAY_RIGHTDOWN); 0, 0, "ok-button"), XV_WLAY_RIGHTDOWN);
@ -351,7 +351,7 @@ sortfn *sort_box (sortfn *sort_fn, int *reverse, int *case_sensitive)
my_radio = radio_new (3, 3, SORT_TYPES, sort_orders_names, 1, "radio-1"); my_radio = radio_new (3, 3, SORT_TYPES, sort_orders_names, 1, "radio-1");
my_radio->sel = my_radio->pos = current_mode; my_radio->sel = my_radio->pos = current_mode;
add_widget (dd, my_radio); add_widget (dd, my_radio);
run_dlg (dd); run_dlg (dd);
@ -401,7 +401,7 @@ void confirm_box ()
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
static int i18n_flag = 0; static int i18n_flag = 0;
if (!i18n_flag) if (!i18n_flag)
{ {
register int i = sizeof(conf_widgets)/sizeof(QuickWidget) - 1; register int i = sizeof(conf_widgets)/sizeof(QuickWidget) - 1;
@ -434,7 +434,7 @@ void confirm_box ()
confirmation.xlen = i; confirmation.xlen = i;
confirmation.title = _(confirmation.title); confirmation.title = _(confirmation.title);
i18n_flag = confirmation.i18n = 1; i18n_flag = confirmation.i18n = 1;
} }
@ -499,7 +499,7 @@ void display_bits_box ()
l1 = strlen (display_widgets [2].text); l1 = strlen (display_widgets [2].text);
if (l1 > maxlen) if (l1 > maxlen)
maxlen = l1; maxlen = l1;
display_bits.xlen = (maxlen + 5) * 6 / 4; display_bits.xlen = (maxlen + 5) * 6 / 4;
@ -557,7 +557,7 @@ static int tree_callback (struct Dlg_head *h, int id, int msg)
dlg_stop (h); dlg_stop (h);
} }
return MSG_HANDLED; return MSG_HANDLED;
case DLG_DRAW: case DLG_DRAW:
common_dialog_repaint (h); common_dialog_repaint (h);
break; break;
@ -574,7 +574,7 @@ char *tree (char *current_dir)
tree_colors [3] = dialog_colors [0]; tree_colors [3] = dialog_colors [0];
tree_colors [1] = dialog_colors [1]; tree_colors [1] = dialog_colors [1];
/* Create the components */ /* Create the components */
dlg = create_dlg (0, 0, TREE_Y, TREE_X, tree_colors, dlg = create_dlg (0, 0, TREE_Y, TREE_X, tree_colors,
tree_callback, "[Directory Tree]", "tree", DLG_CENTER); tree_callback, "[Directory Tree]", "tree", DLG_CENTER);
@ -584,13 +584,13 @@ char *tree (char *current_dir)
add_widget (dlg, bar); add_widget (dlg, bar);
bar->widget.x = 0; bar->widget.x = 0;
bar->widget.y = LINES - 1; bar->widget.y = LINES - 1;
run_dlg (dlg); run_dlg (dlg);
if (dlg->ret_value == B_ENTER) if (dlg->ret_value == B_ENTER)
val = strdup (mytree->selected_ptr->name); val = strdup (mytree->selected_ptr->name);
else else
val = 0; val = 0;
destroy_dlg (dlg); destroy_dlg (dlg);
return val; return val;
} }
@ -662,17 +662,17 @@ static QuickWidget confvfs_widgets [] = {
{ quick_label, 4, VFSX, 8, VFSY, N_("ftp anonymous password:"), { quick_label, 4, VFSX, 8, VFSY, N_("ftp anonymous password:"),
0, 0, 0, 0, XV_WLAY_NEXTROW, "label-pass"}, 0, 0, 0, 0, XV_WLAY_NEXTROW, "label-pass"},
#endif #endif
{ quick_input, 26, VFSX, 6, VFSY, "", 10, 0, 0, &ret_limit, { quick_input, 26, VFSX, 6, VFSY, "", 10, 0, 0, &ret_limit,
XV_WLAY_RIGHTDOWN, "input-limit" }, XV_WLAY_RIGHTDOWN, "input-limit" },
{ quick_radio, 4, VFSX, 5, VFSY, "", 2, 0, { quick_radio, 4, VFSX, 5, VFSY, "", 2, 0,
&vfs_use_limit, confvfs_str, XV_WLAY_BELOWCLOSE, "radio" }, &vfs_use_limit, confvfs_str, XV_WLAY_BELOWCLOSE, "radio" },
{ quick_label, 4, VFSX, 4, VFSY, N_("Gzipped tar archive extract:"), { quick_label, 4, VFSX, 4, VFSY, N_("Gzipped tar archive extract:"),
0, 0, 0, 0, XV_WLAY_NEXTROW, "label-tar" }, 0, 0, 0, 0, XV_WLAY_NEXTROW, "label-tar" },
{ quick_label, 46, VFSX, 3, VFSY, "sec", { quick_label, 46, VFSX, 3, VFSY, "sec",
0, 0, 0, 0, XV_WLAY_RIGHTOF, "label-sec2" }, 0, 0, 0, 0, XV_WLAY_RIGHTOF, "label-sec2" },
{ quick_input, 35, VFSX, 3, VFSY, "", 10, 0, 0, &ret_timeout, { quick_input, 35, VFSX, 3, VFSY, "", 10, 0, 0, &ret_timeout,
XV_WLAY_RIGHTOF, "input-timo-vfs" }, XV_WLAY_RIGHTOF, "input-timo-vfs" },
{ quick_label, 4, VFSX, 3, VFSY, N_("Timeout for freeing VFSs:"), { quick_label, 4, VFSX, 3, VFSY, N_("Timeout for freeing VFSs:"),
0, 0, 0, 0, XV_WLAY_BELOWCLOSE, "label-vfs" }, 0, 0, 0, 0, XV_WLAY_BELOWCLOSE, "label-vfs" },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, XV_WLAY_DONTCARE, 0 } { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, XV_WLAY_DONTCARE, 0 }
}; };
@ -720,7 +720,7 @@ void configure_vfs ()
if (quick_dialog (&confvfs_dlg) != B_CANCEL) { if (quick_dialog (&confvfs_dlg) != B_CANCEL) {
char *p; char *p;
vfs_timeout = atoi (ret_timeout); vfs_timeout = atoi (ret_timeout);
free (ret_timeout); free (ret_timeout);
if (vfs_timeout < 0 || vfs_timeout > 10000) if (vfs_timeout < 0 || vfs_timeout > 10000)
@ -771,10 +771,10 @@ char *cd_dialog (void)
{ quick_input, 6, 57, 5, 0, "", 50, 0, 0, 0, XV_WLAY_RIGHTOF, "input" }, { quick_input, 6, 57, 5, 0, "", 50, 0, 0, 0, XV_WLAY_RIGHTOF, "input" },
{ quick_label, 3, 57, 2, 0, "", 0, 0, 0, 0, XV_WLAY_DONTCARE, "label" }, { quick_label, 3, 57, 2, 0, "", 0, 0, 0, 0, XV_WLAY_DONTCARE, "label" },
{ 0 } }; { 0 } };
char *my_str; char *my_str;
int len; int len;
Quick_input.xlen = 57; Quick_input.xlen = 57;
Quick_input.title = _("Quick cd"); Quick_input.title = _("Quick cd");
Quick_input.help = "[Quick cd]"; Quick_input.help = "[Quick cd]";
@ -788,7 +788,7 @@ char *cd_dialog (void)
len = strlen (quick_widgets [INPUT_INDEX+1].text); len = strlen (quick_widgets [INPUT_INDEX+1].text);
quick_widgets [INPUT_INDEX+1].relative_x = 3; quick_widgets [INPUT_INDEX+1].relative_x = 3;
quick_widgets [INPUT_INDEX].relative_x = quick_widgets [INPUT_INDEX].relative_x =
quick_widgets [INPUT_INDEX+1].relative_x + len + 1; quick_widgets [INPUT_INDEX+1].relative_x + len + 1;
Quick_input.xlen = len + quick_widgets [INPUT_INDEX].hotkey_pos + 7; Quick_input.xlen = len + quick_widgets [INPUT_INDEX].hotkey_pos + 7;
@ -800,7 +800,7 @@ char *cd_dialog (void)
Quick_input.ypos = LINES - 2 - Quick_input.ylen; Quick_input.ypos = LINES - 2 - Quick_input.ylen;
quick_widgets [INPUT_INDEX].relative_y = 2; quick_widgets [INPUT_INDEX].relative_y = 2;
quick_widgets [INPUT_INDEX].str_result = &my_str; quick_widgets [INPUT_INDEX].str_result = &my_str;
Quick_input.widgets = quick_widgets; Quick_input.widgets = quick_widgets;
if (quick_dialog (&Quick_input) != B_CANCEL){ if (quick_dialog (&Quick_input) != B_CANCEL){
return *(quick_widgets [INPUT_INDEX].str_result); return *(quick_widgets [INPUT_INDEX].str_result);
@ -808,7 +808,7 @@ char *cd_dialog (void)
return 0; return 0;
} }
void symlink_dialog (char *existing, char *new, char **ret_existing, void symlink_dialog (char *existing, char *new, char **ret_existing,
char **ret_new) char **ret_new)
{ {
QuickDialog Quick_input; QuickDialog Quick_input;
@ -828,7 +828,7 @@ void symlink_dialog (char *existing, char *new, char **ret_existing,
{ quick_input, 6, 80, 3, 8, "", 58, 0, 0, 0, XV_WLAY_BELOWCLOSE, "input-2" }, { quick_input, 6, 80, 3, 8, "", 58, 0, 0, 0, XV_WLAY_BELOWCLOSE, "input-2" },
{ quick_label, 6, 80, 2, 8, "", 0, 0, 0, 0, XV_WLAY_DONTCARE, "label-2" }, { quick_label, 6, 80, 2, 8, "", 0, 0, 0, 0, XV_WLAY_DONTCARE, "label-2" },
{ 0 } }; { 0 } };
Quick_input.xlen = 64; Quick_input.xlen = 64;
Quick_input.ylen = 8; Quick_input.ylen = 8;
Quick_input.title = "Symbolic link"; Quick_input.title = "Symbolic link";
@ -842,7 +842,7 @@ void symlink_dialog (char *existing, char *new, char **ret_existing,
Quick_input.xpos = -1; Quick_input.xpos = -1;
quick_widgets [INPUT_INDEX].str_result = ret_new; quick_widgets [INPUT_INDEX].str_result = ret_new;
quick_widgets [INPUT_INDEX+2].str_result = ret_existing; quick_widgets [INPUT_INDEX+2].str_result = ret_existing;
Quick_input.widgets = quick_widgets; Quick_input.widgets = quick_widgets;
if (quick_dialog (&Quick_input) == B_CANCEL){ if (quick_dialog (&Quick_input) == B_CANCEL){
*ret_new = NULL; *ret_new = NULL;
@ -870,7 +870,7 @@ jobs_fill_listbox (void)
state_str [0] = _("Running "); state_str [0] = _("Running ");
state_str [1] = _("Stopped"); state_str [1] = _("Stopped");
} }
while (tl){ while (tl){
char *s; char *s;
@ -880,19 +880,19 @@ jobs_fill_listbox (void)
tl = tl->next; tl = tl->next;
} }
} }
static int static int
task_cb (int action, void *ignored) task_cb (int action, void *ignored)
{ {
TaskList *tl; TaskList *tl;
int sig; int sig;
if (!bg_list->list) if (!bg_list->list)
return 0; return 0;
/* Get this instance information */ /* Get this instance information */
tl = (TaskList *) bg_list->current->data; tl = (TaskList *) bg_list->current->data;
if (action == B_STOP){ if (action == B_STOP){
sig = SIGSTOP; sig = SIGSTOP;
tl->state = Task_Stopped; tl->state = Task_Stopped;
@ -902,7 +902,7 @@ task_cb (int action, void *ignored)
} else if (action == B_KILL){ } else if (action == B_KILL){
sig = SIGKILL; sig = SIGKILL;
} }
if (sig == SIGINT) if (sig == SIGINT)
unregister_task_running (tl->pid, tl->fd); unregister_task_running (tl->pid, tl->fd);
@ -912,18 +912,18 @@ task_cb (int action, void *ignored)
/* This can be optimized to just redraw this widget :-) */ /* This can be optimized to just redraw this widget :-) */
dlg_redraw (jobs_dlg); dlg_redraw (jobs_dlg);
return 0; return 0;
} }
static struct static struct
{ {
char* name; char* name;
int xpos; int xpos;
int value; int value;
int (*callback)(); int (*callback)();
char* tkname; char* tkname;
} }
job_buttons [] = job_buttons [] =
{ {
{N_("&Stop"), 3, B_STOP, task_cb, "button-stop"}, {N_("&Stop"), 3, B_STOP, task_cb, "button-stop"},
@ -968,24 +968,24 @@ jobs_cmd (void)
common_dialog_callback, "[Background jobs]", "jobs", common_dialog_callback, "[Background jobs]", "jobs",
DLG_CENTER | DLG_GRID); DLG_CENTER | DLG_GRID);
x_set_dialog_title (jobs_dlg, _("Background Jobs")); x_set_dialog_title (jobs_dlg, _("Background Jobs"));
bg_list = listbox_new (2, 3, JOBS_X-7, JOBS_Y-9, listbox_nothing, 0, "listbox"); bg_list = listbox_new (2, 3, JOBS_X-7, JOBS_Y-9, listbox_nothing, 0, "listbox");
add_widget (jobs_dlg, bg_list); add_widget (jobs_dlg, bg_list);
i = n_buttons; i = n_buttons;
while (i--) while (i--)
{ {
add_widget (jobs_dlg, button_new (JOBS_Y-4, add_widget (jobs_dlg, button_new (JOBS_Y-4,
job_buttons [i].xpos, job_buttons [i].value, job_buttons [i].xpos, job_buttons [i].value,
NORMAL_BUTTON, job_buttons [i].name, NORMAL_BUTTON, job_buttons [i].name,
job_buttons [i].callback, 0, job_buttons [i].callback, 0,
job_buttons [i].tkname)); job_buttons [i].tkname));
} }
/* Insert all of task information in the list */ /* Insert all of task information in the list */
jobs_fill_listbox (); jobs_fill_listbox ();
run_dlg (jobs_dlg); run_dlg (jobs_dlg);
destroy_dlg (jobs_dlg); destroy_dlg (jobs_dlg);
} }
#endif #endif

View file

@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <config.h> #include <config.h>
@ -91,7 +91,7 @@ struct {
char *text; char *text;
int selected; int selected;
WCheck *check; WCheck *check;
} check_perm[PERMISSIONS] = } check_perm[PERMISSIONS] =
{ {
{ S_IXOTH, N_("execute/search by others"), 0, 0, }, { S_IXOTH, N_("execute/search by others"), 0, 0, },
{ S_IWOTH, N_("write by others"), 0, 0, }, { S_IWOTH, N_("write by others"), 0, 0, },
@ -110,7 +110,7 @@ struct {
struct { struct {
int ret_cmd, flags, y, x; int ret_cmd, flags, y, x;
char *text; char *text;
} chmod_but[BUTTONS] = } chmod_but[BUTTONS] =
{ {
{ B_CANCEL, NORMAL_BUTTON, 2, 33, N_("&Cancel") }, { B_CANCEL, NORMAL_BUTTON, 2, 33, N_("&Cancel") },
{ B_ENTER, DEFPUSH_BUTTON, 2, 17, N_("&Set") }, { B_ENTER, DEFPUSH_BUTTON, 2, 17, N_("&Set") },
@ -126,7 +126,7 @@ static void chmod_toggle_select (void)
#ifdef HAVE_TK #ifdef HAVE_TK
char *wn = (char *) ch_dlg->current->widget->wdata; char *wn = (char *) ch_dlg->current->widget->wdata;
int id = ch_dlg->current->dlg_id -BUTTONS + single_set * 2; int id = ch_dlg->current->dlg_id -BUTTONS + single_set * 2;
check_perm [id].selected ^= 1; check_perm [id].selected ^= 1;
tk_evalf ("%s configure -color $setup(%s)", tk_evalf ("%s configure -color $setup(%s)",
@ -151,7 +151,7 @@ static void chmod_refresh (void)
{ {
attrset (COLOR_NORMAL); attrset (COLOR_NORMAL);
dlg_erase (ch_dlg); dlg_erase (ch_dlg);
draw_box (ch_dlg, 1, 2, 20 - single_set, 66); draw_box (ch_dlg, 1, 2, 20 - single_set, 66);
draw_box (ch_dlg, PY, PX, PERMISSIONS + 2, 33); draw_box (ch_dlg, PY, PX, PERMISSIONS + 2, 33);
draw_box (ch_dlg, FY, FX, 10, 25); draw_box (ch_dlg, FY, FX, 10, 25);
@ -164,7 +164,7 @@ static void chmod_refresh (void)
addstr (_("Owner name")); addstr (_("Owner name"));
dlg_move (ch_dlg, FY + 7, FX + 2); dlg_move (ch_dlg, FY + 7, FX + 2);
addstr (_("Group name")); addstr (_("Group name"));
attrset (title_color); attrset (title_color);
dlg_move (ch_dlg, 1, 28); dlg_move (ch_dlg, 1, 28);
addstr (_(" Chmod command ")); addstr (_(" Chmod command "));
@ -172,7 +172,7 @@ static void chmod_refresh (void)
addstr (_(" Permission ")); addstr (_(" Permission "));
dlg_move (ch_dlg, FY, FX + 1); dlg_move (ch_dlg, FY, FX + 1);
addstr (_(" File ")); addstr (_(" File "));
attrset (selection_color); attrset (selection_color);
dlg_move (ch_dlg, TY, TX); dlg_move (ch_dlg, TY, TX);
@ -189,7 +189,7 @@ static void chmod_refresh (void)
static int chmod_callback (Dlg_head *h, int Par, int Msg) static int chmod_callback (Dlg_head *h, int Par, int Msg)
{ {
char buffer [10]; char buffer [10];
switch (Msg) { switch (Msg) {
case DLG_ACTION: case DLG_ACTION:
if (Par >= BUTTONS - single_set * 2){ if (Par >= BUTTONS - single_set * 2){
@ -236,10 +236,10 @@ static void init_chmod (void)
title_color = SELECTED_COLOR; title_color = SELECTED_COLOR;
selection_color = SELECTED_COLOR; selection_color = SELECTED_COLOR;
} }
ch_dlg = create_dlg (0, 0, 22 - single_set, 70, dialog_colors, ch_dlg = create_dlg (0, 0, 22 - single_set, 70, dialog_colors,
chmod_callback, "[Chmod]", "chmod", DLG_CENTER); chmod_callback, "[Chmod]", "chmod", DLG_CENTER);
x_set_dialog_title (ch_dlg, _("Chmod command")); x_set_dialog_title (ch_dlg, _("Chmod command"));
#define XTRACT(i) BY+chmod_but[i].y-single_set, BX+chmod_but[i].x, \ #define XTRACT(i) BY+chmod_but[i].y-single_set, BX+chmod_but[i].x, \
@ -347,7 +347,7 @@ void chmod_cmd (void)
destroy_dlg (ch_dlg); destroy_dlg (ch_dlg);
break; break;
} }
c_stat = sf_stat.st_mode; c_stat = sf_stat.st_mode;
mode_change = 0; /* clear changes flag */ mode_change = 0; /* clear changes flag */
@ -369,9 +369,9 @@ void chmod_cmd (void)
statl = label_new (FY+4, FX+2, buffer, NULL); statl = label_new (FY+4, FX+2, buffer, NULL);
add_widget (ch_dlg, statl); add_widget (ch_dlg, statl);
tk_end_frame (); tk_end_frame ();
run_dlg (ch_dlg); /* retrieve an action */ run_dlg (ch_dlg); /* retrieve an action */
/* do action */ /* do action */
switch (ch_dlg->ret_value){ switch (ch_dlg->ret_value){
case B_ENTER: case B_ENTER:
@ -381,11 +381,11 @@ void chmod_cmd (void)
fname, unix_error_string (errno)); fname, unix_error_string (errno));
need_update = 1; need_update = 1;
break; break;
case B_CANCEL: case B_CANCEL:
end_chmod = 1; end_chmod = 1;
break; break;
case B_ALL: case B_ALL:
case B_MARKED: case B_MARKED:
and_mask = or_mask = 0; and_mask = or_mask = 0;
@ -401,7 +401,7 @@ void chmod_cmd (void)
apply_mask (&sf_stat); apply_mask (&sf_stat);
break; break;
case B_SETMRK: case B_SETMRK:
and_mask = or_mask = 0; and_mask = or_mask = 0;
and_mask = ~and_mask; and_mask = ~and_mask;

View file

@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <config.h> #include <config.h>
@ -85,7 +85,7 @@ static struct {
{ B_SETALL, NORMAL_BUTTON, 0, 3, N_("Set &all") }, { B_SETALL, NORMAL_BUTTON, 0, 3, N_("Set &all") },
}; };
#define LABELS 5 #define LABELS 5
static struct { static struct {
int y, x; int y, x;
WLabel *l; WLabel *l;
@ -119,7 +119,7 @@ static void chown_refresh (void)
addstr (N_(" Size ")); addstr (N_(" Size "));
dlg_move (ch_dlg, TY + 9, TX + 1); dlg_move (ch_dlg, TY + 9, TX + 1);
addstr (N_(" Permission ")); addstr (N_(" Permission "));
attrset (COLOR_HOT_NORMAL); attrset (COLOR_HOT_NORMAL);
dlg_move (ch_dlg, 1, 28); dlg_move (ch_dlg, 1, 28);
addstr (N_(" Chown command ")); addstr (N_(" Chown command "));
@ -165,7 +165,7 @@ static void init_chown (void)
do_refresh (); do_refresh ();
end_chown = need_update = current_file = 0; end_chown = need_update = current_file = 0;
single_set = (cpanel->marked < 2) ? 3 : 0; single_set = (cpanel->marked < 2) ? 3 : 0;
ch_dlg = create_dlg (0, 0, 18, 74, dialog_colors, chown_callback, ch_dlg = create_dlg (0, 0, 18, 74, dialog_colors, chown_callback,
"[Chown]", "chown", DLG_CENTER); "[Chown]", "chown", DLG_CENTER);
@ -196,13 +196,13 @@ static void init_chown (void)
listbox_add_item (l_user, 0, 0, l_pass->pw_name, NULL); listbox_add_item (l_user, 0, 0, l_pass->pw_name, NULL);
} }
endpwent (); endpwent ();
setgrent (); /* get and put group names in the listbox */ setgrent (); /* get and put group names in the listbox */
while ((l_grp = getgrent ())) { while ((l_grp = getgrent ())) {
listbox_add_item (l_group, 0, 0, l_grp->gr_name, NULL); listbox_add_item (l_group, 0, 0, l_grp->gr_name, NULL);
} }
endgrent (); endgrent ();
tk_new_frame (ch_dlg, "f."); tk_new_frame (ch_dlg, "f.");
add_widget (ch_dlg, l_group); add_widget (ch_dlg, l_group);
tk_new_frame (ch_dlg, "g."); tk_new_frame (ch_dlg, "g.");
@ -229,13 +229,13 @@ static inline void do_chown (uid_t u, gid_t g)
static void apply_chowns (uid_t u, gid_t g) static void apply_chowns (uid_t u, gid_t g)
{ {
char *fname; char *fname;
need_update = end_chown = 1; need_update = end_chown = 1;
do_chown (u,g); do_chown (u,g);
do { do {
fname = next_file (); fname = next_file ();
do_chown (u,g); do_chown (u,g);
} while (cpanel->marked); } while (cpanel->marked);
} }
@ -271,17 +271,17 @@ void chown_cmd (void)
fname = next_file (); /* next marked file */ fname = next_file (); /* next marked file */
else else
fname = selection (cpanel)->fname; /* single file */ fname = selection (cpanel)->fname; /* single file */
if (!stat_file (fname, &sf_stat)){ /* get status of file */ if (!stat_file (fname, &sf_stat)){ /* get status of file */
destroy_dlg (ch_dlg); destroy_dlg (ch_dlg);
break; break;
} }
/* select in listboxes */ /* select in listboxes */
fe = listbox_search_text (l_user, get_owner(sf_stat.st_uid)); fe = listbox_search_text (l_user, get_owner(sf_stat.st_uid));
if (fe) if (fe)
listbox_select_entry (l_user, fe); listbox_select_entry (l_user, fe);
fe = listbox_search_text (l_group, get_group(sf_stat.st_gid)); fe = listbox_search_text (l_group, get_group(sf_stat.st_gid));
if (fe) if (fe)
listbox_select_entry (l_group, fe); listbox_select_entry (l_group, fe);
@ -294,12 +294,12 @@ void chown_cmd (void)
chown_label (4, string_perm (sf_stat.st_mode)); chown_label (4, string_perm (sf_stat.st_mode));
run_dlg (ch_dlg); run_dlg (ch_dlg);
switch (ch_dlg->ret_value) { switch (ch_dlg->ret_value) {
case B_CANCEL: case B_CANCEL:
end_chown = 1; end_chown = 1;
break; break;
case B_SETUSR: case B_SETUSR:
{ {
struct passwd *user; struct passwd *user;
@ -310,7 +310,7 @@ void chown_cmd (void)
apply_chowns (new_user, new_group); apply_chowns (new_user, new_group);
} }
break; break;
} }
case B_SETGRP: case B_SETGRP:
{ {
struct group *grp; struct group *grp;
@ -327,7 +327,7 @@ void chown_cmd (void)
{ {
struct group *grp; struct group *grp;
struct passwd *user; struct passwd *user;
grp = getgrnam (l_group->current->text); grp = getgrnam (l_group->current->text);
if (grp) if (grp)
new_group = grp->gr_gid; new_group = grp->gr_gid;
@ -344,13 +344,13 @@ void chown_cmd (void)
break; break;
} }
} }
if (cpanel->marked && ch_dlg->ret_value != B_CANCEL){ if (cpanel->marked && ch_dlg->ret_value != B_CANCEL){
do_file_mark (cpanel, current_file, 0); do_file_mark (cpanel, current_file, 0);
need_update = 1; need_update = 1;
} }
destroy_dlg (ch_dlg); destroy_dlg (ch_dlg);
} while (cpanel->marked && !end_chown); } while (cpanel->marked && !end_chown);
chown_done (); chown_done ();
} }

View file

@ -1,14 +1,14 @@
/* Routines invoked by a function key /* Routines invoked by a function key
They normally operate on the current panel. They normally operate on the current panel.
Copyright (C) 1994, 1995 Miguel de Icaza Copyright (C) 1994, 1995 Miguel de Icaza
Copyright (C) 1994, 1995 Janne Kukonlehto Copyright (C) 1994, 1995 Janne Kukonlehto
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -151,7 +151,7 @@ int view_file_at_line (char *filename, int plain_view, int internal, int start_l
int changed_hex_mode = 0; int changed_hex_mode = 0;
int changed_nroff_flag = 0; int changed_nroff_flag = 0;
int changed_magic_flag = 0; int changed_magic_flag = 0;
altered_hex_mode = 0; altered_hex_mode = 0;
altered_nroff_flag = 0; altered_nroff_flag = 0;
altered_magic_flag = 0; altered_magic_flag = 0;
@ -181,14 +181,14 @@ int view_file_at_line (char *filename, int plain_view, int internal, int start_l
sprintf (view_entry, "View:%d", start_line); sprintf (view_entry, "View:%d", start_line);
else else
strcpy (view_entry, "View"); strcpy (view_entry, "View");
if (!regex_command (filename, view_entry, NULL, &move_dir)){ if (!regex_command (filename, view_entry, NULL, &move_dir)){
view (0, filename, &move_dir, start_line); view (0, filename, &move_dir, start_line);
repaint_screen (); repaint_screen ();
} }
} else { } else {
char *localcopy; char *localcopy;
if (!viewer){ if (!viewer){
viewer = getenv ("PAGER"); viewer = getenv ("PAGER");
if (!viewer) if (!viewer)
@ -203,7 +203,7 @@ int view_file_at_line (char *filename, int plain_view, int internal, int start_l
} }
execute_internal (viewer, localcopy); execute_internal (viewer, localcopy);
mc_ungetlocalcopy (filename, localcopy, 0); mc_ungetlocalcopy (filename, localcopy, 0);
} else } else
execute_internal (viewer, filename); execute_internal (viewer, filename);
} }
return move_dir; return move_dir;
@ -243,7 +243,7 @@ static void do_view_cmd (WPanel *panel, int normal)
{ {
int dir, file_idx; int dir, file_idx;
panel = get_a_panel (panel); panel = get_a_panel (panel);
/* Directories are viewed by changing to them */ /* Directories are viewed by changing to them */
if (S_ISDIR (selection (panel)->buf.st_mode) || if (S_ISDIR (selection (panel)->buf.st_mode) ||
link_isdir (selection (panel))){ link_isdir (selection (panel))){
@ -255,7 +255,7 @@ static void do_view_cmd (WPanel *panel, int normal)
} }
do_cd (selection (panel)->fname, cd_exact); do_cd (selection (panel)->fname, cd_exact);
return; return;
} }
file_idx = panel->selected; file_idx = panel->selected;
@ -369,10 +369,10 @@ void copymove_cmd_with_default (int copy, char *thedefault)
void mkdir_cmd (WPanel *panel) void mkdir_cmd (WPanel *panel)
{ {
char *dir; char *dir;
panel = get_a_panel (panel); panel = get_a_panel (panel);
dir = input_expand_dialog (_(" Mkdir "), _(" Enter directory name:") , ""); dir = input_expand_dialog (_(" Mkdir "), _(" Enter directory name:") , "");
if (!dir) if (!dir)
return; return;
@ -423,9 +423,9 @@ void set_panel_filter (WPanel *p)
{ {
char *reg_exp; char *reg_exp;
char *x; char *x;
x = p->filter ? p->filter : easy_patterns ? "*" : "."; x = p->filter ? p->filter : easy_patterns ? "*" : ".";
reg_exp = input_dialog (_(" Filter "), _(" Set expression for filtering filenames"), x); reg_exp = input_dialog (_(" Filter "), _(" Set expression for filtering filenames"), x);
if (!reg_exp) if (!reg_exp)
return; return;
@ -454,7 +454,7 @@ void reread_cmd (void)
flag = strcmp (cpanel->cwd, opanel->cwd) ? UP_ONLY_CURRENT : 0; flag = strcmp (cpanel->cwd, opanel->cwd) ? UP_ONLY_CURRENT : 0;
else else
flag = UP_ONLY_CURRENT; flag = UP_ONLY_CURRENT;
update_panels (UP_RELOAD|flag, UP_KEEPSEL); update_panels (UP_RELOAD|flag, UP_KEEPSEL);
repaint_screen (); repaint_screen ();
} }
@ -513,7 +513,7 @@ void select_cmd_panel (WPanel *panel)
reg_exp = input_dialog (_(" Select "), "", easy_patterns ? "*" : "."); reg_exp = input_dialog (_(" Select "), "", easy_patterns ? "*" : ".");
if (!reg_exp) if (!reg_exp)
return; return;
reg_exp_t = reg_exp; reg_exp_t = reg_exp;
/* Check if they specified a directory */ /* Check if they specified a directory */
@ -565,9 +565,9 @@ void unselect_cmd_panel (WPanel *panel)
reg_exp = input_dialog (_(" Unselect "),"", easy_patterns ? "*" : "."); reg_exp = input_dialog (_(" Unselect "),"", easy_patterns ? "*" : ".");
if (!reg_exp) if (!reg_exp)
return; return;
reg_exp_t = reg_exp; reg_exp_t = reg_exp;
/* Check if they specified directory matching */ /* Check if they specified directory matching */
if (*reg_exp_t == PATH_SEP){ if (*reg_exp_t == PATH_SEP){
dirflag = 1; dirflag = 1;
@ -578,7 +578,7 @@ void unselect_cmd_panel (WPanel *panel)
reg_exp_t [strlen(reg_exp_t) - 1] = 0; reg_exp_t [strlen(reg_exp_t) - 1] = 0;
} }
for (i = 0; i < panel->count; i++){ for (i = 0; i < panel->count; i++){
if (!strcmp (panel->dir.list [i].fname, "..")) if (!strcmp (panel->dir.list [i].fname, ".."))
continue; continue;
if (S_ISDIR (panel->dir.list [i].buf.st_mode)){ if (S_ISDIR (panel->dir.list [i].buf.st_mode)){
if (!dirflag) if (!dirflag)
@ -654,10 +654,10 @@ void menu_edit_cmd (void)
char *buffer; char *buffer;
char *menufile; char *menufile;
int dir = 0; int dir = 0;
dir = query_dialog ( dir = query_dialog (
_("Menu file edit"), _("Menu file edit"),
_(" Which menu file will you edit? "), _(" Which menu file will you edit? "),
0, geteuid() ? 2 : 3, 0, geteuid() ? 2 : 3,
_("&Local"), _("&Home"), _("&System Wide") _("&Local"), _("&Home"), _("&System Wide")
); );
@ -674,7 +674,7 @@ void menu_edit_cmd (void)
buffer = concat_dir_and_file (home_dir, MC_HOME_MENU); buffer = concat_dir_and_file (home_dir, MC_HOME_MENU);
check_for_default (menufile, buffer); check_for_default (menufile, buffer);
break; break;
case 2: case 2:
buffer = concat_dir_and_file (mc_home, MC_GLOBAL_MENU); buffer = concat_dir_and_file (mc_home, MC_GLOBAL_MENU);
break; break;
@ -771,12 +771,12 @@ compare_dir (WPanel *panel, WPanel *other, enum CompareMode mode)
char *src_name, *dst_name; char *src_name, *dst_name;
panel = get_a_panel (panel); panel = get_a_panel (panel);
/* No marks by default */ /* No marks by default */
panel->marked = 0; panel->marked = 0;
panel->total = 0; panel->total = 0;
panel->dirs_marked = 0; panel->dirs_marked = 0;
/* Handle all files in the panel */ /* Handle all files in the panel */
for (i = 0; i < panel->count; i++){ for (i = 0; i < panel->count; i++){
file_entry *source = &panel->dir.list[i]; file_entry *source = &panel->dir.list[i];
@ -806,16 +806,16 @@ compare_dir (WPanel *panel, WPanel *other, enum CompareMode mode)
if (source->buf.st_mtime < target->buf.st_mtime) if (source->buf.st_mtime < target->buf.st_mtime)
continue; continue;
} }
/* Newer version with different size is marked */ /* Newer version with different size is marked */
if (source->buf.st_size != target->buf.st_size){ if (source->buf.st_size != target->buf.st_size){
do_file_mark (panel, i, 1); do_file_mark (panel, i, 1);
continue; continue;
} }
if (mode == compare_size_only) if (mode == compare_size_only)
continue; continue;
if (mode == compare_quick){ if (mode == compare_quick){
/* Thorough compare off, compare only time stamps */ /* Thorough compare off, compare only time stamps */
/* Mark newer version, don't mark version with the same date */ /* Mark newer version, don't mark version with the same date */
@ -963,12 +963,12 @@ view_other_cmd (void)
reset_prog_mode (); reset_prog_mode ();
keypad(stdscr, TRUE); keypad(stdscr, TRUE);
#ifndef HAVE_X #ifndef HAVE_X
if (use_mouse_p) if (use_mouse_p)
init_mouse (); init_mouse ();
if (alternate_plus_minus) if (alternate_plus_minus)
application_keypad_mode (); application_keypad_mode ();
#endif #endif
#ifdef HAVE_SUBSHELL_SUPPORT #ifdef HAVE_SUBSHELL_SUPPORT
if (use_subshell){ if (use_subshell){
@ -1008,9 +1008,9 @@ do_link (int symbolic_link, char *fname)
if (!S_ISREG (s.st_mode)) if (!S_ISREG (s.st_mode))
return; return;
} }
if (!symbolic_link){ if (!symbolic_link){
src = copy_strings (_(" Link "), name_trunc (fname, 46), src = copy_strings (_(" Link "), name_trunc (fname, 46),
_(" to:"), NULL); _(" to:"), NULL);
dest = input_expand_dialog (_(" Link "), src, ""); dest = input_expand_dialog (_(" Link "), src, "");
free (src); free (src);
@ -1030,7 +1030,7 @@ do_link (int symbolic_link, char *fname)
/* suggest the full path for symlink */ /* suggest the full path for symlink */
char s[MC_MAXPATHLEN]; char s[MC_MAXPATHLEN];
char d[MC_MAXPATHLEN]; char d[MC_MAXPATHLEN];
strcpy(s, cpanel->cwd); strcpy(s, cpanel->cwd);
if ( ! ((s[0] == '/') && (s[1] == 0))) if ( ! ((s[0] == '/') && (s[1] == 0)))
strcat(s, "/"); strcat(s, "/");
@ -1039,7 +1039,7 @@ do_link (int symbolic_link, char *fname)
strcpy(d, opanel->cwd); strcpy(d, opanel->cwd);
else else
strcpy (d,""); strcpy (d,"");
if ( ! ((d[0] == '/') && (d[1] == 0))) if ( ! ((d[0] == '/') && (d[1] == 0)))
strcat(d, "/"); strcat(d, "/");
symlink_dialog (s, d, &dest, &src); symlink_dialog (s, d, &dest, &src);
@ -1082,7 +1082,7 @@ void edit_symlink_cmd (void)
char buffer [MC_MAXPATHLEN], *p = selection (cpanel)->fname; char buffer [MC_MAXPATHLEN], *p = selection (cpanel)->fname;
int i; int i;
char *dest, *q = copy_strings (_(" Symlink "), name_trunc (p, 32), _(" points to:"), NULL); char *dest, *q = copy_strings (_(" Symlink "), name_trunc (p, 32), _(" points to:"), NULL);
i = readlink (p, buffer, MC_MAXPATHLEN); i = readlink (p, buffer, MC_MAXPATHLEN);
if (i > 0) { if (i > 0) {
buffer [i] = 0; buffer [i] = 0;
@ -1115,7 +1115,7 @@ void other_symlink_cmd (void)
return; return;
p = concat_dir_and_file (cpanel->cwd, selection (cpanel)->fname); p = concat_dir_and_file (cpanel->cwd, selection (cpanel)->fname);
r = concat_dir_and_file (opanel->cwd, selection (cpanel)->fname); r = concat_dir_and_file (opanel->cwd, selection (cpanel)->fname);
q = copy_strings (_(" Link symbolically "), name_trunc (p, 32), _(" to:"), NULL); q = copy_strings (_(" Link symbolically "), name_trunc (p, 32), _(" to:"), NULL);
dest = input_expand_dialog (_(" Relative symlink "), q, r); dest = input_expand_dialog (_(" Relative symlink "), q, r);
if (dest) { if (dest) {
@ -1173,7 +1173,7 @@ char *get_random_hint (void)
char *hintfile; char *hintfile;
int len; int len;
int start; int start;
/* Do not change hints more often than one minute */ /* Do not change hints more often than one minute */
#ifdef SCO_FLAVOR #ifdef SCO_FLAVOR
@ -1187,10 +1187,10 @@ char *get_random_hint (void)
#else #else
static int last_sec; static int last_sec;
static struct timeval tv; static struct timeval tv;
gettimeofday (&tv, NULL); gettimeofday (&tv, NULL);
if (!(tv.tv_sec> last_sec+60)) if (!(tv.tv_sec> last_sec+60))
return strdup (""); return strdup ("");
last_sec = tv.tv_sec; last_sec = tv.tv_sec;
#endif #endif
@ -1208,7 +1208,7 @@ char *get_random_hint (void)
/* get a random entry */ /* get a random entry */
len = strlen (data); len = strlen (data);
start = rand () % len; start = rand () % len;
for (;start; start--){ for (;start; start--){
if (data [start] == '\n'){ if (data [start] == '\n'){
start++; start++;
@ -1249,9 +1249,9 @@ static void nice_cd (char *text, char *xtext, char *help, char *prefix, int to_h
if (strncmp (prefix, machine, strlen (prefix)) == 0) if (strncmp (prefix, machine, strlen (prefix)) == 0)
cd_path = copy_strings (machine, to_home ? "/~/" : NULL, NULL); cd_path = copy_strings (machine, to_home ? "/~/" : NULL, NULL);
else else
cd_path = copy_strings (prefix, machine, to_home ? "/~/" : NULL, NULL); cd_path = copy_strings (prefix, machine, to_home ? "/~/" : NULL, NULL);
if (do_panel_cd (MENU_PANEL, cd_path, 0)) if (do_panel_cd (MENU_PANEL, cd_path, 0))
directory_history_add (MENU_PANEL, (MENU_PANEL)->cwd); directory_history_add (MENU_PANEL, (MENU_PANEL)->cwd);
else else
@ -1277,7 +1277,7 @@ void source_routing (void)
{ {
char *source; char *source;
struct hostent *hp; struct hostent *hp;
source = input_dialog (_(" Socket source routing setup "), source = input_dialog (_(" Socket source routing setup "),
_(" Enter host name to use as a source routing hop: ")n, _(" Enter host name to use as a source routing hop: ")n,
""); "");
@ -1310,7 +1310,7 @@ void quick_cd_cmd (void)
if (p && *p) { if (p && *p) {
char *q = copy_strings ("cd ", p, NULL); char *q = copy_strings ("cd ", p, NULL);
do_cd_command (q); do_cd_command (q);
free (q); free (q);
} }
@ -1350,7 +1350,7 @@ void dirsizes_cmd (void)
strcpy (cmd, dirsizes_command); strcpy (cmd, dirsizes_command);
p = strchr (cmd, 0); p = strchr (cmd, 0);
for (i = 0; i < panel->count; i++) for (i = 0; i < panel->count; i++)
if (S_ISDIR (panel->dir.list [i].buf.st_mode) && if (S_ISDIR (panel->dir.list [i].buf.st_mode) &&
strcmp (panel->dir.list [i].fname, "..")) { strcmp (panel->dir.list [i].fname, "..")) {
strcpy (p, panel->dir.list [i].fname); strcpy (p, panel->dir.list [i].fname);
p = strchr (p, 0); p = strchr (p, 0);
@ -1361,8 +1361,8 @@ void dirsizes_cmd (void)
f = popen (cmd, "r"); f = popen (cmd, "r");
free (cmd); free (cmd);
if (f != NULL) { if (f != NULL) {
/* Assume that du will display the directories in the order /* Assume that du will display the directories in the order
* I've passed to it :( * I've passed to it :(
*/ */
i = 0; i = 0;
p = xmalloc (1024, "dirsizes_cmd"); p = xmalloc (1024, "dirsizes_cmd");
@ -1379,8 +1379,8 @@ void dirsizes_cmd (void)
if (!strncmp (q, panel->dir.list [i].fname, if (!strncmp (q, panel->dir.list [i].fname,
r - q)) { r - q)) {
if (panel->dir.list [i].f.marked) if (panel->dir.list [i].f.marked)
panel->total += j - panel->total += j -
((panel->has_dir_sizes) ? panel->dir.list [i].buf.st_size : 0); ((panel->has_dir_sizes) ? panel->dir.list [i].buf.st_size : 0);
panel->dir.list [i].buf.st_size = j; panel->dir.list [i].buf.st_size = j;
break; break;
} }
@ -1393,7 +1393,7 @@ void dirsizes_cmd (void)
message (0, _("Show directory sizes"), _("Pipe close failed")); message (0, _("Show directory sizes"), _("Pipe close failed"));
else else
#else /* SCO_FLAVOR */ #else /* SCO_FLAVOR */
/* /*
** SCO reports about error while all seems to be ok. Just ignore it... ** SCO reports about error while all seems to be ok. Just ignore it...
** (alex@bcs.zaporizhzhe.ua) ** (alex@bcs.zaporizhzhe.ua)
*/ */
@ -1411,11 +1411,11 @@ void
save_setup_cmd (void) save_setup_cmd (void)
{ {
char *str; char *str;
save_setup (); save_setup ();
sync_profiles (); sync_profiles ();
str = copy_strings ( _(" Setup saved to ~/"), PROFILE_NAME, NULL); str = copy_strings ( _(" Setup saved to ~/"), PROFILE_NAME, NULL);
#ifdef HAVE_GNOME #ifdef HAVE_GNOME
set_hintbar (str); set_hintbar (str);
#else #else
@ -1428,25 +1428,25 @@ void
configure_panel_listing (WPanel *p, int view_type, int use_msformat, char *user, char *status) configure_panel_listing (WPanel *p, int view_type, int use_msformat, char *user, char *status)
{ {
int err; int err;
p->user_mini_status = use_msformat; p->user_mini_status = use_msformat;
p->list_type = view_type; p->list_type = view_type;
if (view_type == list_user || use_msformat){ if (view_type == list_user || use_msformat){
free (p->user_format); free (p->user_format);
p->user_format = user; p->user_format = user;
free (p->user_status_format [view_type]); free (p->user_status_format [view_type]);
p->user_status_format [view_type] = status; p->user_status_format [view_type] = status;
err = set_panel_formats (p); err = set_panel_formats (p);
if (err){ if (err){
if (err & 0x01){ if (err & 0x01){
free (p->user_format); free (p->user_format);
p->user_format = strdup (DEFAULT_USER_FORMAT); p->user_format = strdup (DEFAULT_USER_FORMAT);
} }
if (err & 0x02){ if (err & 0x02){
free (p->user_status_format [view_type]); free (p->user_status_format [view_type]);
p->user_status_format [view_type] = strdup (DEFAULT_USER_FORMAT); p->user_status_format [view_type] = strdup (DEFAULT_USER_FORMAT);
@ -1460,7 +1460,7 @@ configure_panel_listing (WPanel *p, int view_type, int use_msformat, char *user,
set_panel_formats (p); set_panel_formats (p);
paint_panel (p); paint_panel (p);
do_refresh (); do_refresh ();
} }
@ -1541,7 +1541,7 @@ set_basic_panel_listing_to (int panel_index, int listing_mode)
p->list_type = listing_mode; p->list_type = listing_mode;
if (set_panel_formats (p)) if (set_panel_formats (p))
return 0; return 0;
paint_panel (p); paint_panel (p);
do_refresh (); do_refresh ();
return 1; return 1;
@ -1554,7 +1554,7 @@ toggle_listing_cmd (void)
WPanel *p = (WPanel *) get_panel_widget (current); WPanel *p = (WPanel *) get_panel_widget (current);
int list_mode = p->list_type; int list_mode = p->list_type;
int m; int m;
switch (list_mode){ switch (list_mode){
case list_full: case list_full:
case list_brief: case list_brief:

View file

@ -5,7 +5,7 @@ void ftplink_cmd (void);
void undelete_cmd (void); void undelete_cmd (void);
void help_cmd (void); void help_cmd (void);
void dirsizes_cmd (void); void dirsizes_cmd (void);
int view_file_at_line (char *filename, int plain_view, int internal, int view_file_at_line (char *filename, int plain_view, int internal,
int start_line); int start_line);
int view_file (char *filename, int normal, int internal); int view_file (char *filename, int normal, int internal);
void view_cmd (WPanel *panel); void view_cmd (WPanel *panel);

View file

@ -1,11 +1,11 @@
/* Color setup /* Color setup
Copyright (C) 1994 Miguel de Icaza. Copyright (C) 1994 Miguel de Icaza.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -25,7 +25,7 @@
#include "color.h" #include "color.h"
#include "x.h" #include "x.h"
/* "$Id: color.c,v 1.1 2001/12/30 09:55:26 sedwards Exp $" */ /* "$Id$" */
/* To avoid excessive calls to ncurses' has_colors () */ /* To avoid excessive calls to ncurses' has_colors () */
int hascolors = 0; int hascolors = 0;
@ -80,21 +80,21 @@ struct colorpair color_map [] = {
{ "dfocus=", 0, 0 }, /* Dialog focused */ { "dfocus=", 0, 0 }, /* Dialog focused */
{ "dhotnormal=", 0, 0 }, /* Dialog normal/hot */ { "dhotnormal=", 0, 0 }, /* Dialog normal/hot */
{ "dhotfocus=", 0, 0 }, /* Dialog focused/hot */ { "dhotfocus=", 0, 0 }, /* Dialog focused/hot */
{ "viewunderline=", 0, 0 }, /* _\b? sequence in view */ { "viewunderline=", 0, 0 }, /* _\b? sequence in view */
{ "menusel=", 0, 0 }, /* Menu selected color */ { "menusel=", 0, 0 }, /* Menu selected color */
{ "menuhot=", 0, 0 }, /* Color for menu hotkeys */ { "menuhot=", 0, 0 }, /* Color for menu hotkeys */
{ "menuhotsel=", 0, 0 }, /* Menu hotkeys/selected entry */ { "menuhotsel=", 0, 0 }, /* Menu hotkeys/selected entry */
{ "helpnormal=", 0, 0 }, /* Help normal */ { "helpnormal=", 0, 0 }, /* Help normal */
{ "helpitalic=", 0, 0 }, /* Italic in help */ { "helpitalic=", 0, 0 }, /* Italic in help */
{ "helpbold=", 0, 0 }, /* Bold in help */ { "helpbold=", 0, 0 }, /* Bold in help */
{ "helplink=", 0, 0 }, /* Not selected hyperlink */ { "helplink=", 0, 0 }, /* Not selected hyperlink */
{ "helpslink=", 0, 0 }, /* Selected hyperlink */ { "helpslink=", 0, 0 }, /* Selected hyperlink */
{ "gauge=", 0, 0 }, /* Color of the progress bar (percentage) */ { "gauge=", 0, 0 }, /* Color of the progress bar (percentage) */
{ "input=", 0, 0 }, { "input=", 0, 0 },
/* Per file types colors */ /* Per file types colors */
{ "directory=", 0, 0 }, { "directory=", 0, 0 },
{ "execute=", 0, 0 }, { "execute=", 0, 0 },
@ -143,7 +143,7 @@ void get_color (char *cpp, CTYPE *colp);
static void get_color (char *cpp, CTYPE *colp) static void get_color (char *cpp, CTYPE *colp)
{ {
int i; int i;
for (i = 0; i < ELEMENTS(color_table); i++){ for (i = 0; i < ELEMENTS(color_table); i++){
if (strcmp (cpp, color_name (i)) == 0){ if (strcmp (cpp, color_name (i)) == 0){
*colp = color_value (i); *colp = color_value (i);
@ -159,7 +159,7 @@ static void get_two_colors (char **cpp, struct colorpair *colorpairp)
int state; int state;
state = 0; state = 0;
for (; *p; p++){ for (; *p; p++){
if (*p == ':'){ if (*p == ':'){
*p = 0; *p = 0;
@ -219,7 +219,7 @@ static void configure_colors (void)
#ifndef HAVE_TK #ifndef HAVE_TK
#ifndef HAVE_XVIEW #ifndef HAVE_XVIEW
extern char *default_edition_colors; extern char *default_edition_colors;
configure_colors_string (default_edition_colors); configure_colors_string (default_edition_colors);
#endif #endif
#endif #endif
@ -248,7 +248,7 @@ void
init_colors (void) init_colors (void)
{ {
int i; int i;
use_colors = 1; use_colors = 1;
start_color (); start_color ();
configure_colors (); configure_colors ();
@ -260,7 +260,7 @@ init_colors (void)
void init_colors (void) void init_colors (void)
{ {
int i; int i;
hascolors = has_colors (); hascolors = has_colors ();
if (!disable_colors && hascolors){ if (!disable_colors && hascolors){
@ -284,14 +284,14 @@ void init_colors (void)
if (use_colors) { /* Hack to make COLOR_PAIR(31) be the default fg/bg if (use_colors) { /* Hack to make COLOR_PAIR(31) be the default fg/bg
of the terminal */ of the terminal */
char *Norm_Vid = SLtt_tgetstr ("me"); char *Norm_Vid = SLtt_tgetstr ("me");
if (Norm_Vid == NULL) if (Norm_Vid == NULL)
Norm_Vid = SLtt_tgetstr ("se"); Norm_Vid = SLtt_tgetstr ("se");
if (Norm_Vid == NULL) if (Norm_Vid == NULL)
Norm_Vid = "\033[0m"; Norm_Vid = "\033[0m";
SLtt_set_color_esc (31, Norm_Vid); SLtt_set_color_esc (31, Norm_Vid);
} }
#endif #endif
for (i = 0; i < ELEMENTS (color_map); i++){ for (i = 0; i < ELEMENTS (color_map); i++){
init_pair (i+1, color_map_fg(i), color_map_bg(i)); init_pair (i+1, color_map_fg(i), color_map_bg(i));

View file

@ -57,18 +57,18 @@ extern int attr_pairs [];
#define HELP_BOLD_COLOR (PORT_COLOR (MY_COLOR_PAIR(18),A_REVERSE)) #define HELP_BOLD_COLOR (PORT_COLOR (MY_COLOR_PAIR(18),A_REVERSE))
#define HELP_LINK_COLOR (PORT_COLOR (MY_COLOR_PAIR(19),0)) #define HELP_LINK_COLOR (PORT_COLOR (MY_COLOR_PAIR(19),0))
#define HELP_SLINK_COLOR (PORT_COLOR (MY_COLOR_PAIR(20),A_BOLD)) #define HELP_SLINK_COLOR (PORT_COLOR (MY_COLOR_PAIR(20),A_BOLD))
extern int sel_mark_color [4]; extern int sel_mark_color [4];
extern int dialog_colors [4]; extern int dialog_colors [4];
#define COLOR_NORMAL (PORT_COLOR (MY_COLOR_PAIR (8),A_REVERSE)) #define COLOR_NORMAL (PORT_COLOR (MY_COLOR_PAIR (8),A_REVERSE))
#define COLOR_FOCUS (PORT_COLOR (MY_COLOR_PAIR (9),A_BOLD)) #define COLOR_FOCUS (PORT_COLOR (MY_COLOR_PAIR (9),A_BOLD))
#define COLOR_HOT_NORMAL (PORT_COLOR (MY_COLOR_PAIR (10),0)) #define COLOR_HOT_NORMAL (PORT_COLOR (MY_COLOR_PAIR (10),0))
#define COLOR_HOT_FOCUS (PORT_COLOR (MY_COLOR_PAIR (11),0)) #define COLOR_HOT_FOCUS (PORT_COLOR (MY_COLOR_PAIR (11),0))
/* Add this to color panel, on BW all pairs are normal */ /* Add this to color panel, on BW all pairs are normal */
#define STALLED_COLOR (PORT_COLOR (MY_COLOR_PAIR (12),0)) #define STALLED_COLOR (PORT_COLOR (MY_COLOR_PAIR (12),0))
#define DIRECTORY_COLOR (PORT_COLOR (MY_COLOR_PAIR (23),0)) #define DIRECTORY_COLOR (PORT_COLOR (MY_COLOR_PAIR (23),0))
#define EXECUTABLE_COLOR (PORT_COLOR (MY_COLOR_PAIR (24),0)) #define EXECUTABLE_COLOR (PORT_COLOR (MY_COLOR_PAIR (24),0))
#define LINK_COLOR (PORT_COLOR (MY_COLOR_PAIR (25),0)) #define LINK_COLOR (PORT_COLOR (MY_COLOR_PAIR (25),0))

View file

@ -55,7 +55,7 @@ ${var:-value}, etc. Use the eval cd 'path' command instead.
Bugs: No quoting occurrs here, so ${VAR} and $VAR will be always Bugs: No quoting occurrs here, so ${VAR} and $VAR will be always
substituted. I think we can encourage users to use in such extreme substituted. I think we can encourage users to use in such extreme
cases instead of >cd path< command a >eval cd 'path'< command, which works cases instead of >cd path< command a >eval cd 'path'< command, which works
as they might expect :) as they might expect :)
FIXME: Perhaps we should do wildcard matching as well? */ FIXME: Perhaps we should do wildcard matching as well? */
static int examine_cd (char *path) static int examine_cd (char *path)
{ {
@ -99,7 +99,7 @@ static int examine_cd (char *path)
} }
} }
*r = 0; *r = 0;
result = do_cd (q, cd_parse_command); result = do_cd (q, cd_parse_command);
/* CDPATH handling */ /* CDPATH handling */
@ -143,7 +143,7 @@ void do_cd_command (char *cmd)
cmd [len] = 0; cmd [len] = 0;
len --; len --;
} }
if (cmd [2] == 0) if (cmd [2] == 0)
cmd = "cd "; cmd = "cd ";
@ -180,7 +180,7 @@ void do_cd_command (char *cmd)
static int enter (WCommand *cmdline) static int enter (WCommand *cmdline)
{ {
Dlg_head *old_dlg; Dlg_head *old_dlg;
if (command_prompt && strlen (input_w (cmdline)->buffer)){ if (command_prompt && strlen (input_w (cmdline)->buffer)){
char *cmd; char *cmd;
@ -203,7 +203,7 @@ static int enter (WCommand *cmdline)
new_input (input_w (cmdline)); new_input (input_w (cmdline));
return MSG_HANDLED; return MSG_HANDLED;
} }
#endif #endif
else { else {
char *command, *s; char *command, *s;
int i, j; int i, j;
@ -232,7 +232,7 @@ static int enter (WCommand *cmdline)
new_input (input_w (cmdline)); new_input (input_w (cmdline));
execute (command); execute (command);
free (command); free (command);
#ifdef HAVE_SUBSHELL_SUPPORT #ifdef HAVE_SUBSHELL_SUPPORT
if (quit & SUBSHELL_EXIT){ if (quit & SUBSHELL_EXIT){
quiet_quit_cmd (); quiet_quit_cmd ();
@ -277,7 +277,7 @@ WCommand *command_new (int y, int x, int cols)
cmd->old_callback = (callback_fn) cmd->input.widget.callback; cmd->old_callback = (callback_fn) cmd->input.widget.callback;
cmd->input.widget.callback = (int (*) (Dlg_head *, void *, int, int)) cmd->input.widget.callback = (int (*) (Dlg_head *, void *, int, int))
command_callback; command_callback;
cmd->input.completion_flags |= INPUT_COMPLETE_COMMANDS; cmd->input.completion_flags |= INPUT_COMPLETE_COMMANDS;
return cmd; return cmd;
} }

View file

@ -1,15 +1,15 @@
/* Input line filename/username/hostname/variable/command completion. /* Input line filename/username/hostname/variable/command completion.
(Let mc type for you...) (Let mc type for you...)
Copyright (C) 1995 The Free Software Foundation Copyright (C) 1995 The Free Software Foundation
Written by: 1995 Jakub Jelinek Written by: 1995 Jakub Jelinek
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -96,7 +96,7 @@ char *filename_completion_function (char *text, int state)
if (dirname) if (dirname)
free (dirname); free (dirname);
if (filename) if (filename)
free (filename); free (filename);
if (users_dirname) if (users_dirname)
free (users_dirname); free (users_dirname);
@ -161,7 +161,7 @@ char *filename_completion_function (char *text, int state)
{ {
char *tmp = xmalloc (3 + strlen (dirname) + NLENGTH (entry), "Filename completion"); char *tmp = xmalloc (3 + strlen (dirname) + NLENGTH (entry), "Filename completion");
struct stat tempstat; struct stat tempstat;
strcpy (tmp, dirname); strcpy (tmp, dirname);
strcat (tmp, PATH_SEP_STR); strcat (tmp, PATH_SEP_STR);
strcat (tmp, entry->d_name); strcat (tmp, entry->d_name);
@ -170,7 +170,7 @@ char *filename_completion_function (char *text, int state)
if (!stat (tmp, &tempstat)){ if (!stat (tmp, &tempstat)){
uid_t my_uid = getuid (); uid_t my_uid = getuid ();
gid_t my_gid = getgid (); gid_t my_gid = getgid ();
if (!S_ISDIR (tempstat.st_mode)){ if (!S_ISDIR (tempstat.st_mode)){
isdir = 0; isdir = 0;
if ((!my_uid && (tempstat.st_mode & 0111)) || if ((!my_uid && (tempstat.st_mode & 0111)) ||
@ -268,7 +268,7 @@ char *username_completion_function (char *text, int state)
return NULL; return NULL;
} else { } else {
char *temp = xmalloc (3 + strlen (entry->pw_name), "Username completion"); char *temp = xmalloc (3 + strlen (entry->pw_name), "Username completion");
*temp = '~'; *temp = '~';
strcpy (temp + 1, entry->pw_name); strcpy (temp + 1, entry->pw_name);
strcat (temp, PATH_SEP_STR); strcat (temp, PATH_SEP_STR);
@ -374,10 +374,10 @@ static void fetch_hosts (char *filename)
name [i - start] = 0; name [i - start] = 0;
{ {
char **host_p; char **host_p;
if (hosts_p - hosts >= hosts_alloclen){ if (hosts_p - hosts >= hosts_alloclen){
int j = hosts_p - hosts; int j = hosts_p - hosts;
hosts = realloc ((void *)hosts, ((hosts_alloclen += 30) + 1) * sizeof (char *)); hosts = realloc ((void *)hosts, ((hosts_alloclen += 30) + 1) * sizeof (char *));
hosts_p = hosts + j; hosts_p = hosts + j;
} }
@ -402,7 +402,7 @@ char *hostname_completion_function (char *text, int state)
if (!state){ /* Initialization stuff */ if (!state){ /* Initialization stuff */
char *p; char *p;
if (hosts != NULL){ if (hosts != NULL){
for (host_p = hosts; *host_p; host_p++) for (host_p = hosts; *host_p; host_p++)
free (*host_p); free (*host_p);
@ -416,7 +416,7 @@ char *hostname_completion_function (char *text, int state)
textstart = (*text == '@') ? 1 : 0; textstart = (*text == '@') ? 1 : 0;
textlen = strlen (text + textstart); textlen = strlen (text + textstart);
} }
while (*host_p){ while (*host_p){
if (!textlen) if (!textlen)
break; /* Match all of them */ break; /* Match all of them */
@ -424,7 +424,7 @@ char *hostname_completion_function (char *text, int state)
break; break;
host_p++; host_p++;
} }
if (!*host_p){ if (!*host_p){
for (host_p = hosts; *host_p; host_p++) for (host_p = hosts; *host_p; host_p++)
free (*host_p); free (*host_p);
@ -460,13 +460,13 @@ char *command_completion_function (char *text, int state)
"case", "esac", "for", "select", "while", "case", "esac", "for", "select", "while",
"until", "do", "done", "in", "function" , 0}; "until", "do", "done", "in", "function" , 0};
static char *bash_builtins [] = { "alias", "bg", "bind", "break", "builtin", static char *bash_builtins [] = { "alias", "bg", "bind", "break", "builtin",
"cd", "command", "continue", "declare", "cd", "command", "continue", "declare",
"dirs", "echo", "enable", "eval", "exec", "dirs", "echo", "enable", "eval", "exec",
"exit", "export", "fc", "fg", "getopts", "exit", "export", "fc", "fg", "getopts",
"hash", "help", "history", "jobs", "kill", "hash", "help", "history", "jobs", "kill",
"let", "local", "logout", "popd", "pushd", "let", "local", "logout", "popd", "pushd",
"pwd", "read", "readonly", "return", "set", "pwd", "read", "readonly", "return", "set",
"shift", "source", "suspend", "test", "shift", "source", "suspend", "test",
"times", "trap", "type", "typeset", "times", "trap", "type", "typeset",
"ulimit", "umask", "unalias", "unset", "ulimit", "umask", "unalias", "unset",
"wait" , 0}; "wait" , 0};
@ -494,7 +494,7 @@ char *command_completion_function (char *text, int state)
} }
} }
} }
if (isabsolute){ if (isabsolute){
p = filename_completion_function (text, state); p = filename_completion_function (text, state);
if (!p) if (!p)
@ -502,7 +502,7 @@ char *command_completion_function (char *text, int state)
return p; return p;
} }
found = NULL; found = NULL;
switch (phase){ switch (phase){
case 0: /* Reserved words */ case 0: /* Reserved words */
while (*words){ while (*words){
@ -527,7 +527,7 @@ char *command_completion_function (char *text, int state)
while (!found){ while (!found){
if (!cur_word){ if (!cur_word){
char *expanded; char *expanded;
if (!*cur_path) if (!*cur_path)
break; break;
expanded = tilde_expand (cur_path); expanded = tilde_expand (cur_path);
@ -553,7 +553,7 @@ char *command_completion_function (char *text, int state)
} }
} }
} }
if (!found){ if (!found){
look_for_executables = 0; look_for_executables = 0;
if (path) if (path)
@ -567,7 +567,7 @@ char *command_completion_function (char *text, int state)
return p; return p;
} }
return found; return found;
} }
int match_compare (const void *a, const void *b) int match_compare (const void *a, const void *b)
@ -580,7 +580,7 @@ int match_compare (const void *a, const void *b)
completions follows. completions follows.
You have to supply your own CompletionFunction with the word you You have to supply your own CompletionFunction with the word you
want to complete as the first argument and an count of previous matches want to complete as the first argument and an count of previous matches
as the second. as the second.
In case no matches were found we return NULL. */ In case no matches were found we return NULL. */
char **completion_matches (char *text, CompletionFunction entry_function) char **completion_matches (char *text, CompletionFunction entry_function)
{ {
@ -618,11 +618,11 @@ char **completion_matches (char *text, CompletionFunction entry_function)
match_list[1] = (char *)NULL; match_list[1] = (char *)NULL;
} else { } else {
int j; int j;
qsort (match_list + 1, matches, sizeof (char *), match_compare); qsort (match_list + 1, matches, sizeof (char *), match_compare);
/* And compare each member of the list with /* And compare each member of the list with
the next, finding out where they stop matching. the next, finding out where they stop matching.
If we find two equal strings, we have to put one away... */ If we find two equal strings, we have to put one away... */
j = i + 1; j = i + 1;
@ -632,7 +632,7 @@ char **completion_matches (char *text, CompletionFunction entry_function)
for (si = 0;(c1 = match_list [i][si]) && (c2 = match_list [j][si]); si++) for (si = 0;(c1 = match_list [i][si]) && (c2 = match_list [j][si]); si++)
if (c1 != c2) break; if (c1 != c2) break;
if (!c1 && !match_list [j][si]){ /* Two equal strings */ if (!c1 && !match_list [j][si]){ /* Two equal strings */
free (match_list [j]); free (match_list [j]);
j++; j++;
@ -660,10 +660,10 @@ char **completion_matches (char *text, CompletionFunction entry_function)
int check_is_cd (char *text, int start, int flags) int check_is_cd (char *text, int start, int flags)
{ {
char *p, *q = text + start; char *p, *q = text + start;
for (p = text; *p && p < q && (*p == ' ' || *p == '\t'); p++); for (p = text; *p && p < q && (*p == ' ' || *p == '\t'); p++);
if (((flags & INPUT_COMPLETE_COMMANDS) && if (((flags & INPUT_COMPLETE_COMMANDS) &&
!strncmp (p, "cd", 2) && (p [2] == ' ' || p [2] == '\t') && !strncmp (p, "cd", 2) && (p [2] == ' ' || p [2] == '\t') &&
p + 2 < q) || p + 2 < q) ||
(flags & INPUT_COMPLETE_CD)) (flags & INPUT_COMPLETE_CD))
return 1; return 1;
@ -700,7 +700,7 @@ char **try_complete (char *text, int *start, int *end, int flags)
register int this_char, prev_char; register int this_char, prev_char;
in_command_position++; in_command_position++;
if (i){ if (i){
/* Handle the two character tokens `>&', `<&', and `>|'. /* Handle the two character tokens `>&', `<&', and `>|'.
We are not in a command position after one of these. */ We are not in a command position after one of these. */
@ -720,14 +720,14 @@ char **try_complete (char *text, int *start, int *end, int flags)
p = strrchr (word, '`'); p = strrchr (word, '`');
if (flags & (INPUT_COMPLETE_COMMANDS | INPUT_COMPLETE_VARIABLES)) if (flags & (INPUT_COMPLETE_COMMANDS | INPUT_COMPLETE_VARIABLES))
q = strrchr (word, '$'); q = strrchr (word, '$');
if (flags & INPUT_COMPLETE_HOSTNAMES) if (flags & INPUT_COMPLETE_HOSTNAMES)
r = strrchr (word, '@'); r = strrchr (word, '@');
if (q && q [1] == '(' && INPUT_COMPLETE_COMMANDS){ if (q && q [1] == '(' && INPUT_COMPLETE_COMMANDS){
if (q > p) if (q > p)
p = q + 1; p = q + 1;
q = NULL; q = NULL;
} }
/* Command substitution? */ /* Command substitution? */
if (p > q && p > r){ if (p > q && p > r){
matches = completion_matches (p + 1, command_completion_function); matches = completion_matches (p + 1, command_completion_function);
@ -742,14 +742,14 @@ char **try_complete (char *text, int *start, int *end, int flags)
*start += q - word; *start += q - word;
} }
/* Starts with '@', then look through the known hostnames for /* Starts with '@', then look through the known hostnames for
completion first. */ completion first. */
else if (r > p && r > q){ else if (r > p && r > q){
matches = completion_matches (r, hostname_completion_function); matches = completion_matches (r, hostname_completion_function);
if (matches) if (matches)
*start += r - word; *start += r - word;
} }
/* Starts with `~' and there is no slash in the word, then /* Starts with `~' and there is no slash in the word, then
try completing this word as a username. */ try completing this word as a username. */
if (!matches && *word == '~' && (flags & INPUT_COMPLETE_USERNAMES) && !strchr (word, PATH_SEP)) if (!matches && *word == '~' && (flags & INPUT_COMPLETE_USERNAMES) && !strchr (word, PATH_SEP))
@ -761,7 +761,7 @@ char **try_complete (char *text, int *start, int *end, int flags)
and command names. */ and command names. */
if (!matches && in_command_position) if (!matches && in_command_position)
matches = completion_matches (word, command_completion_function); matches = completion_matches (word, command_completion_function);
else if (!matches && (flags & INPUT_COMPLETE_FILENAMES)){ else if (!matches && (flags & INPUT_COMPLETE_FILENAMES)){
if (is_cd) if (is_cd)
ignore_filenames = 1; ignore_filenames = 1;
@ -769,7 +769,7 @@ char **try_complete (char *text, int *start, int *end, int flags)
ignore_filenames = 0; ignore_filenames = 0;
if (!matches && is_cd && *word != PATH_SEP && *word != '~'){ if (!matches && is_cd && *word != PATH_SEP && *word != '~'){
char *p, *q = text + *start; char *p, *q = text + *start;
for (p = text; *p && p < q && (*p == ' ' || *p == '\t'); p++); for (p = text; *p && p < q && (*p == ' ' || *p == '\t'); p++);
if (!strncmp (p, "cd", 2)) if (!strncmp (p, "cd", 2))
for (p += 2; *p && p < q && (*p == ' ' || *p == '\t'); p++); for (p += 2; *p && p < q && (*p == ' ' || *p == '\t'); p++);
@ -785,7 +785,7 @@ char **try_complete (char *text, int *start, int *end, int flags)
s = strchr (cdpath, ':'); s = strchr (cdpath, ':');
if (s == NULL) if (s == NULL)
s = strchr (cdpath, 0); s = strchr (cdpath, 0);
c = *s; c = *s;
*s = 0; *s = 0;
if (*cdpath){ if (*cdpath){
r = concat_dir_and_file (cdpath, word); r = concat_dir_and_file (cdpath, word);
@ -800,7 +800,7 @@ char **try_complete (char *text, int *start, int *end, int flags)
} }
} }
} }
if (word) if (word)
free (word); free (word);
@ -810,7 +810,7 @@ char **try_complete (char *text, int *start, int *end, int flags)
void free_completions (WInput *in) void free_completions (WInput *in)
{ {
char **p; char **p;
if (!in->completions) if (!in->completions)
return; return;
for (p=in->completions; *p; p++) for (p=in->completions; *p; p++)
@ -861,7 +861,7 @@ static int query_callback (Dlg_head * h, int Par, int Msg)
dlg_erase (h); dlg_erase (h);
draw_box (h, 0, 0, query_height, query_width); draw_box (h, 0, 0, query_height, query_width);
break; break;
case DLG_KEY: case DLG_KEY:
switch (Par) { switch (Par) {
case KEY_LEFT: case KEY_LEFT:
@ -869,7 +869,7 @@ static int query_callback (Dlg_head * h, int Par, int Msg)
h->ret_value = 0; h->ret_value = 0;
dlg_stop (h); dlg_stop (h);
return 1; return 1;
case 0177: case 0177:
case KEY_BACKSPACE: case KEY_BACKSPACE:
case XCTRL('h'): case XCTRL('h'):
@ -879,7 +879,7 @@ static int query_callback (Dlg_head * h, int Par, int Msg)
return 1; return 1;
} else { } else {
WLEntry *e, *e1; WLEntry *e, *e1;
e1 = e = ((WListbox *)(h->current->widget))->list; e1 = e = ((WListbox *)(h->current->widget))->list;
do { do {
if (!strncmp (input->buffer + start, e1->text, end - start - 1)){ if (!strncmp (input->buffer + start, e1->text, end - start - 1)){
@ -894,7 +894,7 @@ static int query_callback (Dlg_head * h, int Par, int Msg)
} while (e != e1); } while (e != e1);
} }
return 1; return 1;
default: default:
if (Par > 0xff || !is_printable (Par)){ if (Par > 0xff || !is_printable (Par)){
if (is_in_input_map (input, Par) == 2){ if (is_in_input_map (input, Par) == 2){
@ -911,20 +911,20 @@ static int query_callback (Dlg_head * h, int Par, int Msg)
int need_redraw = 0; int need_redraw = 0;
int low = 4096; int low = 4096;
char *last_text = NULL; char *last_text = NULL;
e1 = e = ((WListbox *)(h->current->widget))->list; e1 = e = ((WListbox *)(h->current->widget))->list;
do { do {
if (!strncmp (input->buffer + start, e1->text, end - start)){ if (!strncmp (input->buffer + start, e1->text, end - start)){
if (e1->text [end - start] == Par){ if (e1->text [end - start] == Par){
if (need_redraw){ if (need_redraw){
register int c1, c2, si; register int c1, c2, si;
for (si = end - start + 1; for (si = end - start + 1;
(c1 = last_text [si]) && (c1 = last_text [si]) &&
(c2 = e1->text [si]); si++) (c2 = e1->text [si]); si++)
if (c1 != c2) if (c1 != c2)
break; break;
if (low > si) if (low > si)
low = si; low = si;
last_text = e1->text; last_text = e1->text;
need_redraw = 2; need_redraw = 2;
@ -988,7 +988,7 @@ int complete_engine (WInput *in, int what_to_do)
char **p, *q; char **p, *q;
Dlg_head *query_dlg; Dlg_head *query_dlg;
WListbox *query_list; WListbox *query_list;
for (p=in->completions + 1; *p; count++, p++) for (p=in->completions + 1; *p; count++, p++)
if ((i = strlen (*p)) > maxlen) if ((i = strlen (*p)) > maxlen)
maxlen = i; maxlen = i;

View file

@ -1,11 +1,11 @@
/* Client interface for General purpose Linux console save/restore server /* Client interface for General purpose Linux console save/restore server
Copyright (C) 1994 Janne Kukonlehto <jtklehto@stekt.oulu.fi> Copyright (C) 1994 Janne Kukonlehto <jtklehto@stekt.oulu.fi>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -194,7 +194,7 @@ void handle_console (unsigned char action)
#endif /* #ifdef linux */ #endif /* #ifdef linux */
#ifdef SCO_FLAVOR #ifdef SCO_FLAVOR
/* /*
** SCO console save/restore handling routines ** SCO console save/restore handling routines
** Copyright (C) 1997 Alex Tkachenko <alex@bcs.zaporizhzhe.ua> ** Copyright (C) 1997 Alex Tkachenko <alex@bcs.zaporizhzhe.ua>
*/ */
@ -271,7 +271,7 @@ console_save()
{ {
struct vt_mode smode; struct vt_mode smode;
/* /*
** User switched out of our vt. Let's wait until we get SIG_ACQUIRE, ** User switched out of our vt. Let's wait until we get SIG_ACQUIRE,
** otherwise we could save wrong screen image ** otherwise we could save wrong screen image
*/ */
@ -364,7 +364,7 @@ handle_console (unsigned char action)
console_init(); console_init();
break; break;
case CONSOLE_DONE: case CONSOLE_DONE:
console_shutdown(); console_shutdown();
break; break;

View file

@ -6,12 +6,12 @@
This code requires root privileges. This code requires root privileges.
You may want to make the cons.saver setuid root. You may want to make the cons.saver setuid root.
The code should be safe even if it is setuid but who knows? The code should be safe even if it is setuid but who knows?
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -102,11 +102,11 @@ int check_file (char *filename, int check_console, char **msg)
both 'open' and 'stat' operate on the same file */ both 'open' and 'stat' operate on the same file */
*msg = 0; *msg = 0;
fd = open (filename, O_RDWR); fd = open (filename, O_RDWR);
if (fd == -1) if (fd == -1)
return -1; return -1;
if (fstat (fd, &stat_buf) == -1) if (fstat (fd, &stat_buf) == -1)
return -1; return -1;
@ -125,19 +125,19 @@ int check_file (char *filename, int check_console, char **msg)
*msg = "Not a console"; *msg = "Not a console";
return -1; return -1;
} }
if ((stat_buf.st_rdev & 0x00ff) > 63){ if ((stat_buf.st_rdev & 0x00ff) > 63){
*msg = "Minor device number too big"; *msg = "Minor device number too big";
return -1; return -1;
} }
/* Must be owned by the user */ /* Must be owned by the user */
if (stat_buf.st_uid != getuid ()){ if (stat_buf.st_uid != getuid ()){
*msg = "Not a owner"; *msg = "Not a owner";
return -1; return -1;
} }
} }
/* Everything seems to be okay */ /* Everything seems to be okay */
return fd; return fd;
} }
@ -150,7 +150,7 @@ char *detect_console (void)
{ {
char *msg; char *msg;
int xlen; int xlen;
/* Must be console */ /* Must be console */
/* Handle the case for /dev/tty?? */ /* Handle the case for /dev/tty?? */
if (tty_name[len-5] == 't') if (tty_name[len-5] == 't')
@ -174,7 +174,7 @@ char *detect_console (void)
#ifdef DEBUG #ifdef DEBUG
fprintf (stderr, "vcs_fd = %d console_fd = %d\n", vcs_fd, console_fd); fprintf (stderr, "vcs_fd = %d console_fd = %d\n", vcs_fd, console_fd);
#endif #endif
if (vcs_fd != -1){ if (vcs_fd != -1){
console_flag = 3; console_flag = 3;
} }
@ -269,9 +269,9 @@ void send_contents ()
unsigned char message; unsigned char message;
unsigned short bytes; unsigned short bytes;
int bytes_per_char; int bytes_per_char;
bytes_per_char = console_flag == 1 ? 1 : 2; bytes_per_char = console_flag == 1 ? 1 : 2;
/* Calculate the number of used lines */ /* Calculate the number of used lines */
if (console_flag == 2 || console_flag == 1 || console_flag == 3){ if (console_flag == 2 || console_flag == 1 || console_flag == 3){
index = (2 + rows * columns) * bytes_per_char; index = (2 + rows * columns) * bytes_per_char;
@ -327,7 +327,7 @@ int main (int argc, char **argv)
/* Lose the control terminal */ /* Lose the control terminal */
setsid (); setsid ();
/* Check that the argument is a legal console */ /* Check that the argument is a legal console */
tty_name = argv [1]; tty_name = argv [1];
len = strlen(tty_name); len = strlen(tty_name);
@ -353,7 +353,7 @@ int main (int argc, char **argv)
/* If using /dev/vcs*, we don't need anymore the console fd */ /* If using /dev/vcs*, we don't need anymore the console fd */
if (console_flag == 3) if (console_flag == 3)
close (console_fd); close (console_fd);
/* Inform the invoker about the result of the tests */ /* Inform the invoker about the result of the tests */
write (cmd_output, &console_flag, 1); write (cmd_output, &console_flag, 1);
@ -374,14 +374,14 @@ int main (int argc, char **argv)
send_contents (); send_contents ();
break; break;
} /* switch (action) */ } /* switch (action) */
/* Inform the invoker that command is handled */ /* Inform the invoker that command is handled */
write (cmd_output, &console_flag, 1); write (cmd_output, &console_flag, 1);
} /* while (read ...) */ } /* while (read ...) */
if (buffer) if (buffer)
free (buffer); free (buffer);
return 0; return 0;
} }
#else #else

View file

@ -1,11 +1,11 @@
/* Dialog managing. /* Dialog managing.
Copyright (C) 1994 Miguel de Icaza. Copyright (C) 1994 Miguel de Icaza.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -35,7 +35,7 @@
#include "dlg.h" /* draw_box, yes I know, it's silly */ #include "dlg.h" /* draw_box, yes I know, it's silly */
#include "background.h" /* we_are_background definition */ #include "background.h" /* we_are_background definition */
/* "$Id: dialog.c,v 1.1 2001/12/30 09:55:26 sedwards Exp $" */ /* "$Id$" */
Refresh *refresh_list = 0; Refresh *refresh_list = 0;
@ -54,7 +54,7 @@ void push_refresh (void (*new_refresh)(void *), void *parameter, int flags)
void pop_refresh (void) void pop_refresh (void)
{ {
Refresh *old; Refresh *old;
if (!refresh_list) if (!refresh_list)
fprintf (stderr, _("\n\n\nrefresh stack underflow!\n\n\n")); fprintf (stderr, _("\n\n\nrefresh stack underflow!\n\n\n"));
else { else {
@ -71,7 +71,7 @@ static void do_complete_refresh (Refresh *refresh_list)
if (refresh_list->flags != REFRESH_COVERS_ALL) if (refresh_list->flags != REFRESH_COVERS_ALL)
do_complete_refresh (refresh_list->next); do_complete_refresh (refresh_list->next);
(*(refresh_list->refresh_fn))(refresh_list->parameter); (*(refresh_list->refresh_fn))(refresh_list->parameter);
} }
@ -99,7 +99,7 @@ void my_wputs (int y, int x, char *text)
while ((p = *text++) != 0){ while ((p = *text++) != 0){
if (p == '\n') if (p == '\n')
move (++y, x); move (++y, x);
else else
addch ((unsigned char)p); addch ((unsigned char)p);
} }
} }

View file

@ -1,11 +1,11 @@
/* Directory routines /* Directory routines
Copyright (C) 1994 Miguel de Icaza. Copyright (C) 1994 Miguel de Icaza.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -33,7 +33,7 @@
#include "tree.h" #include "tree.h"
#include "../vfs/vfs.h" #include "../vfs/vfs.h"
/* "$Id: dir.c,v 1.1 2001/12/30 09:55:26 sedwards Exp $" */ /* "$Id$" */
/* If true show files starting with a dot */ /* If true show files starting with a dot */
int show_dot_files = 1; int show_dot_files = 1;
@ -84,7 +84,7 @@ sort_name (const file_entry *a, const file_entry *b)
{ {
int ad = MY_ISDIR (a); int ad = MY_ISDIR (a);
int bd = MY_ISDIR (b); int bd = MY_ISDIR (b);
if (ad == bd || mix_all_files) if (ad == bd || mix_all_files)
return string_sortcomp (a->fname, b->fname) * reverse; return string_sortcomp (a->fname, b->fname) * reverse;
return bd-ad; return bd-ad;
@ -115,7 +115,7 @@ sort_owner (const file_entry *a, const file_entry *b)
{ {
int ad = MY_ISDIR (a); int ad = MY_ISDIR (a);
int bd = MY_ISDIR (b); int bd = MY_ISDIR (b);
if (ad == bd || mix_all_files) if (ad == bd || mix_all_files)
return string_sortcomp (get_owner (a->buf.st_uid), get_owner (a->buf.st_uid)) * reverse; return string_sortcomp (get_owner (a->buf.st_uid), get_owner (a->buf.st_uid)) * reverse;
return bd-ad; return bd-ad;
@ -126,7 +126,7 @@ sort_group (const file_entry *a, const file_entry *b)
{ {
int ad = MY_ISDIR (a); int ad = MY_ISDIR (a);
int bd = MY_ISDIR (b); int bd = MY_ISDIR (b);
if (ad == bd || mix_all_files) if (ad == bd || mix_all_files)
return string_sortcomp (get_group (a->buf.st_gid), get_group (a->buf.st_gid)) * reverse; return string_sortcomp (get_group (a->buf.st_gid), get_group (a->buf.st_gid)) * reverse;
return bd-ad; return bd-ad;
@ -232,7 +232,7 @@ inline static int
file_type_to_num (const file_entry *fe) file_type_to_num (const file_entry *fe)
{ {
const struct stat *s = &fe->buf; const struct stat *s = &fe->buf;
if (S_ISDIR (s->st_mode)) if (S_ISDIR (s->st_mode))
return 0; return 0;
if (S_ISLNK (s->st_mode)){ if (S_ISLNK (s->st_mode)){
@ -261,7 +261,7 @@ sort_type (const file_entry *a, const file_entry *b)
{ {
int aa = file_type_to_num (a); int aa = file_type_to_num (a);
int bb = file_type_to_num (b); int bb = file_type_to_num (b);
return bb-aa; return bb-aa;
} }
@ -302,13 +302,13 @@ void clean_dir (dir_list *list, int count)
} }
} }
static int static int
add_dotdot_to_list (dir_list *list, int index) add_dotdot_to_list (dir_list *list, int index)
{ {
char buffer [MC_MAXPATHLEN + MC_MAXPATHLEN]; char buffer [MC_MAXPATHLEN + MC_MAXPATHLEN];
char *p, *s; char *p, *s;
int i = 0; int i = 0;
/* Need to grow the *list? */ /* Need to grow the *list? */
if (index == list->size) { if (index == list->size) {
list->list = realloc (list->list, sizeof (file_entry) * list->list = realloc (list->list, sizeof (file_entry) *
@ -323,7 +323,7 @@ add_dotdot_to_list (dir_list *list, int index)
(list->list) [index].cache = NULL; (list->list) [index].cache = NULL;
(list->list) [index].f.link_to_dir = 0; (list->list) [index].f.link_to_dir = 0;
(list->list) [index].f.stalled_link = 0; (list->list) [index].f.stalled_link = 0;
/* FIXME: We need to get the panel definition! to use file_mark */ /* FIXME: We need to get the panel definition! to use file_mark */
(list->list) [index].f.marked = 0; (list->list) [index].f.marked = 0;
mc_get_current_wd (buffer, sizeof (buffer) - 1 ); mc_get_current_wd (buffer, sizeof (buffer) - 1 );
@ -383,7 +383,7 @@ int handle_dirent (dir_list *list, char *filter, struct dirent *dp,
if (S_ISDIR (buf1->st_mode)) if (S_ISDIR (buf1->st_mode))
tree_check (dp->d_name); tree_check (dp->d_name);
/* A link to a file or a directory? */ /* A link to a file or a directory? */
*link_to_dir = 0; *link_to_dir = 0;
*stalled_link = 0; *stalled_link = 0;
@ -409,9 +409,9 @@ int handle_dirent (dir_list *list, char *filter, struct dirent *dp,
return 1; return 1;
} }
/* handle_path is a simplified handle_dirent. The difference is that /* handle_path is a simplified handle_dirent. The difference is that
handle_path doesn't pay attention to show_dot_files and show_backups. handle_path doesn't pay attention to show_dot_files and show_backups.
Moreover handle_path can't be used with a filemask. Moreover handle_path can't be used with a filemask.
If you change handle_path then check also handle_dirent. */ If you change handle_path then check also handle_dirent. */
/* Return values: -1 = failure, 0 = don't add, 1 = add to the list */ /* Return values: -1 = failure, 0 = don't add, 1 = add to the list */
int handle_path (dir_list *list, char *path, int handle_path (dir_list *list, char *path,
@ -425,7 +425,7 @@ int handle_path (dir_list *list, char *path,
if (S_ISDIR (buf1->st_mode)) if (S_ISDIR (buf1->st_mode))
tree_check (path); tree_check (path);
/* A link to a file or a directory? */ /* A link to a file or a directory? */
*link_to_dir = 0; *link_to_dir = 0;
*stalled_link = 0; *stalled_link = 0;
@ -458,7 +458,7 @@ int do_load_dir(dir_list *list, sortfn *sort, int reverse, int case_sensitive, c
int dotdot_found = 0; int dotdot_found = 0;
start_tree_check (NULL); start_tree_check (NULL);
dirp = mc_opendir ("."); dirp = mc_opendir (".");
if (!dirp){ if (!dirp){
return set_zero_dir (list); return set_zero_dir (list);
@ -472,7 +472,7 @@ int do_load_dir(dir_list *list, sortfn *sort, int reverse, int case_sensitive, c
return next_free; return next_free;
list->list [next_free].fnamelen = NLENGTH (dp); list->list [next_free].fnamelen = NLENGTH (dp);
list->list [next_free].fname = strdup (dp->d_name); list->list [next_free].fname = strdup (dp->d_name);
list->list [next_free].cache = NULL; list->list [next_free].cache = NULL;
list->list [next_free].f.marked = 0; list->list [next_free].f.marked = 0;
list->list [next_free].f.link_to_dir = link_to_dir; list->list [next_free].f.link_to_dir = link_to_dir;
list->list [next_free].f.stalled_link = stalled_link; list->list [next_free].f.stalled_link = stalled_link;
@ -491,7 +491,7 @@ int do_load_dir(dir_list *list, sortfn *sort, int reverse, int case_sensitive, c
} }
else else
return set_zero_dir (list); return set_zero_dir (list);
mc_closedir (dirp); mc_closedir (dirp);
end_tree_check (NULL); end_tree_check (NULL);
return next_free; return next_free;
@ -500,7 +500,7 @@ int do_load_dir(dir_list *list, sortfn *sort, int reverse, int case_sensitive, c
int link_isdir (file_entry *file) int link_isdir (file_entry *file)
{ {
struct stat b; struct stat b;
if (S_ISLNK (file->buf.st_mode)){ if (S_ISLNK (file->buf.st_mode)){
mc_stat (file->fname, &b); mc_stat (file->fname, &b);
if (S_ISDIR (b.st_mode)) if (S_ISDIR (b.st_mode))
@ -508,7 +508,7 @@ int link_isdir (file_entry *file)
} }
return 0; return 0;
} }
int if_link_is_exe (file_entry *file) int if_link_is_exe (file_entry *file)
{ {
struct stat b; struct stat b;
@ -525,7 +525,7 @@ static dir_list dir_copy = { 0, 0 };
static void alloc_dir_copy (int size) static void alloc_dir_copy (int size)
{ {
int i; int i;
if (dir_copy.size < size){ if (dir_copy.size < size){
if (dir_copy.list){ if (dir_copy.list){
@ -558,7 +558,7 @@ int do_reload_dir (dir_list *list, sortfn *sort, int count, int rev,
int i, found, status, link_to_dir, stalled_link; int i, found, status, link_to_dir, stalled_link;
struct stat buf; struct stat buf;
int tmp_len; /* For optimisation */ int tmp_len; /* For optimisation */
int dotdot_found = 0; int dotdot_found = 0;
start_tree_check (NULL); start_tree_check (NULL);
dirp = mc_opendir ("."); dirp = mc_opendir (".");
@ -584,19 +584,19 @@ int do_reload_dir (dir_list *list, sortfn *sort, int count, int rev,
continue; continue;
if (status == -1) { if (status == -1) {
mc_closedir (dirp); mc_closedir (dirp);
/* Norbert (Feb 12, 1997): /* Norbert (Feb 12, 1997):
Just in case someone finds this memory leak: Just in case someone finds this memory leak:
-1 means big trouble (at the moment no memory left), -1 means big trouble (at the moment no memory left),
I don't bother with further cleanup because if one gets to I don't bother with further cleanup because if one gets to
this point he will have more problems than a few memory this point he will have more problems than a few memory
leaks and because one 'clean_dir' would not be enough (and leaks and because one 'clean_dir' would not be enough (and
because I don't want to spent the time to make it working, because I don't want to spent the time to make it working,
IMHO it's not worthwhile). IMHO it's not worthwhile).
clean_dir (&dir_copy, count); clean_dir (&dir_copy, count);
*/ */
return next_free; return next_free;
} }
tmp_len = NLENGTH (dp); tmp_len = NLENGTH (dp);
for (found = i = 0; i < count; i++) for (found = i = 0; i < count; i++)
if (tmp_len == dir_copy.list [i].fnamelen if (tmp_len == dir_copy.list [i].fnamelen
@ -605,10 +605,10 @@ int do_reload_dir (dir_list *list, sortfn *sort, int count, int rev,
found = 1; found = 1;
break; break;
} }
if (!found) if (!found)
list->list [next_free].f.marked = 0; list->list [next_free].f.marked = 0;
list->list [next_free].fnamelen = tmp_len; list->list [next_free].fnamelen = tmp_len;
list->list [next_free].fname = strdup (dp->d_name); list->list [next_free].fname = strdup (dp->d_name);
list->list [next_free].cache = NULL; list->list [next_free].cache = NULL;

View file

@ -13,7 +13,7 @@ typedef struct {
struct stat buf; struct stat buf;
/* Flags */ /* Flags */
struct { struct {
unsigned int marked:1; /* File marked in pane window */ unsigned int marked:1; /* File marked in pane window */
unsigned int exists:1; /* Use for rereading file */ unsigned int exists:1; /* Use for rereading file */
unsigned int link_to_dir:1; /* If this is a link, does it point to directory? */ unsigned int link_to_dir:1; /* If this is a link, does it point to directory? */
@ -38,7 +38,7 @@ int set_zero_dir (dir_list *list);
#ifdef DIR_H_INCLUDE_HANDLE_DIRENT #ifdef DIR_H_INCLUDE_HANDLE_DIRENT
int handle_dirent (dir_list *list, char *filter, struct dirent *dp, int handle_dirent (dir_list *list, char *filter, struct dirent *dp,
struct stat *buf1, int next_free, int *link_to_dir, int *stalled_link); struct stat *buf1, int next_free, int *link_to_dir, int *stalled_link);
int handle_path (dir_list *list, char *path, struct stat *buf1, int next_free, int handle_path (dir_list *list, char *path, struct stat *buf1, int next_free,
int *link_to_dir, int *stalled_link); int *link_to_dir, int *stalled_link);
#endif #endif

View file

@ -17,7 +17,7 @@
*/ */
#include <config.h> #include <config.h>
/* "$Id: dlg.c,v 1.1 2001/12/30 09:55:26 sedwards Exp $" */ /* "$Id$" */
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <malloc.h> #include <malloc.h>
@ -37,7 +37,7 @@
#include "dlg.h" #include "dlg.h"
#include "dialog.h" /* For push_refresh() and pop_refresh() */ #include "dialog.h" /* For push_refresh() and pop_refresh() */
#include "layout.h" #include "layout.h"
#include "main.h" #include "main.h"
/* This is the current frame, used to group Tk packings */ /* This is the current frame, used to group Tk packings */
char *the_frame = ""; char *the_frame = "";
@ -74,12 +74,12 @@ static void slow_box (Dlg_head *h, int y, int x, int ys, int xs)
void draw_box (Dlg_head *h, int y, int x, int ys, int xs) void draw_box (Dlg_head *h, int y, int x, int ys, int xs)
{ {
extern int slow_terminal; extern int slow_terminal;
if (slow_terminal){ if (slow_terminal){
slow_box (h, y, x, ys, xs); slow_box (h, y, x, ys, xs);
return; return;
} }
#ifndef HAVE_SLANG #ifndef HAVE_SLANG
waddc (h, y, x, ACS_ULCORNER); waddc (h, y, x, ACS_ULCORNER);
hline (ACS_HLINE, xs - 2); hline (ACS_HLINE, xs - 2);
@ -154,7 +154,7 @@ void init_widget (Widget *w, int y, int x, int lines, int cols,
abort (); abort ();
} }
/* Almost all widgets want to put the cursor in a suitable place */ /* Almost all widgets want to put the cursor in a suitable place */
w->options = W_WANT_CURSOR; w->options = W_WANT_CURSOR;
} }
int default_proc (Dlg_head *h, int Msg, int Par) int default_proc (Dlg_head *h, int Msg, int Par)
@ -166,20 +166,20 @@ int default_proc (Dlg_head *h, int Msg, int Par)
case WIDGET_INIT: /* We could tell if something went wrong */ case WIDGET_INIT: /* We could tell if something went wrong */
return 1; return 1;
case WIDGET_KEY: case WIDGET_KEY:
return 0; /* Didn't use the key */ return 0; /* Didn't use the key */
case WIDGET_FOCUS: /* We accept FOCUSes */ case WIDGET_FOCUS: /* We accept FOCUSes */
if (h->current) if (h->current)
x_focus_widget (h->current); x_focus_widget (h->current);
return 1; return 1;
case WIDGET_UNFOCUS: /* We accept loose FOCUSes */ case WIDGET_UNFOCUS: /* We accept loose FOCUSes */
if (h->current) if (h->current)
x_unfocus_widget (h->current); x_unfocus_widget (h->current);
return 1; return 1;
case WIDGET_DRAW: case WIDGET_DRAW:
return 1; return 1;
@ -248,10 +248,10 @@ Dlg_head *create_dlg (int y1, int x1, int lines, int cols,
new_d->wdata = xtoolkit_create_dialog (new_d, flags); new_d->wdata = xtoolkit_create_dialog (new_d, flags);
else else
new_d->wdata = xtoolkit_get_main_dialog (new_d); new_d->wdata = xtoolkit_get_main_dialog (new_d);
#endif #endif
return (new_d); return (new_d);
} }
void set_idle_proc (Dlg_head *d, int state) void set_idle_proc (Dlg_head *d, int state)
{ {
d->send_idle_msg = state; d->send_idle_msg = state;
@ -266,7 +266,7 @@ int add_widgetl (Dlg_head *where, void *what, WLay layout)
/* Only used by Tk */ /* Only used by Tk */
widget->frame = the_frame; widget->frame = the_frame;
widget->layout = layout; widget->layout = layout;
/* Don't accept 0 widgets, this could be from widgets that could not */ /* Don't accept 0 widgets, this could be from widgets that could not */
/* initialize properly */ /* initialize properly */
@ -303,16 +303,16 @@ int add_widgetl (Dlg_head *where, void *what, WLay layout)
where->current->next = where->current; where->current->next = where->current;
where->first = where->current; where->first = where->current;
} }
where->current->prev = where->first; where->current->prev = where->first;
where->last = where->current; where->last = where->current;
where->first->next = where->last; where->first->next = where->last;
} }
where->current->dlg_id = where->count; where->current->dlg_id = where->count;
where->current->widget = what; where->current->widget = what;
where->current->widget->parent = where; where->current->widget->parent = where;
where->count++; where->count++;
/* If the widget is inserted in a running dialog */ /* If the widget is inserted in a running dialog */
@ -329,15 +329,15 @@ int add_widgetl (Dlg_head *where, void *what, WLay layout)
int remove_widget (Dlg_head *h, void *what) int remove_widget (Dlg_head *h, void *what)
{ {
Widget_Item *first, *p; Widget_Item *first, *p;
first = p = h->current; first = p = h->current;
do { do {
if (p->widget == what){ if (p->widget == what){
/* Remove links to this Widget_Item */ /* Remove links to this Widget_Item */
p->prev->next = p->next; p->prev->next = p->next;
p->next->prev = p->prev; p->next->prev = p->prev;
/* Make sure h->current is always valid */ /* Make sure h->current is always valid */
if (p == h->current){ if (p == h->current){
h->current = h->current->next; h->current = h->current->next;
@ -381,7 +381,7 @@ void dlg_broadcast_msg_to (Dlg_head *h, int message, int reverse, int flags)
if (!h->current) if (!h->current)
return; return;
if (reverse) if (reverse)
first = p = h->current->prev; first = p = h->current->prev;
else else
@ -434,13 +434,13 @@ static void select_a_widget (Dlg_head *h, int down)
if (!down) if (!down)
direction = !direction; direction = !direction;
do { do {
if (direction) if (direction)
h->current = h->current->next; h->current = h->current->next;
else else
h->current = h->current->prev; h->current = h->current->prev;
(*h->callback) (h, h->current->dlg_id, DLG_ONE_DOWN); (*h->callback) (h, h->current->dlg_id, DLG_ONE_DOWN);
} while (!dlg_focus (h)); } while (!dlg_focus (h));
} }
@ -466,7 +466,7 @@ Widget *find_widget_type (Dlg_head *h, callback_fn signature)
if (!h) if (!h)
return 0; return 0;
w = 0; w = 0;
for (i = 0, item = h->current; i < h->count; i++, item = item->next){ for (i = 0, item = h->current; i < h->count; i++, item = item->next){
if (item->widget->callback == signature){ if (item->widget->callback == signature){
@ -485,7 +485,7 @@ void dlg_one_up (Dlg_head *h)
/* If it accepts unFOCUSion */ /* If it accepts unFOCUSion */
if (!dlg_unfocus(h)) if (!dlg_unfocus(h))
return; return;
select_a_widget (h, 0); select_a_widget (h, 0);
if (dlg_overlap (old->widget, h->current->widget)){ if (dlg_overlap (old->widget, h->current->widget)){
send_message (h, h->current->widget, WIDGET_DRAW, 0); send_message (h, h->current->widget, WIDGET_DRAW, 0);
@ -501,7 +501,7 @@ void dlg_one_down (Dlg_head *h)
if (!dlg_unfocus (h)) if (!dlg_unfocus (h))
return; return;
select_a_widget (h, 1); select_a_widget (h, 1);
if (dlg_overlap (old->widget, h->current->widget)){ if (dlg_overlap (old->widget, h->current->widget)){
send_message (h, h->current->widget, WIDGET_DRAW, 0); send_message (h, h->current->widget, WIDGET_DRAW, 0);
send_message (h, h->current->widget, WIDGET_FOCUS, 0); send_message (h, h->current->widget, WIDGET_FOCUS, 0);
@ -547,7 +547,7 @@ void update_cursor (Dlg_head *h)
send_message (h, h->current->widget, WIDGET_CURSOR, 0); send_message (h, h->current->widget, WIDGET_CURSOR, 0);
else { else {
Widget_Item *p = h->current; Widget_Item *p = h->current;
do { do {
if (p->widget->options & W_WANT_CURSOR) if (p->widget->options & W_WANT_CURSOR)
if ((*p->widget->callback)(h, p->widget, WIDGET_CURSOR, 0)){ if ((*p->widget->callback)(h, p->widget, WIDGET_CURSOR, 0)){
@ -567,7 +567,7 @@ void dlg_redraw (Dlg_head *h)
(h->callback)(h, 0, DLG_DRAW); (h->callback)(h, 0, DLG_DRAW);
dlg_broadcast_msg (h, WIDGET_DRAW, 1); dlg_broadcast_msg (h, WIDGET_DRAW, 1);
update_cursor (h); update_cursor (h);
} }
@ -579,7 +579,7 @@ void dlg_refresh (void *parameter)
void dlg_stop (Dlg_head *h) void dlg_stop (Dlg_head *h)
{ {
h->running = 0; h->running = 0;
x_dialog_stop (h); x_dialog_stop (h);
} }
static INLINE void dialog_handle_key (Dlg_head *h, int d_key) static INLINE void dialog_handle_key (Dlg_head *h, int d_key)
@ -591,7 +591,7 @@ static INLINE void dialog_handle_key (Dlg_head *h, int d_key)
case KEY_UP: case KEY_UP:
dlg_one_up (h); dlg_one_up (h);
break; break;
case KEY_RIGHT: case KEY_RIGHT:
case KEY_DOWN: case KEY_DOWN:
dlg_one_down (h); dlg_one_down (h);
@ -607,7 +607,7 @@ static INLINE void dialog_handle_key (Dlg_head *h, int d_key)
case XCTRL('z'): case XCTRL('z'):
suspend_cmd (); suspend_cmd ();
/* Fall through */ /* Fall through */
case XCTRL('l'): case XCTRL('l'):
#ifndef HAVE_SLANG #ifndef HAVE_SLANG
/* Use this if the refreshes fail */ /* Use this if the refreshes fail */
@ -619,7 +619,7 @@ static INLINE void dialog_handle_key (Dlg_head *h, int d_key)
mc_refresh (); mc_refresh ();
doupdate (); doupdate ();
break; break;
case '\n': case '\n':
case KEY_ENTER: case KEY_ENTER:
h->ret_value = B_ENTER; h->ret_value = B_ENTER;
@ -643,7 +643,7 @@ static int dlg_try_hotkey (Dlg_head *h, int d_key)
Widget_Item *previous; Widget_Item *previous;
int handled, c; int handled, c;
extern input_event (); extern input_event ();
/* /*
* Explanation: we don't send letter hotkeys to other widgets if * Explanation: we don't send letter hotkeys to other widgets if
* the currently selected widget is an input line * the currently selected widget is an input line
@ -653,7 +653,7 @@ static int dlg_try_hotkey (Dlg_head *h, int d_key)
if(d_key < 255 && isalpha(d_key)) if(d_key < 255 && isalpha(d_key))
return 0; return 0;
} }
/* If it's an alt key, send the message */ /* If it's an alt key, send the message */
c = d_key & ~ALT(0); c = d_key & ~ALT(0);
if (d_key & ALT(0) && c < 255 && isalpha(c)) if (d_key & ALT(0) && c < 255 && isalpha(c))
@ -663,27 +663,27 @@ static int dlg_try_hotkey (Dlg_head *h, int d_key)
/* .ado: fix problem with file_permission under Win95 */ /* .ado: fix problem with file_permission under Win95 */
if (d_key == 0) return 0; if (d_key == 0) return 0;
#endif #endif
handled = 0; handled = 0;
if (h->current->widget->options & W_WANT_HOTKEY) if (h->current->widget->options & W_WANT_HOTKEY)
handled = callback (h) (h, h->current->widget, WIDGET_HOTKEY, d_key); handled = callback (h) (h, h->current->widget, WIDGET_HOTKEY, d_key);
/* If not used, send hotkey to other widgets */ /* If not used, send hotkey to other widgets */
if (handled) if (handled)
return handled; return handled;
hot_cur = h->current; hot_cur = h->current;
/* send it to all widgets */ /* send it to all widgets */
do { do {
if (hot_cur->widget->options & W_WANT_HOTKEY) if (hot_cur->widget->options & W_WANT_HOTKEY)
handled |= (*hot_cur->widget->callback) handled |= (*hot_cur->widget->callback)
(h, hot_cur->widget, WIDGET_HOTKEY, d_key); (h, hot_cur->widget, WIDGET_HOTKEY, d_key);
if (!handled) if (!handled)
hot_cur = hot_cur->next; hot_cur = hot_cur->next;
} while (h->current != hot_cur && !handled); } while (h->current != hot_cur && !handled);
if (!handled) if (!handled)
return 0; return 0;
@ -691,7 +691,7 @@ static int dlg_try_hotkey (Dlg_head *h, int d_key)
previous = h->current; previous = h->current;
if (!dlg_unfocus (h)) if (!dlg_unfocus (h))
return handled; return handled;
h->current = hot_cur; h->current = hot_cur;
if (!dlg_focus (h)){ if (!dlg_focus (h)){
h->current = previous; h->current = previous;
@ -703,7 +703,7 @@ static int dlg_try_hotkey (Dlg_head *h, int d_key)
void dlg_key_event (Dlg_head *h, int d_key) void dlg_key_event (Dlg_head *h, int d_key)
{ {
int handled; int handled;
/* TAB used to cycle */ /* TAB used to cycle */
if (!h->raw && (d_key == '\t' || d_key == KEY_BTAB)) if (!h->raw && (d_key == '\t' || d_key == KEY_BTAB))
if (d_key == '\t') if (d_key == '\t')
@ -711,22 +711,22 @@ void dlg_key_event (Dlg_head *h, int d_key)
else else
dlg_one_up (h); dlg_one_up (h);
else { else {
/* first can dlg_callback handle the key */ /* first can dlg_callback handle the key */
handled = (*h->callback) (h, d_key, DLG_KEY); handled = (*h->callback) (h, d_key, DLG_KEY);
/* next try the hotkey */ /* next try the hotkey */
if (!handled) if (!handled)
handled = dlg_try_hotkey (h, d_key); handled = dlg_try_hotkey (h, d_key);
/* not used - then try widget_callback */ /* not used - then try widget_callback */
if (!handled) if (!handled)
handled |= callback (h)(h, h->current->widget, WIDGET_KEY, d_key); handled |= callback (h)(h, h->current->widget, WIDGET_KEY, d_key);
/* not used- try to use the unhandled case */ /* not used- try to use the unhandled case */
if (!handled) if (!handled)
handled |= (*h->callback) (h, d_key, DLG_UNHANDLED_KEY); handled |= (*h->callback) (h, d_key, DLG_UNHANDLED_KEY);
if (!handled) if (!handled)
dialog_handle_key (h, d_key); dialog_handle_key (h, d_key);
(*h->callback) (h, d_key, DLG_POST_KEY); (*h->callback) (h, d_key, DLG_POST_KEY);
@ -752,8 +752,8 @@ static INLINE int dlg_mouse_event (Dlg_head *h, Gpm_Event *event)
Widget *widget = item->widget; Widget *widget = item->widget;
item = item->next; item = item->next;
if (!((x > widget->x) && (x <= widget->x+widget->cols) if (!((x > widget->x) && (x <= widget->x+widget->cols)
&& (y > widget->y) && (y <= widget->y+widget->lines))) && (y > widget->y) && (y <= widget->y+widget->lines)))
continue; continue;
@ -777,7 +777,7 @@ void init_dlg (Dlg_head *h)
int refresh_mode; int refresh_mode;
tk_end_frame (); tk_end_frame ();
/* Initialize dialog manager and widgets */ /* Initialize dialog manager and widgets */
(*h->callback) (h, 0, DLG_INIT); (*h->callback) (h, 0, DLG_INIT);
dlg_broadcast_msg (h, WIDGET_INIT, 0); dlg_broadcast_msg (h, WIDGET_INIT, 0);
@ -788,23 +788,23 @@ void init_dlg (Dlg_head *h)
refresh_mode = REFRESH_COVERS_PART; refresh_mode = REFRESH_COVERS_PART;
push_refresh (dlg_refresh, h, refresh_mode); push_refresh (dlg_refresh, h, refresh_mode);
h->refresh_pushed = 1; h->refresh_pushed = 1;
/* Initialize direction */ /* Initialize direction */
if (!h->direction) if (!h->direction)
h->current = h->first; h->current = h->first;
if (h->initfocus != NULL) if (h->initfocus != NULL)
h->current = h->initfocus; h->current = h->initfocus;
h->previous_dialog = current_dlg; h->previous_dialog = current_dlg;
current_dlg = h; current_dlg = h;
/* Initialize the mouse status */ /* Initialize the mouse status */
h->mouse_status = 0; h->mouse_status = 0;
/* Redraw the screen */ /* Redraw the screen */
dlg_redraw (h); dlg_redraw (h);
while (!dlg_focus (h)) while (!dlg_focus (h))
h->current = h->current->next; h->current = h->current->next;
@ -830,7 +830,7 @@ void dlg_process_event (Dlg_head *h, int key, Gpm_Event *event)
else else
return; return;
} }
if (key == EV_MOUSE) if (key == EV_MOUSE)
h->mouse_status = dlg_mouse_event (h, event); h->mouse_status = dlg_mouse_event (h, event);
else else
@ -854,7 +854,7 @@ frontend_run_dlg (Dlg_head *h)
if (is_idle ()){ if (is_idle ()){
if (idle_hook) if (idle_hook)
execute_hooks (idle_hook); execute_hooks (idle_hook);
while (h->send_idle_msg && is_idle ()){ while (h->send_idle_msg && is_idle ()){
(*h->callback) (h, 0, DLG_IDLE); (*h->callback) (h, 0, DLG_IDLE);
} }
@ -891,7 +891,7 @@ destroy_dlg (Dlg_head *h)
Widget_Item *c; Widget_Item *c;
if (h->refresh_pushed) if (h->refresh_pushed)
pop_refresh (); pop_refresh ();
x_destroy_dlg_start (h); x_destroy_dlg_start (h);
dlg_broadcast_msg (h, WIDGET_DESTROY, 0); dlg_broadcast_msg (h, WIDGET_DESTROY, 0);
@ -930,13 +930,13 @@ void dlg_replace_widget (Dlg_head *h, Widget *old, Widget *new)
{ {
Widget_Item *p = h->current; Widget_Item *p = h->current;
int should_focus = 0; int should_focus = 0;
do { do {
if (p->widget == old){ if (p->widget == old){
if (old == h->current->widget) if (old == h->current->widget)
should_focus = 1; should_focus = 1;
/* We found the widget */ /* We found the widget */
/* First kill the widget */ /* First kill the widget */
new->focused = old->focused; new->focused = old->focused;
@ -1002,14 +1002,14 @@ int dlg_select_nth_widget (Dlg_head *h, int n)
static void tk_frame_proc (Dlg_head *h, char *frame, int new_frame) static void tk_frame_proc (Dlg_head *h, char *frame, int new_frame)
{ {
char *s = strdup (frame); char *s = strdup (frame);
if (frame [strlen (frame)-1] != '.'){ if (frame [strlen (frame)-1] != '.'){
fprintf (stderr, "Invalid frame name\n"); fprintf (stderr, "Invalid frame name\n");
exit (1); exit (1);
} }
s [strlen (frame)-1] = 0; s [strlen (frame)-1] = 0;
the_frame = frame; the_frame = frame;
if (new_frame) if (new_frame)
tk_evalf ("frame %s.%s", (char *)h->wdata, s); tk_evalf ("frame %s.%s", (char *)h->wdata, s);
} }

Some files were not shown because too many files have changed in this diff Show more