mirror of
https://github.com/reactos/reactos.git
synced 2025-03-30 17:10:22 +00:00
remove trailing whitespace at end of lines
svn path=/trunk/; revision=15091
This commit is contained in:
parent
1c29a40c45
commit
456be5d16b
385 changed files with 5481 additions and 5481 deletions
|
@ -32,7 +32,7 @@
|
|||
#define NUM_ELEMENTS(a) (sizeof(a)/sizeof(a[0]))
|
||||
#define ASSERT(a)
|
||||
|
||||
const TCHAR* const usage_strings[] = {
|
||||
const TCHAR* const usage_strings[] = {
|
||||
_T("Device Status: MODE [device] [/STATUS]"),
|
||||
_T("Select code page: MODE CON[:] CP SELECT=yyy"),
|
||||
_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]"),
|
||||
};
|
||||
|
||||
const TCHAR* const parity_strings[] = {
|
||||
const TCHAR* const parity_strings[] = {
|
||||
_T("None"), // default
|
||||
_T("Odd"), // only symbol in this set to have a 'd' in it
|
||||
_T("Even"), // ... 'v' in it
|
||||
|
@ -75,7 +75,7 @@ int QueryDevices()
|
|||
TCHAR buffer[10240];
|
||||
int len;
|
||||
TCHAR* ptr = buffer;
|
||||
|
||||
|
||||
*ptr = '\0';
|
||||
if (QueryDosDevice(NULL, buffer, NUM_ELEMENTS(buffer))) {
|
||||
while (*ptr != '\0') {
|
||||
|
@ -146,7 +146,7 @@ int ShowConsoleStatus()
|
|||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
static
|
||||
BOOL SerialPortQuery(int nPortNum, LPDCB pDCB, LPCOMMTIMEOUTS pCommTimeouts, BOOL bWrite)
|
||||
{
|
||||
BOOL result;
|
||||
|
@ -270,7 +270,7 @@ int SetConsoleState()
|
|||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
static
|
||||
int ExtractModeSerialParams(const TCHAR* param)
|
||||
{
|
||||
if ( _tcsstr(param, _T("OFF"))) {
|
||||
|
@ -428,7 +428,7 @@ int main(int argc, TCHAR *argv[])
|
|||
goto show_status;
|
||||
} else if (_tcsstr(param1, _T("lpt"))) {
|
||||
nPortNum = find_portnum(param1);
|
||||
if (nPortNum != -1)
|
||||
if (nPortNum != -1)
|
||||
return ShowParallelStatus(nPortNum);
|
||||
} else if (_tcsstr(param1, _T("con"))) {
|
||||
return ShowConsoleStatus();
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
/*
|
||||
* MORE.C - external command.
|
||||
*
|
||||
* clone from 4nt more command
|
||||
*
|
||||
* 26 Sep 1999 - Paolo Pantaleo <paolopan@freemail.it>
|
||||
* started
|
||||
* started
|
||||
* Oct 2003 - Timothy Schepens <tischepe at fastmail dot fm>
|
||||
* use window size instead of buffer size.
|
||||
*/
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
/*
|
||||
* TEE.C - external command.
|
||||
*
|
||||
* clone from 4nt tee command
|
||||
*
|
||||
* 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 hConsoleIn,hConsoleOut;
|
||||
|
||||
|
||||
/*bytes written by WriteFile and ReadFile*/
|
||||
DWORD dwRead,dwWritten;
|
||||
|
||||
|
@ -82,7 +82,7 @@ INT main (int argc,char **p)
|
|||
INT i;
|
||||
BOOL bQuote;
|
||||
|
||||
/*file list implementation*/
|
||||
/*file list implementation*/
|
||||
LPTSTR *files;
|
||||
INT iFileCounter=0;
|
||||
HANDLE *hFile;
|
||||
|
@ -140,7 +140,7 @@ INT main (int argc,char **p)
|
|||
/*
|
||||
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;
|
||||
}
|
||||
*/
|
||||
|
@ -150,7 +150,7 @@ INT main (int argc,char **p)
|
|||
|
||||
/*open file(s)*/
|
||||
for(i=0;i<iFileCounter;i++)
|
||||
{
|
||||
{
|
||||
//l=0;
|
||||
hFile[i] = CreateFile(files[i],GENERIC_WRITE,
|
||||
0,NULL,
|
||||
|
|
|
@ -204,10 +204,10 @@ stime_arg1(char *arg, time_t *tvp)
|
|||
{
|
||||
struct tm *t;
|
||||
int yearset;
|
||||
char *p;
|
||||
char *p;
|
||||
/* Start with the current time. */
|
||||
if ((t = localtime(&tvp[0])) == NULL)
|
||||
err(1, "localtime"); DbgPrint("[%s]", "[23]");
|
||||
err(1, "localtime"); DbgPrint("[%s]", "[23]");
|
||||
/* [[CC]YY]MMDDhhmm[.SS] */
|
||||
if ((p = strchr(arg, '.')) == NULL)
|
||||
t->tm_sec = 0; /* Seconds defaults to 0. */
|
||||
|
@ -217,7 +217,7 @@ stime_arg1(char *arg, time_t *tvp)
|
|||
*p++ = '\0';
|
||||
t->tm_sec = ATOI2(p);
|
||||
}
|
||||
|
||||
|
||||
yearset = 0;
|
||||
switch(strlen(arg)) {
|
||||
case 12: /* CCYYMMDDhhmm */
|
||||
|
|
|
@ -80,7 +80,7 @@ int main (int argc, char **argv)
|
|||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
hFind=FindFirstFile(argv[i],&FindData);
|
||||
|
||||
|
||||
if (hFind==INVALID_HANDLE_VALUE)
|
||||
{
|
||||
ConErrPrintf("File not found - %s\n",argv[i]);
|
||||
|
@ -107,7 +107,7 @@ int main (int argc, char **argv)
|
|||
|
||||
if (dwRead>0 && bRet)
|
||||
WriteFile(hConsoleOut,buff,dwRead,&dwWritten,NULL);
|
||||
|
||||
|
||||
} while(dwRead>0 && bRet);
|
||||
|
||||
CloseHandle(hFile);
|
||||
|
|
|
@ -13,36 +13,36 @@
|
|||
* screenhack stuff. There's still some work that could
|
||||
* be done on this, particularly allowing a resource to
|
||||
* 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()...
|
||||
* [ 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...
|
||||
* [ Note the word "hacked" -- this is extremely ugly, but at
|
||||
* [ least it does the job. NOT a good programming example
|
||||
* [ Note the word "hacked" -- this is extremely ugly, but at
|
||||
* [ least it does the job. NOT a good programming example
|
||||
* [ for X.
|
||||
* original: [ 6/21/85 ] Martin Weiss Sun Microsystems [ SunView ]
|
||||
*
|
||||
******************************************************************************
|
||||
Copyright 1988 by Sun Microsystems, Inc. Mountain View, CA.
|
||||
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
|
||||
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
|
||||
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
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific prior written permission. Sun and M.I.T.
|
||||
make no representations about the suitability of this software for
|
||||
software without specific prior written permission. Sun and M.I.T.
|
||||
make no representations about the suitability of this software for
|
||||
any purpose. It is provided "as is" without any express or implied warranty.
|
||||
|
||||
|
||||
SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. IN NO EVENT SHALL SUN BE LIABLE FOR ANY SPECIAL, INDIRECT
|
||||
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 PERFORMANCE OF THIS SOFTWARE.
|
||||
*****************************************************************************/
|
||||
|
@ -115,7 +115,7 @@ static struct {
|
|||
unsigned char x;
|
||||
unsigned char y;
|
||||
unsigned char dir;
|
||||
unsigned char dummy;
|
||||
unsigned char dummy;
|
||||
} move_list[MOVE_LIST_SIZE], save_path[MOVE_LIST_SIZE], path[MOVE_LIST_SIZE];
|
||||
|
||||
static int maze_size_x, maze_size_y;
|
||||
|
@ -139,50 +139,50 @@ static void
|
|||
initialize_maze() /* draw the surrounding wall and start/end squares */
|
||||
{
|
||||
register int i, j, wall;
|
||||
|
||||
|
||||
/* initialize all squares */
|
||||
for ( i=0; i<maze_size_x; i++) {
|
||||
for ( j=0; j<maze_size_y; j++) {
|
||||
maze[i][j] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* top wall */
|
||||
for ( i=0; i<maze_size_x; i++ ) {
|
||||
maze[i][0] |= WALL_TOP;
|
||||
}
|
||||
|
||||
|
||||
/* right wall */
|
||||
for ( j=0; j<maze_size_y; j++ ) {
|
||||
maze[maze_size_x-1][j] |= WALL_RIGHT;
|
||||
}
|
||||
|
||||
|
||||
/* bottom wall */
|
||||
for ( i=0; i<maze_size_x; i++ ) {
|
||||
maze[i][maze_size_y-1] |= WALL_BOTTOM;
|
||||
}
|
||||
|
||||
|
||||
/* left wall */
|
||||
for ( j=0; j<maze_size_y; j++ ) {
|
||||
maze[0][j] |= WALL_LEFT;
|
||||
}
|
||||
|
||||
|
||||
/* set start square */
|
||||
wall = get_random(4);
|
||||
switch (wall) {
|
||||
case 0:
|
||||
case 0:
|
||||
i = get_random(maze_size_x);
|
||||
j = 0;
|
||||
break;
|
||||
case 1:
|
||||
case 1:
|
||||
i = maze_size_x - 1;
|
||||
j = get_random(maze_size_y);
|
||||
break;
|
||||
case 2:
|
||||
case 2:
|
||||
i = get_random(maze_size_x);
|
||||
j = maze_size_y - 1;
|
||||
break;
|
||||
case 3:
|
||||
case 3:
|
||||
i = 0;
|
||||
j = get_random(maze_size_y);
|
||||
break;
|
||||
|
@ -196,7 +196,7 @@ initialize_maze() /* draw the surrounding wall and start/end squares */
|
|||
start_y = j;
|
||||
start_dir = wall;
|
||||
sqnum = 0;
|
||||
|
||||
|
||||
/* set end square */
|
||||
wall = (wall + 2)%4;
|
||||
switch (wall) {
|
||||
|
@ -236,7 +236,7 @@ create_maze() /* create a maze layout given the intiialized maze */
|
|||
{
|
||||
register int i, newdoor = 0;
|
||||
HDC hDC;
|
||||
|
||||
|
||||
hDC = GetDC(hWnd);
|
||||
do {
|
||||
move_list[sqnum].x = cur_sq_x;
|
||||
|
@ -248,10 +248,10 @@ create_maze() /* create a maze layout given the intiialized maze */
|
|||
return; /* done ... return */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* mark the out door */
|
||||
maze[cur_sq_x][cur_sq_y] |= ( DOOR_OUT_TOP >> newdoor );
|
||||
|
||||
|
||||
switch (newdoor) {
|
||||
case 0: cur_sq_y--;
|
||||
break;
|
||||
|
@ -263,10 +263,10 @@ create_maze() /* create a maze layout given the intiialized maze */
|
|||
break;
|
||||
}
|
||||
sqnum++;
|
||||
|
||||
|
||||
/* mark the in door */
|
||||
maze[cur_sq_x][cur_sq_y] |= ( DOOR_IN_TOP >> ((newdoor+2)%4) );
|
||||
|
||||
|
||||
/* if end square set path length and save path */
|
||||
if ( maze[cur_sq_x][cur_sq_y] & END_SQUARE ) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} while (1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -287,9 +287,9 @@ choose_door(HDC hDC) /* pick a new path */
|
|||
{
|
||||
int candidates[3];
|
||||
register int num_candidates;
|
||||
|
||||
|
||||
num_candidates = 0;
|
||||
|
||||
|
||||
/* top wall */
|
||||
if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_TOP )
|
||||
goto rightwall;
|
||||
|
@ -304,7 +304,7 @@ choose_door(HDC hDC) /* pick a new path */
|
|||
goto rightwall;
|
||||
}
|
||||
candidates[num_candidates++] = 0;
|
||||
|
||||
|
||||
rightwall:
|
||||
/* right wall */
|
||||
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;
|
||||
}
|
||||
candidates[num_candidates++] = 1;
|
||||
|
||||
|
||||
bottomwall:
|
||||
/* bottom wall */
|
||||
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;
|
||||
}
|
||||
candidates[num_candidates++] = 2;
|
||||
|
||||
|
||||
leftwall:
|
||||
/* left wall */
|
||||
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;
|
||||
}
|
||||
candidates[num_candidates++] = 3;
|
||||
|
||||
|
||||
donewall:
|
||||
if (num_candidates == 0)
|
||||
return ( -1 );
|
||||
if (num_candidates == 1)
|
||||
return ( candidates[0] );
|
||||
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;
|
||||
|
||||
switch (dir) {
|
||||
case 0:
|
||||
case 0:
|
||||
rc.left = border_x + bw + grid_width * i;
|
||||
rc.right = rc.left + grid_width - (bw + bw);
|
||||
rc.top = border_y - bw + grid_height * j;
|
||||
rc.bottom = rc.top + grid_height;
|
||||
break;
|
||||
case 1:
|
||||
case 1:
|
||||
rc.left = border_x + bw + grid_width * i;
|
||||
rc.right = rc.left + grid_width;
|
||||
rc.top = border_y + bw + grid_height * j;
|
||||
rc.bottom = rc.top + grid_height - (bw + bw);
|
||||
break;
|
||||
case 2:
|
||||
case 2:
|
||||
rc.left = border_x + bw + grid_width * i;
|
||||
rc.right = rc.left + grid_width - (bw + bw);
|
||||
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;
|
||||
HBRUSH hBrush;
|
||||
|
||||
|
||||
|
||||
|
||||
for ( i=0; i<maze_size_x; i++) {
|
||||
if ( maze[i][0] & WALL_TOP ) {
|
||||
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) {
|
||||
case 0:
|
||||
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);
|
||||
break;
|
||||
case 1:
|
||||
|
@ -471,13 +471,13 @@ draw_wall(i, j, dir, hDC) /* draw a single wal
|
|||
case 2:
|
||||
MoveToEx(hDC, border_x + grid_width * i, border_y + grid_height * (j+1),
|
||||
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));
|
||||
break;
|
||||
case 3:
|
||||
MoveToEx(hDC, border_x + grid_width * i, border_y + grid_height * j,
|
||||
NULL);
|
||||
(void) LineTo(hDC, border_x + grid_width * i,
|
||||
(void) LineTo(hDC, border_x + grid_width * i,
|
||||
border_y + grid_height * (j+1));
|
||||
break;
|
||||
}
|
||||
|
@ -497,11 +497,11 @@ begin_solve_maze() /* solve it with graphical feedba
|
|||
0xaaaaaaaa
|
||||
};
|
||||
static RGBQUAD argbq[] = {
|
||||
{ 0, 0, 255, 0 },
|
||||
{ 0, 0, 255, 0 },
|
||||
{ 255, 255, 255, 0 }
|
||||
};
|
||||
BITMAPINFO *pbmi;
|
||||
|
||||
|
||||
hDC = GetDC(hWnd);
|
||||
pbmi = malloc(sizeof(BITMAPINFOHEADER) + sizeof(argbq) + sizeof(grayPattern));
|
||||
pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
|
@ -525,31 +525,31 @@ begin_solve_maze() /* solve it with graphical feedba
|
|||
/* plug up the surrounding wall */
|
||||
maze[start_x][start_y] |= (WALL_TOP >> start_dir);
|
||||
maze[end_x][end_y] |= (WALL_TOP >> end_dir);
|
||||
|
||||
|
||||
/* initialize search path */
|
||||
pathi = 0;
|
||||
path[pathi].x = end_x;
|
||||
path[pathi].y = end_y;
|
||||
path[pathi].dir = -1;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
solve_maze() /* solve it with graphical feedback */
|
||||
{
|
||||
int ret;
|
||||
int action_done;
|
||||
|
||||
|
||||
do {
|
||||
action_done = 1;
|
||||
if ( ++path[pathi].dir >= 4 ) {
|
||||
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);
|
||||
ret = 0;
|
||||
}
|
||||
else if ( ! (maze[path[pathi].x][path[pathi].y] &
|
||||
(WALL_TOP >> path[pathi].dir)) &&
|
||||
( (pathi == 0) || ( (path[pathi].dir !=
|
||||
else if ( ! (maze[path[pathi].x][path[pathi].y] &
|
||||
(WALL_TOP >> path[pathi].dir)) &&
|
||||
( (pathi == 0) || ( (path[pathi].dir !=
|
||||
(int)(path[pathi-1].dir+2)%4) ) ) ) {
|
||||
enter_square(pathi, hDC, hBrushLiving);
|
||||
pathi++;
|
||||
|
@ -567,15 +567,15 @@ solve_maze() /* solve it with graphical feedback */
|
|||
} while (! action_done);
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
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);
|
||||
|
||||
|
||||
path[n+1].dir = -1;
|
||||
switch (path[n].dir) {
|
||||
case 0: path[n+1].x = path[n].x;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
//
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
|
||||
|
||||
#include "main.h"
|
||||
#include "framewnd.h"
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <tchar.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#include "main.h"
|
||||
#include "framewnd.h"
|
||||
|
||||
|
@ -109,7 +109,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
|||
// Initialize global strings
|
||||
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
|
||||
LoadString(hInstance, IDC_ZOOMIN, szFrameClass, MAX_LOADSTRING);
|
||||
|
||||
|
||||
// Store instance handle in our global variable
|
||||
hInst = hInstance;
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ static void AddStatusMsg(DFWINDOW wnd, DF_PARAM p1)
|
|||
if (wnd->StatusBar != NULL) {
|
||||
if (p1 && *(char *)p1)
|
||||
DfSendMessage(wnd->StatusBar, DFM_SETTEXT, p1, 0);
|
||||
else
|
||||
else
|
||||
DfSendMessage(wnd->StatusBar, DFM_CLEARTEXT, 0, 0);
|
||||
DfSendMessage(wnd->StatusBar, DFM_PAINT, 0, 0);
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ static void SetFocusMsg(DFWINDOW wnd, BOOL p1)
|
|||
DfInFocus = p1 ? wnd : NULL;
|
||||
if (DfIsVisible(wnd))
|
||||
DfSendMessage(wnd, DFM_BORDER, 0, 0);
|
||||
else
|
||||
else
|
||||
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 (DfInFocus == wnd->MenuBarWnd || DfInFocus == wnd->StatusBar)
|
||||
oldFocus = DfApplicationWindow;
|
||||
else
|
||||
else
|
||||
oldFocus = DfInFocus;
|
||||
DfSendMessage(wnd, DFM_HIDE_WINDOW, 0, 0);
|
||||
SelectColors(wnd);
|
||||
|
@ -389,7 +389,7 @@ static char *WindowName(DFWINDOW wnd)
|
|||
{
|
||||
if (DfGetClass(wnd) == DF_DIALOG)
|
||||
return ((DF_DBOX *)(wnd->extension))->HelpName;
|
||||
else
|
||||
else
|
||||
return "Untitled";
|
||||
}
|
||||
else
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* You must add entries to the DfColor tables in
|
||||
* DFCONFIG.C for new classes.
|
||||
*
|
||||
* Class Name Base Class Processor Attribute
|
||||
* Class Name Base Class Processor Attribute
|
||||
* ------------ --------- --------------- -----------
|
||||
*/
|
||||
DfClassDef( DF_NORMAL, -1, DfNormalProc, 0 )
|
||||
|
|
|
@ -449,7 +449,7 @@ void DfBuildFileName(char *path, char *ext)
|
|||
cp = strrchr(path, '\\');
|
||||
if (cp == NULL)
|
||||
cp = path;
|
||||
else
|
||||
else
|
||||
cp++;
|
||||
strcpy(cp, DFlatApplication);
|
||||
strcat(cp, ext);
|
||||
|
|
|
@ -529,11 +529,11 @@ void DfSetScrollBars(DFWINDOW wnd)
|
|||
int oldattr = DfGetAttribute(wnd);
|
||||
if (wnd->wlines > DfClientHeight(wnd))
|
||||
DfAddAttribute(wnd, DF_VSCROLLBAR);
|
||||
else
|
||||
else
|
||||
DfClearAttribute(wnd, DF_VSCROLLBAR);
|
||||
if (wnd->textwidth > DfClientWidth(wnd))
|
||||
DfAddAttribute(wnd, DF_HSCROLLBAR);
|
||||
else
|
||||
else
|
||||
DfClearAttribute(wnd, DF_HSCROLLBAR);
|
||||
if (DfGetAttribute(wnd) != oldattr)
|
||||
DfSendMessage(wnd, DFM_BORDER, 0, 0);
|
||||
|
@ -643,15 +643,15 @@ static void FixColors(DFWINDOW wnd)
|
|||
{
|
||||
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];
|
||||
wnd->WindowColors[DF_FRAME_COLOR][DF_BG] =
|
||||
wnd->WindowColors[DF_FRAME_COLOR][DF_BG] =
|
||||
DfGetParent(wnd)->WindowColors[DF_FRAME_COLOR][DF_BG];
|
||||
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];
|
||||
wnd->WindowColors[DF_STD_COLOR][DF_BG] =
|
||||
wnd->WindowColors[DF_STD_COLOR][DF_BG] =
|
||||
DfGetParent(wnd)->WindowColors[DF_STD_COLOR][DF_BG];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -183,7 +183,7 @@ static int DlgFnOpen(DFWINDOW wnd,DFMESSAGE msg,DF_PARAM p1,DF_PARAM p2)
|
|||
DfGetItemText(wnd, DF_ID_PATH, FileSpec, 65);
|
||||
strcat(FileSpec, FileName);
|
||||
}
|
||||
else
|
||||
else
|
||||
strcpy(FileSpec, FileName);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -398,7 +398,7 @@ static void FlipSelection(DFWINDOW wnd, int sel)
|
|||
}
|
||||
|
||||
static int ExtendSelections(DFWINDOW wnd, int sel, int shift)
|
||||
{
|
||||
{
|
||||
if (shift & (DF_LEFTSHIFT | DF_RIGHTSHIFT) &&
|
||||
wnd->AnchorPoint != -1) {
|
||||
int i = sel;
|
||||
|
|
|
@ -125,7 +125,7 @@ static int MemoPadProc(DFWINDOW wnd,DFMESSAGE msg,DF_PARAM p1,DF_PARAM p2)
|
|||
case DF_ID_PRINT:
|
||||
PrintPad(DfInFocus);
|
||||
return TRUE;
|
||||
case DF_ID_EXIT:
|
||||
case DF_ID_EXIT:
|
||||
if (!DfYesNoBox("Exit Memopad?"))
|
||||
return FALSE;
|
||||
break;
|
||||
|
@ -144,7 +144,7 @@ static int MemoPadProc(DFWINDOW wnd,DFMESSAGE msg,DF_PARAM p1,DF_PARAM p2)
|
|||
FixTabMenu();
|
||||
return TRUE;
|
||||
case DF_ID_TAB6:
|
||||
DfCfg.Tabs = 6;
|
||||
DfCfg.Tabs = 6;
|
||||
FixTabMenu();
|
||||
return TRUE;
|
||||
case DF_ID_TAB8:
|
||||
|
@ -254,7 +254,7 @@ static void OpenPadWindow(DFWINDOW wnd, char *FileName)
|
|||
}
|
||||
DfSendMessage(wwnd, DFM_CLOSE_WINDOW, 0, 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 --- */
|
||||
|
@ -414,7 +414,7 @@ static int EditorProc(DFWINDOW wnd,DFMESSAGE msg,DF_PARAM p1,DF_PARAM p2)
|
|||
rtn = DfDefaultWndProc(wnd, msg, p1, p2);
|
||||
if ((int)p1 == FALSE)
|
||||
DfSendMessage(DfGetParent(wnd), DFM_ADDSTATUS, 0, 0);
|
||||
else
|
||||
else
|
||||
ShowPosition(wnd);
|
||||
return rtn;
|
||||
case DFM_KEYBOARD_CURSOR:
|
||||
|
|
|
@ -49,7 +49,7 @@ typedef struct DfMenuBar {
|
|||
#define DF_INACTIVE 1
|
||||
#define DF_CHECKED 2
|
||||
#define DF_TOGGLE 4
|
||||
#define DF_CASCADED 8
|
||||
#define DF_CASCADED 8
|
||||
|
||||
/* --------- the standard menus ---------- */
|
||||
extern DF_MBAR DfMainMenu;
|
||||
|
|
|
@ -196,7 +196,7 @@ static void KeyboardMsg(DFWINDOW wnd, DF_PARAM p1)
|
|||
if (mwnd != NULL)
|
||||
DfSendMessage(wnd, DFM_MB_SELECTION,
|
||||
DfActiveMenuBar->ActiveSelection, 0);
|
||||
else
|
||||
else
|
||||
DfSendMessage(wnd, DFM_PAINT, 0, 0);
|
||||
break;
|
||||
case DF_BS:
|
||||
|
@ -207,7 +207,7 @@ static void KeyboardMsg(DFWINDOW wnd, DF_PARAM p1)
|
|||
if (mwnd != NULL)
|
||||
DfSendMessage(wnd, DFM_MB_SELECTION,
|
||||
DfActiveMenuBar->ActiveSelection, 0);
|
||||
else
|
||||
else
|
||||
DfSendMessage(wnd, DFM_PAINT, 0, 0);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -593,7 +593,7 @@ BOOL DfDispatchMessage (void)
|
|||
while (EventQueueCtr > 0)
|
||||
{
|
||||
struct events ev;
|
||||
|
||||
|
||||
ev = EventQueue[EventQueueOffCtr];
|
||||
if (++EventQueueOffCtr == DF_MAXMESSAGES)
|
||||
EventQueueOffCtr = 0;
|
||||
|
|
|
@ -123,7 +123,7 @@ BOOL DfInputBox(DFWINDOW wnd,char *ttl,char *msg,char *text,int len)
|
|||
InputText = text;
|
||||
TextLength = len;
|
||||
InputBoxDB.dwnd.title = ttl;
|
||||
InputBoxDB.dwnd.w = 4 +
|
||||
InputBoxDB.dwnd.w = 4 +
|
||||
max(20, max(len, max((int)strlen(ttl), (int)strlen(msg))));
|
||||
InputBoxDB.ctl[1].dwnd.x = (InputBoxDB.dwnd.w-2-len)/2;
|
||||
InputBoxDB.ctl[0].dwnd.w = strlen(msg);
|
||||
|
|
|
@ -74,7 +74,7 @@ static int FindVector(DFWINDOW wnd, DFRECT rc, int x, int y)
|
|||
coll = 0;
|
||||
else if (rc.lf+x == rcc.rt)
|
||||
coll = 2;
|
||||
else
|
||||
else
|
||||
coll = 1;
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ static int FindVector(DFWINDOW wnd, DFRECT rc, int x, int y)
|
|||
coll = 0;
|
||||
else if (rc.tp+y == rcc.bt)
|
||||
coll = 2;
|
||||
else
|
||||
else
|
||||
coll = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -228,7 +228,7 @@ static BOOL KeyboardMsg(DFWINDOW wnd, DF_PARAM p1, DF_PARAM p2)
|
|||
case DF_F1:
|
||||
if (ActivePopDown == NULL)
|
||||
DfSendMessage(DfGetParent(wnd), DFM_KEYBOARD, p1, p2);
|
||||
else
|
||||
else
|
||||
DfDisplayHelp(wnd,
|
||||
(ActivePopDown+wnd->selection)->help);
|
||||
return TRUE;
|
||||
|
|
|
@ -14,7 +14,7 @@ int DfStatusBarProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2)
|
|||
if ((int)p1 == DF_CTRL_F4)
|
||||
return TRUE;
|
||||
break;
|
||||
case DFM_PAINT:
|
||||
case DFM_PAINT:
|
||||
if (!DfIsVisible(wnd))
|
||||
break;
|
||||
statusbar = DfCalloc(1, DfWindowWidth(wnd)+1);
|
||||
|
|
|
@ -45,7 +45,7 @@ void DfBuildSystemMenu(DFWINDOW wnd)
|
|||
int lf, tp, ht, wd;
|
||||
DFWINDOW SystemMenuWnd;
|
||||
|
||||
DfSystemMenu.PullDown[0].Selections[6].Accelerator =
|
||||
DfSystemMenu.PullDown[0].Selections[6].Accelerator =
|
||||
(DfGetClass(wnd) == DF_APPLICATION) ? DF_ALT_F4 : DF_CTRL_F4;
|
||||
|
||||
lf = DfGetLeft(wnd)+1;
|
||||
|
|
|
@ -713,7 +713,7 @@ void DfWriteTextLine(DFWINDOW wnd, DFRECT *rcc, int y, BOOL reverse)
|
|||
if (*(lp+i) && i < wnd->wleft+3) {
|
||||
if (wnd->wleft+4 > lnlen)
|
||||
trunc = TRUE;
|
||||
else
|
||||
else
|
||||
lp += 4;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#define IDM_HELP_ABOUT 40006
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 105
|
||||
|
|
|
@ -81,7 +81,7 @@ static void AddStatusMsg(DFWINDOW wnd, PARAM p1)
|
|||
if (wnd->StatusBar != NULL) {
|
||||
if (p1 && *(char *)p1)
|
||||
DfSendMessage(wnd->StatusBar, SETTEXT, p1, 0);
|
||||
else
|
||||
else
|
||||
DfSendMessage(wnd->StatusBar, CLEARTEXT, 0, 0);
|
||||
DfSendMessage(wnd->StatusBar, PAINT, 0, 0);
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ static void SetFocusMsg(DFWINDOW wnd, BOOL p1)
|
|||
inFocus = p1 ? wnd : NULL;
|
||||
if (isVisible(wnd))
|
||||
DfSendMessage(wnd, BORDER, 0, 0);
|
||||
else
|
||||
else
|
||||
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 (inFocus == wnd->MenuBarWnd || inFocus == wnd->StatusBar)
|
||||
oldFocus = ApplicationWindow;
|
||||
else
|
||||
else
|
||||
oldFocus = inFocus;
|
||||
DfSendMessage(wnd, DFM_HIDE_WINDOW, 0, 0);
|
||||
SelectColors(wnd);
|
||||
|
@ -389,7 +389,7 @@ static char *WindowName(DFWINDOW wnd)
|
|||
{
|
||||
if (GetClass(wnd) == DIALOG)
|
||||
return ((DBOX *)(wnd->extension))->HelpName;
|
||||
else
|
||||
else
|
||||
return "Untitled";
|
||||
}
|
||||
else
|
||||
|
|
|
@ -449,7 +449,7 @@ void BuildFileName(char *path, char *ext)
|
|||
cp = strrchr(path, '\\');
|
||||
if (cp == NULL)
|
||||
cp = path;
|
||||
else
|
||||
else
|
||||
cp++;
|
||||
strcpy(cp, DFlatApplication);
|
||||
strcat(cp, ext);
|
||||
|
|
|
@ -529,11 +529,11 @@ void SetScrollBars(DFWINDOW wnd)
|
|||
int oldattr = GetAttribute(wnd);
|
||||
if (wnd->wlines > ClientHeight(wnd))
|
||||
AddAttribute(wnd, VSCROLLBAR);
|
||||
else
|
||||
else
|
||||
ClearAttribute(wnd, VSCROLLBAR);
|
||||
if (wnd->textwidth > ClientWidth(wnd))
|
||||
AddAttribute(wnd, HSCROLLBAR);
|
||||
else
|
||||
else
|
||||
ClearAttribute(wnd, HSCROLLBAR);
|
||||
if (GetAttribute(wnd) != oldattr)
|
||||
DfSendMessage(wnd, BORDER, 0, 0);
|
||||
|
@ -643,15 +643,15 @@ static void FixColors(DFWINDOW wnd)
|
|||
{
|
||||
if (ct->class != SPINBUTTON && ct->class != COMBOBOX)
|
||||
{
|
||||
wnd->WindowColors[FRAME_COLOR][FG] =
|
||||
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];
|
||||
if (ct->class != EDITBOX && ct->class != LISTBOX)
|
||||
{
|
||||
wnd->WindowColors[STD_COLOR][FG] =
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* ReactOS DFLAT32.DLL
|
||||
*/
|
||||
|
||||
|
|
|
@ -398,7 +398,7 @@ static void FlipSelection(DFWINDOW wnd, int sel)
|
|||
}
|
||||
|
||||
static int ExtendSelections(DFWINDOW wnd, int sel, int shift)
|
||||
{
|
||||
{
|
||||
if (shift & (LEFTSHIFT | RIGHTSHIFT) &&
|
||||
wnd->AnchorPoint != -1) {
|
||||
int i = sel;
|
||||
|
|
|
@ -196,7 +196,7 @@ static void KeyboardMsg(DFWINDOW wnd, PARAM p1)
|
|||
if (mwnd != NULL)
|
||||
DfSendMessage(wnd, MB_SELECTION,
|
||||
ActiveMenuBar->ActiveSelection, 0);
|
||||
else
|
||||
else
|
||||
DfSendMessage(wnd, PAINT, 0, 0);
|
||||
break;
|
||||
case BS:
|
||||
|
@ -207,7 +207,7 @@ static void KeyboardMsg(DFWINDOW wnd, PARAM p1)
|
|||
if (mwnd != NULL)
|
||||
DfSendMessage(wnd, MB_SELECTION,
|
||||
ActiveMenuBar->ActiveSelection, 0);
|
||||
else
|
||||
else
|
||||
DfSendMessage(wnd, PAINT, 0, 0);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -593,7 +593,7 @@ BOOL DfDispatchMessage (void)
|
|||
while (EventQueueCtr > 0)
|
||||
{
|
||||
struct events ev;
|
||||
|
||||
|
||||
ev = EventQueue[EventQueueOffCtr];
|
||||
if (++EventQueueOffCtr == MAXMESSAGES)
|
||||
EventQueueOffCtr = 0;
|
||||
|
|
|
@ -123,7 +123,7 @@ BOOL InputBox(DFWINDOW wnd,char *ttl,char *msg,char *text,int len)
|
|||
InputText = text;
|
||||
TextLength = len;
|
||||
InputBoxDB.dwnd.title = ttl;
|
||||
InputBoxDB.dwnd.w = 4 +
|
||||
InputBoxDB.dwnd.w = 4 +
|
||||
max(20, max(len, max((int)strlen(ttl), (int)strlen(msg))));
|
||||
InputBoxDB.ctl[1].dwnd.x = (InputBoxDB.dwnd.w-2-len)/2;
|
||||
InputBoxDB.ctl[0].dwnd.w = strlen(msg);
|
||||
|
|
|
@ -74,7 +74,7 @@ static int FindVector(DFWINDOW wnd, DFRECT rc, int x, int y)
|
|||
coll = 0;
|
||||
else if (rc.lf+x == rcc.rt)
|
||||
coll = 2;
|
||||
else
|
||||
else
|
||||
coll = 1;
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ static int FindVector(DFWINDOW wnd, DFRECT rc, int x, int y)
|
|||
coll = 0;
|
||||
else if (rc.tp+y == rcc.bt)
|
||||
coll = 2;
|
||||
else
|
||||
else
|
||||
coll = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -228,7 +228,7 @@ static BOOL KeyboardMsg(DFWINDOW wnd, PARAM p1, PARAM p2)
|
|||
case F1:
|
||||
if (ActivePopDown == NULL)
|
||||
DfSendMessage(GetParent(wnd), KEYBOARD, p1, p2);
|
||||
else
|
||||
else
|
||||
DisplayHelp(wnd,
|
||||
(ActivePopDown+wnd->selection)->help);
|
||||
return TRUE;
|
||||
|
|
|
@ -14,7 +14,7 @@ int StatusBarProc(DFWINDOW wnd, DFMESSAGE msg, PARAM p1, PARAM p2)
|
|||
if ((int)p1 == CTRL_F4)
|
||||
return TRUE;
|
||||
break;
|
||||
case PAINT:
|
||||
case PAINT:
|
||||
if (!isVisible(wnd))
|
||||
break;
|
||||
statusbar = DFcalloc(1, WindowWidth(wnd)+1);
|
||||
|
|
|
@ -8,7 +8,7 @@ int TestCriticalError(void)
|
|||
/* These are functions that are supposed to be part of the application
|
||||
* not part of the dflat32.dll
|
||||
*
|
||||
* - Fixme
|
||||
* - Fixme
|
||||
*/
|
||||
|
||||
char DFlatApplication[] = "none"; //edit.c
|
||||
|
|
|
@ -45,7 +45,7 @@ void BuildSystemMenu(DFWINDOW wnd)
|
|||
int lf, tp, ht, wd;
|
||||
DFWINDOW SystemMenuWnd;
|
||||
|
||||
SystemMenu.PullDown[0].Selections[6].Accelerator =
|
||||
SystemMenu.PullDown[0].Selections[6].Accelerator =
|
||||
(GetClass(wnd) == APPLICATION) ? ALT_F4 : CTRL_F4;
|
||||
|
||||
lf = GetLeft(wnd)+1;
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
/* This is the configuration file for the Midnight Commander. It was generated
|
||||
by autoconf's configure.
|
||||
|
||||
|
||||
Configure for Midnight Commander
|
||||
Copyright (C) 1994, 1995 Janne Kukonlehto
|
||||
Copyright (C) 1994, 1995 Miguel de Icaza
|
||||
Copyright (C) 1995 Jakub Jelinek
|
||||
|
||||
|
||||
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
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
|
||||
#include <VERSION>
|
||||
|
||||
|
||||
|
@ -78,7 +78,7 @@
|
|||
#undef HAVE_SUBSHELL_SUPPORT
|
||||
|
||||
/* If you don't have gcc, define this */
|
||||
#undef OLD_TOOLS
|
||||
#undef OLD_TOOLS
|
||||
|
||||
/* Are you using other type of curses? */
|
||||
#undef OTHER_CURSES
|
||||
|
@ -120,7 +120,7 @@
|
|||
#undef USE_NETCODE
|
||||
|
||||
/* 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
|
||||
* in a struct dirent, then define this
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
/* config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
/* This is the configuration file for the Midnight Commander. It was generated
|
||||
by autoconf's configure.
|
||||
|
||||
|
||||
Configure for Midnight Commander
|
||||
Copyright (C) 1994, 1995 Janne Kukonlehto
|
||||
Copyright (C) 1994, 1995 Miguel de Icaza
|
||||
Copyright (C) 1995 Jakub Jelinek
|
||||
|
||||
|
||||
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
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
|
||||
#include <VERSION>
|
||||
|
||||
|
||||
|
@ -172,7 +172,7 @@
|
|||
#define HAVE_SUBSHELL_SUPPORT 1
|
||||
|
||||
/* If you don't have gcc, define this */
|
||||
/* #undef OLD_TOOLS */
|
||||
/* #undef OLD_TOOLS */
|
||||
|
||||
/* Is the subshell the default or optional? */
|
||||
/* #undef SUBSHELL_OPTIONAL */
|
||||
|
@ -208,7 +208,7 @@
|
|||
#define USE_NETCODE 1
|
||||
|
||||
/* 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
|
||||
* in a struct dirent, then define this
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* editor low level data handling and cursor fundamentals.
|
||||
|
||||
Copyright (C) 1996, 1997 the Free Software Foundation
|
||||
|
||||
|
||||
Authors: 1996, 1997 Paul Sheer
|
||||
|
||||
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
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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.)
|
||||
*
|
||||
*
|
||||
* (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
|
||||
* ______________________________________|______________________________________
|
||||
|
@ -55,7 +55,7 @@
|
|||
* file end|||file beginning
|
||||
* |
|
||||
* |
|
||||
*
|
||||
*
|
||||
* _
|
||||
* This_is_some_file
|
||||
* fin.
|
||||
|
@ -100,14 +100,14 @@ char *edit_get_buffer_as_text (WEdit * e)
|
|||
/* cursor set to start of file */
|
||||
int init_dynamic_edit_buffers (WEdit * edit, const char *filename, const char *text)
|
||||
{
|
||||
|
||||
|
||||
#if defined CR_LF_TRANSLATION
|
||||
/* Variables needed for safe handling of Translation from Microsoft CR/LF EOL to
|
||||
Unix Style LF EOL - Franco */
|
||||
long bytes_wanted,bytes_read,bytes_missing;
|
||||
char *p;
|
||||
#endif
|
||||
|
||||
|
||||
long buf;
|
||||
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);
|
||||
|
||||
/*
|
||||
_read returns the number of bytes read,
|
||||
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,
|
||||
in which case each carriage return–linefeed (CR-LF) pair is replaced
|
||||
with a single linefeed character. Only the single linefeed character is counted
|
||||
_read returns the number of bytes read,
|
||||
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,
|
||||
in which case each carriage return–linefeed (CR-LF) pair is replaced
|
||||
with a single linefeed character. Only the single linefeed character is counted
|
||||
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.
|
||||
A return value of -1 indicates an error; in this case, errno is set to EBADF,
|
||||
_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,
|
||||
which indicates an invalid file handle.
|
||||
*/
|
||||
if (filename){
|
||||
|
@ -381,7 +381,7 @@ int edit_renew (WEdit * edit)
|
|||
dir = strdup (edit->dir);
|
||||
else
|
||||
dir = 0;
|
||||
|
||||
|
||||
edit_clean (edit);
|
||||
if (!edit_init (edit, lines, columns, 0, "", dir, 0))
|
||||
return 0;
|
||||
|
@ -1163,7 +1163,7 @@ int line_is_blank (WEdit * edit, long line)
|
|||
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 */
|
||||
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 (is_in_indent (edit)) {
|
||||
/*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. */
|
||||
if (right_of_four_spaces (edit)) {
|
||||
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);
|
||||
|
||||
/*
|
||||
/*
|
||||
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
|
||||
that if it is called many times, a single undo command will undo
|
||||
|
|
|
@ -17,11 +17,11 @@
|
|||
# include "../src/tty.h"
|
||||
# include <sys/stat.h>
|
||||
# include <errno.h>
|
||||
|
||||
|
||||
# ifdef HAVE_FCNTL_H
|
||||
# include <fcntl.h>
|
||||
# endif
|
||||
|
||||
|
||||
# include <stdlib.h>
|
||||
# include <malloc.h>
|
||||
|
||||
|
@ -31,18 +31,18 @@
|
|||
# include <stdio.h>
|
||||
# include <stdarg.h>
|
||||
# include <sys/types.h>
|
||||
|
||||
|
||||
# ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
# endif
|
||||
|
||||
|
||||
# include <my_string.h>
|
||||
# include <sys/stat.h>
|
||||
|
||||
|
||||
# ifdef HAVE_FCNTL_H
|
||||
# include <fcntl.h>
|
||||
# endif
|
||||
|
||||
|
||||
# include <stdlib.h>
|
||||
# include <stdarg.h>
|
||||
|
||||
|
@ -56,7 +56,7 @@
|
|||
# include <time.h>
|
||||
# endif
|
||||
# endif
|
||||
|
||||
|
||||
# include "regex.h"
|
||||
|
||||
#endif
|
||||
|
@ -91,7 +91,7 @@
|
|||
# include "../src/menu.h"
|
||||
# include "../src/regex.h"
|
||||
# define WANT_WIDGETS
|
||||
|
||||
|
||||
# define WIDGET_COMMAND (WIDGET_USER + 10)
|
||||
# define N_menus 5
|
||||
|
||||
|
@ -282,9 +282,9 @@ struct editor_widget {
|
|||
deleted at all since last load or save */
|
||||
#ifdef MIDNIGHT
|
||||
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 */
|
||||
#endif
|
||||
#endif
|
||||
unsigned char highlight;
|
||||
long prev_col; /*recent column position of the curser - used when moving
|
||||
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_MEAN_WIDTH 1
|
||||
|
||||
|
||||
# define get_sys_error(s) (s)
|
||||
# define open mc_open
|
||||
# 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_save_file(d,f,h) input_dialog (h, _(" Enter file name: "), f)
|
||||
# define CMalloc(x) malloc(x)
|
||||
|
||||
|
||||
# define set_error_msg(s) edit_init_error_msg = strdup(s)
|
||||
|
||||
# ifdef _EDIT_C
|
||||
|
@ -502,7 +502,7 @@ extern char *edit_init_error_msg;
|
|||
|
||||
# define MY_O_TEXT 0
|
||||
# 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_save_file(d,f,h) CGetSaveFile(WIN_MESSAGES,d,f,h)
|
||||
# define edit_error_dialog(h,t) CErrorDialog(WIN_MESSAGES,h,"%s",t)
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
KEY_F (17), CK_Find_Again,
|
||||
ALT ('<'), CK_Beginning_Of_Text,
|
||||
ALT ('>'), CK_End_Of_Text,
|
||||
|
||||
|
||||
0, 0};
|
||||
|
||||
static long key_pad_map[10] =
|
||||
|
@ -276,7 +276,7 @@
|
|||
goto fin;
|
||||
|
||||
/* 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'" */
|
||||
|
||||
/* key.h: #define ALT(x) (0x200 | (x)) */
|
||||
|
|
|
@ -410,8 +410,8 @@ int edit_save_as_cmd (WEdit * edit)
|
|||
different_filename = 1;
|
||||
if ((file = open ((char *) exp, O_RDONLY)) != -1) { /* the file exists */
|
||||
close (file);
|
||||
if (edit_query_dialog2 (_(" Warning "),
|
||||
_(" A file already exists with this name. "),
|
||||
if (edit_query_dialog2 (_(" Warning "),
|
||||
_(" A file already exists with this name. "),
|
||||
/* Push buttons to over-write the current file, or cancel the operation */
|
||||
_("Overwrite"), _("Cancel")))
|
||||
return 0;
|
||||
|
@ -423,7 +423,7 @@ int edit_save_as_cmd (WEdit * edit)
|
|||
edit->modified = 0;
|
||||
#ifdef MIDNIGHT
|
||||
edit->delete_file = 0;
|
||||
#endif
|
||||
#endif
|
||||
if (different_filename && !edit->explicit_syntax)
|
||||
edit_load_syntax (edit, 0, 0);
|
||||
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
|
||||
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 */
|
||||
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));
|
||||
#else
|
||||
/* 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 ':' */
|
||||
_(" Press macro hotkey: "))));
|
||||
#endif
|
||||
|
@ -708,7 +708,7 @@ int edit_save_cmd (WEdit * edit)
|
|||
edit->modified = 0;
|
||||
#ifdef MIDNIGHT
|
||||
edit->delete_file = 0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -850,7 +850,7 @@ void edit_block_move_cmd (WEdit * 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));
|
||||
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},
|
||||
{quick_checkbox, 25, 50, 9, REPLACE_DLG_HEIGHT, "Pr&ompt on replace", 0, 0,
|
||||
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},
|
||||
{quick_checkbox, 4, 50, 10, REPLACE_DLG_HEIGHT, "&Regular exprssn", 0, 0,
|
||||
0, 0, XV_WLAY_DONTCARE, NULL},
|
||||
|
@ -1314,9 +1314,9 @@ int edit_replace_prompt (WEdit * edit, char *replace_text, int xpos, int ypos)
|
|||
p++;
|
||||
}
|
||||
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 ':' */
|
||||
catstrs (_(" Replace with: "), r, 0),
|
||||
catstrs (_(" Replace with: "), r, 0),
|
||||
/* Buttons for the confirm replace dialog box. */
|
||||
_("Replace"), _("Skip"), _("Replace all"), _("Cancel"));
|
||||
if (r)
|
||||
|
@ -1457,7 +1457,7 @@ long edit_find_string (long start, unsigned char *exp, int *len, long last_byte,
|
|||
}
|
||||
} else { /* regexp matching */
|
||||
long offset = 0;
|
||||
int found_start, match_bol, move_win = 0;
|
||||
int found_start, match_bol, move_win = 0;
|
||||
|
||||
while (start + offset < last_byte) {
|
||||
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])
|
||||
edit_insert (edit, repl_str[i]);
|
||||
} else {
|
||||
edit_error_dialog (_(" Replace "),
|
||||
edit_error_dialog (_(" Replace "),
|
||||
/* "Invalid regexp string or scanf string" */
|
||||
_(" Error in replacement format string. "));
|
||||
replace_continue = 0;
|
||||
|
@ -1988,7 +1988,7 @@ void edit_quit_cmd (WEdit * edit)
|
|||
case -1:
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef MIDNIGHT
|
||||
else if (edit->delete_file)
|
||||
unlink (catstrs (edit->dir, edit->filename, 0));
|
||||
|
@ -2340,7 +2340,7 @@ int edit_sort_cmd (WEdit * edit)
|
|||
|
||||
exp = old ? old : "";
|
||||
|
||||
exp = input_dialog (_(" Run Sort "),
|
||||
exp = input_dialog (_(" Run Sort "),
|
||||
/* Not essential to translate */
|
||||
_(" 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));
|
||||
if (e) {
|
||||
if (e == -1 || e == 127) {
|
||||
edit_error_dialog (_(" Sort "),
|
||||
edit_error_dialog (_(" Sort "),
|
||||
/* Not essential to translate */
|
||||
get_sys_error (_(" Error trying to execute sort command ")));
|
||||
} else {
|
||||
char q[8];
|
||||
sprintf (q, "%d ", e);
|
||||
edit_error_dialog (_(" Sort "),
|
||||
edit_error_dialog (_(" Sort "),
|
||||
/* Not essential to translate */
|
||||
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 (eval_marks (edit, &start_mark, &end_mark)) {
|
||||
edit_error_dialog (_(" Process block "),
|
||||
edit_error_dialog (_(" Process block "),
|
||||
/* Not essential to translate */
|
||||
_(" You must first highlight a block of text. "));
|
||||
return;
|
||||
|
@ -2415,7 +2415,7 @@ void edit_block_process_cmd (WEdit * edit, const char *shell_cmd, int block)
|
|||
}
|
||||
} else {
|
||||
/* Not essential to translate */
|
||||
edit_error_dialog (_(" Process block "),
|
||||
edit_error_dialog (_(" Process block "),
|
||||
/* Not essential to translate */
|
||||
get_sys_error (_(" Error trying to stat file ")));
|
||||
return;
|
||||
|
|
|
@ -96,7 +96,7 @@ void edit_status (WEdit * edit)
|
|||
extern int fixed_font;
|
||||
|
||||
void rerender_text (CWidget * wdt);
|
||||
|
||||
|
||||
void edit_status (WEdit * edit)
|
||||
{
|
||||
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
|
||||
|
||||
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 left undrawn from a previous key press */
|
||||
edit->force |= REDRAW_PAGE;
|
||||
|
|
|
@ -36,7 +36,7 @@ extern WMenu *edit_menubar;
|
|||
|
||||
#undef edit_message_dialog
|
||||
#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)
|
||||
{
|
||||
|
@ -53,7 +53,7 @@ void edit_wrap_cmd ()
|
|||
char *f;
|
||||
char s[12];
|
||||
sprintf (s, "%d", option_word_wrap_line_length);
|
||||
f = input_dialog (_(" Word wrap "),
|
||||
f = input_dialog (_(" Word wrap "),
|
||||
/* Not essential to translate */
|
||||
_(" Enter line length, 0 for off: "), s);
|
||||
if (f) {
|
||||
|
|
|
@ -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
|
||||
Robert Nation <nation@rocket.sanders.lockheed.com> &
|
||||
mods by mj olesen <olesen@me.QueensU.CA>
|
||||
|
|
|
@ -1054,7 +1054,7 @@ void edit_free_syntax_rules (WEdit * edit)
|
|||
|
||||
#define CURRENT_SYNTAX_RULES_VERSION "22"
|
||||
|
||||
char *syntax_text =
|
||||
char *syntax_text =
|
||||
"# syntax rules version " CURRENT_SYNTAX_RULES_VERSION "\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"
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
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>
|
||||
|
@ -133,8 +133,8 @@ static void strip_newlines (char *t, int size)
|
|||
#ifndef MIDNIGHT
|
||||
int edit_width_of_long_printable (int c);
|
||||
#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)
|
||||
in propfont.c :(
|
||||
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;
|
||||
p = word_start (t, q, size);
|
||||
if (p == -1)
|
||||
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
|
||||
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
|
||||
(i.e. a very long word) */
|
||||
else
|
||||
q = p;
|
||||
|
|
|
@ -103,7 +103,7 @@ struct {
|
|||
WCheck *check;
|
||||
} check_perm[PERMISSIONS] = {
|
||||
|
||||
{
|
||||
{
|
||||
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,
|
||||
chmod_callback, _("[Chmod]"), _("chmod"), DLG_CENTER);
|
||||
|
||||
|
||||
x_set_dialog_title (ch_dlg, _("Chmod command"));
|
||||
|
||||
#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);
|
||||
add_widget (ch_dlg, statl);
|
||||
tk_end_frame ();
|
||||
|
||||
|
||||
run_dlg (ch_dlg); /* retrieve an action */
|
||||
|
||||
|
||||
/* do action */
|
||||
switch (ch_dlg->ret_value){
|
||||
case B_ENTER:
|
||||
|
@ -440,11 +440,11 @@ void chmod_cmd (void)
|
|||
mk_chmod (fname, c_stat); /*.ado */
|
||||
need_update = 1;
|
||||
break;
|
||||
|
||||
|
||||
case B_CANCEL:
|
||||
end_chmod = 1;
|
||||
break;
|
||||
|
||||
|
||||
case B_ALL:
|
||||
case B_MARKED:
|
||||
and_mask = or_mask = 0;
|
||||
|
@ -460,7 +460,7 @@ void chmod_cmd (void)
|
|||
|
||||
apply_mask (sf_stat);
|
||||
break;
|
||||
|
||||
|
||||
case B_SETMRK:
|
||||
and_mask = or_mask = 0;
|
||||
and_mask = ~and_mask;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
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:
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
/* Client interface for General purpose Win32 console save/restore server
|
||||
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
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
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:
|
||||
show_console_contents doesn't know how to write to its window
|
||||
the rest works fine.
|
||||
|
@ -39,7 +39,7 @@ void show_console_contents (int starty, unsigned char begin_line,
|
|||
unsigned char end_line)
|
||||
{
|
||||
COORD c0 = { 0, 0 };
|
||||
COORD csize;
|
||||
COORD csize;
|
||||
SMALL_RECT rect;
|
||||
CHAR_INFO *pchar;
|
||||
|
||||
|
@ -58,7 +58,7 @@ void show_console_contents (int starty, unsigned char begin_line,
|
|||
/* FIXME: this should've work,
|
||||
but refresh() is called after this write :-( */
|
||||
win32APICALL(WriteConsoleOutput (hNew, pchar, csize, c0, &rect));
|
||||
|
||||
|
||||
free (pchar);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/* Client interface for General purpose OS/2 console save/restore server.
|
||||
1997 Alexander Dong <ado@software-ag.de>
|
||||
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
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
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>
|
||||
|
@ -101,7 +101,7 @@ void handle_console (unsigned char action)
|
|||
n = col * row * 2;
|
||||
VioWrtCellStr ((PCH) scr_buffer, (USHORT) n, 0, 0, 0); /* Write it back */
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
/* This is not possible, but if we are here, just save the screen */
|
||||
handle_console(CONSOLE_SAVE);
|
||||
break;
|
||||
|
|
|
@ -15,7 +15,7 @@ DIR *opendir (const char * a_dir)
|
|||
char *c_dir = malloc (strlen(a_dir) + 4);
|
||||
strcpy (c_dir, a_dir);
|
||||
strcat (c_dir, "\\*");
|
||||
|
||||
|
||||
dd_dir->d_handle = FindFirstFile (c_dir, &wfd);
|
||||
if (dd_dir->d_handle == INVALID_HANDLE_VALUE) {
|
||||
err = GetLastError();
|
||||
|
@ -42,7 +42,7 @@ DIR *opendir (const char * a_dir)
|
|||
dd_dir->d_size = wfd.nFileSizeLow;
|
||||
strcpy (dd_dir->d_name, wfd.cFileName);
|
||||
dd_dir->d_first = 1;
|
||||
|
||||
|
||||
free (c_dir);
|
||||
return dd_dir;
|
||||
}
|
||||
|
@ -51,12 +51,12 @@ DIR *readdir( DIR * dd_dir)
|
|||
{
|
||||
int err;
|
||||
WIN32_FIND_DATA wfd;
|
||||
|
||||
|
||||
if (dd_dir->d_first) {
|
||||
dd_dir->d_first = 0;
|
||||
return dd_dir;
|
||||
}
|
||||
|
||||
|
||||
if(!FindNextFile (dd_dir->d_handle, &wfd)) {
|
||||
err = GetLastError();
|
||||
switch (err) {
|
||||
|
@ -81,7 +81,7 @@ DIR *readdir( DIR * dd_dir)
|
|||
dd_dir->d_size = wfd.nFileSizeLow;
|
||||
strcpy (dd_dir->d_name, wfd.cFileName);
|
||||
return dd_dir;
|
||||
}
|
||||
}
|
||||
|
||||
int closedir (DIR *dd_dir)
|
||||
{
|
||||
|
|
|
@ -23,8 +23,8 @@ DIR *opendir (const char * a_dir)
|
|||
strcpy (c_dir, a_dir);
|
||||
strcat (c_dir, "\\*.*");
|
||||
dd_dir->d_handle = (unsigned long*) HDIR_CREATE;
|
||||
|
||||
rc = DosFindFirst(c_dir,
|
||||
|
||||
rc = DosFindFirst(c_dir,
|
||||
(PHDIR) &dd_dir->d_handle,
|
||||
FILE_SYSTEM | FILE_HIDDEN | FILE_DIRECTORY,
|
||||
(PVOID) &FindBuffer,
|
||||
|
@ -42,7 +42,7 @@ DIR *opendir (const char * a_dir)
|
|||
case ERROR_BUFFER_OVERFLOW:
|
||||
errno = ENOMEM;
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
errno = EINVAL;
|
||||
break;
|
||||
}
|
||||
|
@ -50,11 +50,11 @@ DIR *opendir (const char * a_dir)
|
|||
return NULL;
|
||||
}
|
||||
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;
|
||||
strcpy (dd_dir->d_name, FindBuffer.achName);
|
||||
dd_dir->d_first = 1;
|
||||
|
||||
|
||||
free (c_dir);
|
||||
return dd_dir;
|
||||
}
|
||||
|
@ -65,13 +65,13 @@ DIR *readdir( DIR * dd_dir)
|
|||
FILEFINDBUF3 FindBuffer = {0};
|
||||
ULONG FileCount = 1;
|
||||
DIR *ret_dir = (DIR*) malloc (sizeof(DIR));
|
||||
|
||||
|
||||
if (dd_dir->d_first) {
|
||||
dd_dir->d_first = 0;
|
||||
return dd_dir;
|
||||
}
|
||||
|
||||
rc = DosFindNext((HDIR) dd_dir->d_handle,
|
||||
rc = DosFindNext((HDIR) dd_dir->d_handle,
|
||||
(PVOID) &FindBuffer,
|
||||
sizeof(FILEFINDBUF3),
|
||||
&FileCount);
|
||||
|
@ -86,19 +86,19 @@ DIR *readdir( DIR * dd_dir)
|
|||
case ERROR_BUFFER_OVERFLOW:
|
||||
errno = ENOMEM;
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
errno = EINVAL;
|
||||
break;
|
||||
}
|
||||
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_size = FindBuffer.cbFile;
|
||||
strcpy (ret_dir->d_name, FindBuffer.achName);
|
||||
return ret_dir;
|
||||
}
|
||||
}
|
||||
|
||||
int closedir (DIR *dd_dir)
|
||||
{
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* Ch-Drive command for Windows NT and OS/2
|
||||
|
||||
|
||||
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
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
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:
|
||||
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>
|
||||
|
@ -51,7 +51,7 @@ static void drive_cmd(void);
|
|||
#define B_DRIVE_BASE 100
|
||||
#define MAX_LGH 13 /* Length for drives */
|
||||
|
||||
static void drive_cmd()
|
||||
static void drive_cmd()
|
||||
{
|
||||
int i, nNewDrive, nDrivesAvail;
|
||||
char szTempBuf[7], szDrivesAvail[27*4], *p;
|
||||
|
@ -86,7 +86,7 @@ static void drive_cmd()
|
|||
|
||||
/* Create Dialog */
|
||||
do_refresh ();
|
||||
|
||||
|
||||
m_drv = ((nDrivesAvail > MAX_LGH) ? MAX_LGH: nDrivesAvail);
|
||||
/* Center on x, relative to panel */
|
||||
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);
|
||||
}
|
||||
|
||||
run_dlg(drive_dlg);
|
||||
run_dlg(drive_dlg);
|
||||
|
||||
/* do action */
|
||||
if (drive_dlg->ret_value != B_CANCEL) {
|
||||
int errocc = 0; /* no error */
|
||||
int rtn;
|
||||
char drvLetter;
|
||||
|
||||
|
||||
/* Set the Panel to Directory listing mode first */
|
||||
int is_right=(this_panel==right_panel);
|
||||
|
||||
|
@ -155,7 +155,7 @@ static void drive_cmd()
|
|||
#else
|
||||
rtn = DosSetDefaultDisk(nNewDrive + 1);
|
||||
#endif
|
||||
if (rtn == -1)
|
||||
if (rtn == -1)
|
||||
errocc = 1;
|
||||
else {
|
||||
getcwd (this_panel->cwd, sizeof (this_panel->cwd)-2);
|
||||
|
@ -191,7 +191,7 @@ void drive_cmd_a()
|
|||
}
|
||||
|
||||
void drive_cmd_b()
|
||||
{
|
||||
{
|
||||
this_panel = right_panel;
|
||||
drive_cmd();
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
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:
|
||||
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(11), VK_F11 },
|
||||
{ KEY_F(12), VK_F12 },
|
||||
{ KEY_F(13), VK_F13 },
|
||||
{ KEY_F(13), VK_F13 },
|
||||
{ KEY_F(14), VK_F14 },
|
||||
{ KEY_F(15), VK_F15 },
|
||||
{ KEY_F(16), VK_F16 },
|
||||
{ KEY_F(17), VK_F17 },
|
||||
{ KEY_F(18), VK_F18 },
|
||||
{ KEY_F(19), VK_F19 },
|
||||
{ KEY_F(20), VK_F20 },
|
||||
{ KEY_IC, VK_INSERT },
|
||||
{ KEY_F(20), VK_F20 },
|
||||
{ KEY_IC, VK_INSERT },
|
||||
{ KEY_DC, VK_DELETE },
|
||||
{ KEY_BACKSPACE, VK_BACK },
|
||||
|
||||
|
@ -85,13 +85,13 @@ struct {
|
|||
{ ALT('*'), VK_MULTIPLY },
|
||||
{ ALT('+'), VK_ADD },
|
||||
{ ALT('-'), VK_SUBTRACT },
|
||||
|
||||
|
||||
{ ALT('\t'), VK_PAUSE }, /* Added to make Complete work press Pause */
|
||||
|
||||
{ ESC_CHAR, VK_ESCAPE },
|
||||
|
||||
{ 0, 0}
|
||||
};
|
||||
};
|
||||
|
||||
/* init_key - Called in main.c to initialize ourselves
|
||||
Get handle to console input
|
||||
|
@ -103,14 +103,14 @@ void init_key (void)
|
|||
|
||||
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*/
|
||||
return dwSaved_ControlState & (RIGHT_CTRL_PRESSED | LEFT_CTRL_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*/
|
||||
return dwSaved_ControlState & SHIFT_PRESSED;
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ static int VKtoCurses (int a_vkc)
|
|||
{
|
||||
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) {
|
||||
return key_table[i].key_code;
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ int get_key_code (int no_delay)
|
|||
if (!dw)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
do {
|
||||
win32APICALL(ReadConsoleInput(hConsoleInput, &ir, 1, &dw));
|
||||
switch (ir.EventType) {
|
||||
|
@ -219,7 +219,7 @@ int get_key_code (int no_delay)
|
|||
evSaved_Event.type = GPM_DOWN | GPM_DOUBLE;
|
||||
break;
|
||||
};
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
} while (!no_delay);
|
||||
return 0;
|
||||
|
@ -254,7 +254,7 @@ int get_event (Gpm_Event *event, int redo_event, int block)
|
|||
dirty++;
|
||||
|
||||
vfs_timeout_handler ();
|
||||
|
||||
|
||||
c = block ? getch_with_delay () : get_key_code (1);
|
||||
|
||||
if (!c) {
|
||||
|
@ -270,16 +270,16 @@ int mi_getch ()
|
|||
{
|
||||
Gpm_Event ev;
|
||||
int key;
|
||||
|
||||
|
||||
while ((key = get_event (&ev, 0, 1)) == 0)
|
||||
;
|
||||
return key;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
is_idle - A function to check if we're idle.
|
||||
It checks for any waiting event (that can be a Key, Mouse event,
|
||||
and other internal events like focus or menu)
|
||||
It checks for any waiting event (that can be a Key, Mouse event,
|
||||
and other internal events like focus or menu)
|
||||
*/
|
||||
int is_idle (void)
|
||||
{
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
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
|
||||
|
||||
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)
|
||||
|
||||
|
||||
Special keys:
|
||||
ENTER (number block): 0xaaaaE00D
|
||||
+ (number block): 0xaaaa4E2B Normal: 1B2B
|
||||
|
@ -133,7 +133,7 @@ struct {
|
|||
{ KEY_F(11), 0x85 },
|
||||
{ KEY_F(12), 0x86 },
|
||||
{ 0, 0}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
struct {
|
||||
|
@ -181,7 +181,7 @@ struct {
|
|||
{ ALT(KEY_F(11)), 0x8B },
|
||||
{ ALT(KEY_F(12)), 0x8C },
|
||||
{ 0, 0}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
struct {
|
||||
|
@ -199,7 +199,7 @@ struct {
|
|||
{ KEY_HOME, 0x47 },
|
||||
{ KEY_END, 0x4F },
|
||||
{ 0, 0}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/* init_key -- to make linker happy */
|
||||
|
@ -217,7 +217,7 @@ static int push_char (int c)
|
|||
{
|
||||
if (!seq_append)
|
||||
seq_append = seq_buffer;
|
||||
|
||||
|
||||
if (seq_append == &(seq_buffer [sizeof (seq_buffer)-2]))
|
||||
return 0;
|
||||
*(seq_append++) = c;
|
||||
|
@ -236,7 +236,7 @@ int get_key_code (int no_delay)
|
|||
if (inp_ch == 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (no_delay) {
|
||||
return (VKtoCurses(inp_ch));
|
||||
|
@ -255,7 +255,7 @@ static int VKtoCurses (int a_vkc)
|
|||
{
|
||||
int ctrlState = 0;
|
||||
int altState = 0;
|
||||
|
||||
|
||||
int fsState;
|
||||
char scanCode;
|
||||
char asciiCode;
|
||||
|
@ -267,7 +267,7 @@ static int VKtoCurses (int a_vkc)
|
|||
|
||||
scanCode = (char) ((a_vkc & 0x0000FFFF) >> 8);
|
||||
asciiCode = (char) (a_vkc & 0x000000FF);
|
||||
|
||||
|
||||
ctrlState = (fsState & CTRL_PRESSED);
|
||||
altState = (fsState & ALT_PRESSED);
|
||||
|
||||
|
@ -295,20 +295,20 @@ static int VKtoCurses (int a_vkc)
|
|||
/* Scan Movement codes */
|
||||
if (asciiCode == 0) {
|
||||
/* Replace key code with that in table */
|
||||
for (i=0; movement[i].vkcode != 0 || movement[i].key_code != 0; i++)
|
||||
if (scanCode == movement[i].vkcode)
|
||||
for (i=0; movement[i].vkcode != 0 || movement[i].key_code != 0; i++)
|
||||
if (scanCode == movement[i].vkcode)
|
||||
return (movement[i].key_code);
|
||||
}
|
||||
|
||||
if (asciiCode == 0) {
|
||||
/* Function-key detected */
|
||||
for (i=0; fkt_table[i].vkcode != 0 || fkt_table[i].key_code != 0; i++)
|
||||
if (scanCode == fkt_table[i].vkcode)
|
||||
for (i=0; fkt_table[i].vkcode != 0 || fkt_table[i].key_code != 0; i++)
|
||||
if (scanCode == fkt_table[i].vkcode)
|
||||
return (fkt_table[i].key_code);
|
||||
/* ALT - KEY */
|
||||
/* if (altState) */ {
|
||||
for (i=0; ALT_table[i].vkcode != 0 || ALT_table[i].key_code != 0; i++)
|
||||
if (scanCode == ALT_table[i].vkcode)
|
||||
for (i=0; ALT_table[i].vkcode != 0 || ALT_table[i].key_code != 0; i++)
|
||||
if (scanCode == ALT_table[i].vkcode)
|
||||
return (ALT_table[i].key_code);
|
||||
}
|
||||
}
|
||||
|
@ -348,7 +348,7 @@ int get_event (Gpm_Event *event, int redo_event, int block)
|
|||
dirty++;
|
||||
|
||||
vfs_timeout_handler ();
|
||||
|
||||
|
||||
c = block ? getch_with_delay () : get_key_code (1);
|
||||
if (!c) {
|
||||
/* Code is 0, so this is a Control key or mouse event */
|
||||
|
@ -364,17 +364,17 @@ int mi_getch ()
|
|||
{
|
||||
Gpm_Event ev;
|
||||
int key;
|
||||
|
||||
|
||||
while ((key = get_event (&ev, 0, 1)) == 0)
|
||||
;
|
||||
return key;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
is_idle - A function to check if we're idle.
|
||||
It checks for any waiting event (that can be a Key, Mouse event,
|
||||
and other internal events like focus or menu)
|
||||
It checks for any waiting event (that can be a Key, Mouse event,
|
||||
and other internal events like focus or menu)
|
||||
*/
|
||||
int is_idle (void)
|
||||
{
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/* Slang interface to the Midnight Commander for Windows NT and OS/2
|
||||
This emulates some features of ncurses on top of slang
|
||||
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
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
|
@ -60,7 +60,7 @@ int got_interrupt ()
|
|||
void slang_init (void)
|
||||
{
|
||||
SLtt_get_terminfo ();
|
||||
SLang_init_tty (XCTRL('c'), 1, 0);
|
||||
SLang_init_tty (XCTRL('c'), 1, 0);
|
||||
slang_prog_mode ();
|
||||
load_terminfo_keys ();
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ void hline (int ch, int len)
|
|||
|
||||
last_x = SLsmg_get_column ();
|
||||
last_y = SLsmg_get_row ();
|
||||
|
||||
|
||||
if (ch == 0)
|
||||
ch = ACS_HLINE;
|
||||
|
||||
|
@ -145,7 +145,7 @@ int has_colors ()
|
|||
/* No terminals on NT, make default color */
|
||||
if (!disable_colors)
|
||||
SLtt_Use_Ansi_Colors = 1;
|
||||
|
||||
|
||||
/* Setup emulated colors */
|
||||
if (SLtt_Use_Ansi_Colors){
|
||||
/* DO NOT TRANSLATE WITH gettext SYNTAX coloring will be broken */
|
||||
|
@ -164,7 +164,7 @@ void attrset (int color)
|
|||
SLsmg_set_color (color);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (color & A_BOLD){
|
||||
if (color == A_BOLD)
|
||||
SLsmg_set_color (A_BOLD);
|
||||
|
@ -178,7 +178,7 @@ void attrset (int color)
|
|||
else
|
||||
SLsmg_set_color (color);
|
||||
}
|
||||
|
||||
|
||||
void load_terminfo_keys ()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/* trace_nt.c - Debugging routines
|
||||
for Midnight Commander, under Win32
|
||||
|
||||
|
||||
Written 951215 by Juan Grigera <grigera@isis.unlp.edu.ar>
|
||||
|
||||
|
||||
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
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
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>
|
||||
#ifdef HAVE_TRACE
|
||||
|
@ -28,7 +28,7 @@
|
|||
#include "trace_nt.h"
|
||||
|
||||
/* Global variables */
|
||||
int __win32_tracing_enabled = 1;
|
||||
int __win32_tracing_enabled = 1;
|
||||
|
||||
static int _win32_tracing_started = 0;
|
||||
static FILE *__win32_trace_f = NULL;
|
||||
|
@ -45,7 +45,7 @@ static char *visbuf(const char *buf);
|
|||
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
static void _win32InitTrace()
|
||||
|
@ -71,7 +71,7 @@ static void _win32EndTrace()
|
|||
_win32_tracing_started = 0;
|
||||
if (__win32_trace_f)
|
||||
fclose (__win32_trace_f);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -102,12 +102,12 @@ void _win32Trace (const char *fmt, ...)
|
|||
#endif
|
||||
#endif
|
||||
|
||||
if(__win32_trace_f)
|
||||
if(__win32_trace_f)
|
||||
fprintf (__win32_trace_f, "%s\n", vp);
|
||||
}
|
||||
|
||||
/*
|
||||
void SetTrace (int trace)
|
||||
void SetTrace (int trace)
|
||||
Control debug output. Turn it of or on.
|
||||
trace: 0 = off, 1 = on.
|
||||
*/
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
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
|
||||
------
|
||||
------
|
||||
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.
|
||||
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.
|
||||
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_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 win32ASSERT(x) if (!(x)) _win32DebugAssertionFailed (#x, __LINE__, __FILE__)
|
||||
|
@ -52,7 +52,7 @@ void _win32TraceOff (void);
|
|||
#define TraceOff _win32TraceOff
|
||||
|
||||
/* Global variables */
|
||||
extern int __win32_tracing_enabled;
|
||||
extern int __win32_tracing_enabled;
|
||||
|
||||
#else
|
||||
/************************/
|
||||
|
@ -60,8 +60,8 @@ extern int __win32_tracing_enabled;
|
|||
/************************/
|
||||
|
||||
/* Wipe-out these macros */
|
||||
#define win32Trace(x)
|
||||
#define win32ASSERT(x)
|
||||
#define win32Trace(x)
|
||||
#define win32ASSERT(x)
|
||||
#define win32APICALL(x) x
|
||||
#define win32APICALL_HANDLE(h,api) h=api;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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 */
|
||||
if (as_shell_command) {
|
||||
/* It is only the shell, /c will not work */
|
||||
if (command)
|
||||
if (command)
|
||||
spawnlp (P_WAIT, shell, shell, "/c", command, (char *) 0);
|
||||
else
|
||||
spawnlp (P_WAIT, shell, (char *) 0);
|
||||
|
@ -155,11 +155,11 @@ int my_system (int as_shell_command, const char *shell, const char *command)
|
|||
#endif
|
||||
if (as_shell_command) {
|
||||
if (!access(command, 0)) {
|
||||
switch(win32_GetEXEType (shell)) {
|
||||
switch(win32_GetEXEType (shell)) {
|
||||
case EXE_win16: /* Windows 3.x archive or OS/2 */
|
||||
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 */
|
||||
break;
|
||||
break;
|
||||
case EXE_otherCUI: /* DOS COM, MZ, ZM, Phar Lap */
|
||||
case EXE_win32CUI: /* NT or Chicago Console API, also OS/2 */
|
||||
case EXE_Unknown:
|
||||
|
@ -186,7 +186,7 @@ int my_system (int as_shell_command, const char *shell, const char *command)
|
|||
*/
|
||||
char* get_default_shell()
|
||||
{
|
||||
if (win32_GetPlatform() == OS_WinNT)
|
||||
if (win32_GetPlatform() == OS_WinNT)
|
||||
return "cmd.exe";
|
||||
else
|
||||
return "command.com";
|
||||
|
@ -269,7 +269,7 @@ char *canonicalize_pathname (char *path)
|
|||
continue;
|
||||
}
|
||||
|
||||
/* Handle `../' or trailing `..' by itself.
|
||||
/* Handle `../' or trailing `..' by itself.
|
||||
Remove the previous ?/ part with the exception of
|
||||
../, which we should leave intact. */
|
||||
if (path[i + 1] == '.' && (path[i + 2] == PATH_SEP || !path[i + 2])) {
|
||||
|
@ -291,7 +291,7 @@ char *canonicalize_pathname (char *path)
|
|||
}
|
||||
|
||||
#ifndef USE_VFS
|
||||
/*
|
||||
/*
|
||||
int mc_rmdir (char *path);
|
||||
Fix for Win95 UGLY BUG in rmdir: it will return ENOACCESS instead
|
||||
of ENOTEMPTY.
|
||||
|
@ -354,7 +354,7 @@ static int conv_nt_unx_rc(int rc)
|
|||
return errCode;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
int mc_unlink (char *pathName)
|
||||
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
|
||||
|
@ -409,7 +409,7 @@ int mc_unlink (char *pathName)
|
|||
}
|
||||
}
|
||||
if (rc == TRUE) return 0;
|
||||
else
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
#endif /*USE_VFS*/
|
||||
|
@ -426,9 +426,9 @@ void my_statfs (struct my_statfs *myfs_stats, char *path)
|
|||
|
||||
/* KBytes available */
|
||||
myfs_stats->avail = (unsigned int)( ((double)lpSectorsPerCluster * lpBytesPerSector * lpFreeClusters) / 1024 );
|
||||
|
||||
|
||||
/* 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->nodes = lpClusters;
|
||||
|
||||
|
@ -493,9 +493,9 @@ void my_statfs (struct my_statfs *myfs_stats, char *path)
|
|||
int gettimeofday (struct timeval* tvp, void *p)
|
||||
{
|
||||
if (p != NULL)
|
||||
return 0;
|
||||
|
||||
/* Since MC only calls this func from get_random_hint we return
|
||||
return 0;
|
||||
|
||||
/* Since MC only calls this func from get_random_hint we return
|
||||
some value, not exactly the "correct" one */
|
||||
tvp->tv_sec = GetTickCount()/1000; /* Number of milliseconds since Windows //started*/
|
||||
tvp->tv_usec = GetTickCount();
|
||||
|
@ -503,7 +503,7 @@ int gettimeofday (struct timeval* tvp, void *p)
|
|||
|
||||
/* FAKE functions */
|
||||
|
||||
int
|
||||
int
|
||||
look_for_exe(const char* pathname)
|
||||
{
|
||||
int j;
|
||||
|
@ -517,9 +517,9 @@ look_for_exe(const char* pathname)
|
|||
for (j=0; j<lgh-4; j++) {
|
||||
p++;
|
||||
} /* endfor */
|
||||
if (!stricmp(p, ".exe") ||
|
||||
!stricmp(p, ".bat") ||
|
||||
!stricmp(p, ".com") ||
|
||||
if (!stricmp(p, ".exe") ||
|
||||
!stricmp(p, ".bat") ||
|
||||
!stricmp(p, ".com") ||
|
||||
!stricmp(p, ".cmd")) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -527,7 +527,7 @@ look_for_exe(const char* pathname)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
lstat (const char* pathname, struct stat *buffer)
|
||||
{
|
||||
int rc = stat (pathname, buffer);
|
||||
|
@ -543,7 +543,7 @@ lstat (const char* pathname, struct stat *buffer)
|
|||
return rc;
|
||||
}
|
||||
|
||||
int getuid ()
|
||||
int getuid ()
|
||||
{
|
||||
/* SID sid;
|
||||
LookupAccountName (NULL, &sid...
|
||||
|
@ -552,7 +552,7 @@ int getuid ()
|
|||
return 0;
|
||||
}
|
||||
|
||||
int getgid ()
|
||||
int getgid ()
|
||||
{
|
||||
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
|
||||
if(_dup2(std_sav[1], _fileno(stdout)) != 0)
|
||||
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[1]);
|
||||
|
||||
|
||||
while ((i = _read (inhandle, buffer,
|
||||
(inlen == -1 || inlen > 8192)
|
||||
(inlen == -1 || inlen > 8192)
|
||||
? 8192 : inlen)) > 0) {
|
||||
write (pipe0 [1], buffer, i);
|
||||
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 status = 0;
|
||||
|
||||
|
||||
close (pipe);
|
||||
_cwait ( &status, pid, 0);
|
||||
return status;
|
||||
return status;
|
||||
}
|
||||
|
||||
/*hacks to get it compile, remove these after vfs works */
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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. */
|
||||
/* The pipe can hold 4096 bytes. Make sure no more is written */
|
||||
/* or a deadlock might occur. */
|
||||
void
|
||||
void
|
||||
open_error_pipe (void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
close_error_pipe (int error, char *text)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
check_error_pipe (void)
|
||||
{
|
||||
char error[MAX_PIPE_SIZE];
|
||||
|
@ -110,7 +110,7 @@ check_error_pipe (void)
|
|||
}
|
||||
|
||||
|
||||
static int
|
||||
static int
|
||||
StartWindowsProg (char *name, SHORT type)
|
||||
{
|
||||
#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 ;
|
||||
break;
|
||||
}
|
||||
WinStartApp(NULLHANDLE,
|
||||
&pDetails,
|
||||
NULL,
|
||||
NULL,
|
||||
WinStartApp(NULLHANDLE,
|
||||
&pDetails,
|
||||
NULL,
|
||||
NULL,
|
||||
SAF_INSTALLEDCMDLINE|SAF_STARTCHILDAPP) ;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
static int
|
||||
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
|
||||
or RETURN
|
||||
or RETURN
|
||||
= 0: F3, F4
|
||||
*/
|
||||
int
|
||||
int
|
||||
my_system (int as_shell_command, const char *shell, const char *command)
|
||||
{
|
||||
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();
|
||||
if (strcmp(sh, shell)) {
|
||||
/*
|
||||
/*
|
||||
Not equal -- That means: shell is the program and command is the
|
||||
parameter
|
||||
parameter
|
||||
*/
|
||||
cmd = (char *) shell;
|
||||
parm = (char *) command;
|
||||
|
@ -185,7 +185,7 @@ my_system (int as_shell_command, const char *shell, const char *command)
|
|||
if (command[i] == ' ') {
|
||||
temp[i] = (char) 0;
|
||||
length--;
|
||||
} else
|
||||
} else
|
||||
break;
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
static int
|
||||
ux_startp (const char *shell, const char *command, const char *parm)
|
||||
static int
|
||||
ux_startp (const char *shell, const char *command, const char *parm)
|
||||
{
|
||||
if (parm) {
|
||||
spawnlp (P_WAIT,
|
||||
(char *) shell,
|
||||
(char *) shell,
|
||||
"/c",
|
||||
(char *) command,
|
||||
spawnlp (P_WAIT,
|
||||
(char *) shell,
|
||||
(char *) shell,
|
||||
"/c",
|
||||
(char *) command,
|
||||
(char *) parm,
|
||||
(char *) 0);
|
||||
} else {
|
||||
spawnlp (P_WAIT,
|
||||
(char *) shell,
|
||||
(char *) shell,
|
||||
"/c",
|
||||
(char *) command,
|
||||
spawnlp (P_WAIT,
|
||||
(char *) shell,
|
||||
(char *) shell,
|
||||
"/c",
|
||||
(char *) command,
|
||||
(char *) 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
static int
|
||||
os2_system (int as_shell_command, const char *shell, const char *command, char *parm)
|
||||
{
|
||||
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 */
|
||||
char pathValue[5] = "PATH"; /* For DosSearchPath */
|
||||
UCHAR searchResult[MC_MAXPATHLEN * 2 + 1]; /* For DosSearchPath */
|
||||
|
||||
|
||||
char *cmdString;
|
||||
char *postFix[3];
|
||||
char *line;
|
||||
|
@ -248,26 +248,26 @@ os2_system (int as_shell_command, const char *shell, const char *command, char *
|
|||
|
||||
if (command == NULL) {
|
||||
/* .ado: just start a shell, we don't need the parameter */
|
||||
spawnl (P_WAIT,
|
||||
(char *) shell,
|
||||
(char *) shell,
|
||||
(char *) command, (char *) 0);
|
||||
spawnl (P_WAIT,
|
||||
(char *) shell,
|
||||
(char *) shell,
|
||||
(char *) command, (char *) 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset(&StartData, 0, sizeof(StartData)) ;
|
||||
StartData.Length = sizeof(StartData);
|
||||
StartData.Length = sizeof(StartData);
|
||||
StartData.Related = SSF_RELATED_CHILD;
|
||||
StartData.FgBg = SSF_FGBG_BACK;
|
||||
StartData.TraceOpt = SSF_TRACEOPT_NONE;
|
||||
StartData.PgmTitle = NULL;
|
||||
StartData.TermQ = NULL;
|
||||
StartData.TraceOpt = SSF_TRACEOPT_NONE;
|
||||
StartData.PgmTitle = NULL;
|
||||
StartData.TermQ = NULL;
|
||||
StartData.InheritOpt = SSF_INHERTOPT_PARENT;
|
||||
StartData.IconFile = 0;
|
||||
StartData.PgmHandle = 0;
|
||||
StartData.PgmControl = SSF_CONTROL_VISIBLE ;
|
||||
StartData.ObjectBuffer = ObjBuf;
|
||||
StartData.ObjectBuffLen = 100;
|
||||
StartData.IconFile = 0;
|
||||
StartData.PgmHandle = 0;
|
||||
StartData.PgmControl = SSF_CONTROL_VISIBLE ;
|
||||
StartData.ObjectBuffer = ObjBuf;
|
||||
StartData.ObjectBuffLen = 100;
|
||||
StartData.PgmInputs = parm;
|
||||
|
||||
postFix[0] = ".exe";
|
||||
|
@ -300,7 +300,7 @@ os2_system (int as_shell_command, const char *shell, const char *command, char *
|
|||
sizeof(searchResult));
|
||||
}
|
||||
free (line);
|
||||
} else {
|
||||
} else {
|
||||
/* Just search */
|
||||
rc = DosSearchPath((SEARCH_IGNORENETERRS | SEARCH_ENVIRONMENT | SEARCH_CUR_DIRECTORY),
|
||||
(PSZ) pathValue,
|
||||
|
@ -350,9 +350,9 @@ os2_system (int as_shell_command, const char *shell, const char *command, char *
|
|||
} else {
|
||||
/* It's not a known exe type or it's a CMD/BAT file */
|
||||
i = strlen(searchResult);
|
||||
if ((toupper(searchResult[--i]) == 'T') &&
|
||||
(toupper(searchResult[--i]) == 'A') &&
|
||||
(toupper(searchResult[--i]) == 'B') &&
|
||||
if ((toupper(searchResult[--i]) == 'T') &&
|
||||
(toupper(searchResult[--i]) == 'A') &&
|
||||
(toupper(searchResult[--i]) == 'B') &&
|
||||
(searchResult[--i] == '.') ) {
|
||||
StartData.SessionType = PROG_WINDOWEDVDM;
|
||||
rc = DosStartSession(&StartData, &SessionID, &pid) ;
|
||||
|
@ -432,7 +432,7 @@ canonicalize_pathname (char *path)
|
|||
continue;
|
||||
}
|
||||
|
||||
/* Handle `../' or trailing `..' by itself.
|
||||
/* Handle `../' or trailing `..' by itself.
|
||||
Remove the previous ?/ part with the exception of
|
||||
../, which we should leave intact. */
|
||||
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)
|
||||
{
|
||||
PFSALLOCATE pBuf;
|
||||
|
@ -483,15 +483,15 @@ my_statfs (struct my_statfs *myfs_stats, char *path)
|
|||
/* KBytes available */
|
||||
myfs_stats->avail = pBuf->cSectorUnit * pBuf->cUnitAvail * pBuf->cbSector / 1024;
|
||||
/* 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->nodes = pBuf->cbSector;
|
||||
|
||||
lghBuf = sizeof(FSINFO);
|
||||
pFsInfo = (PFSINFO) malloc(lghBuf);
|
||||
rc = DosQueryFSInfo(0L,
|
||||
FSIL_VOLSER,
|
||||
(PVOID) pFsInfo,
|
||||
rc = DosQueryFSInfo(0L,
|
||||
FSIL_VOLSER,
|
||||
(PVOID) pFsInfo,
|
||||
lghBuf);
|
||||
/* Get name */
|
||||
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);
|
||||
/* Now get the type of the disk */
|
||||
rc = DosQueryFSAttach(szDeviceName,
|
||||
0L,
|
||||
FSAIL_QUERYNAME,
|
||||
pfsqBuffer,
|
||||
rc = DosQueryFSAttach(szDeviceName,
|
||||
0L,
|
||||
FSAIL_QUERYNAME,
|
||||
pfsqBuffer,
|
||||
&cbBuffer);
|
||||
|
||||
pszFSDName = pfsqBuffer->szName + pfsqBuffer->cbName + 1;
|
||||
|
@ -524,14 +524,14 @@ my_statfs (struct my_statfs *myfs_stats, char *path)
|
|||
free(pFsInfo);
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
gettimeofday (struct timeval* tvp, void *p)
|
||||
{
|
||||
DATETIME pdt = {0};
|
||||
if (p != NULL) /* what is "p"? */
|
||||
return 0;
|
||||
|
||||
/* Since MC only calls this func from get_random_hint we return
|
||||
return 0;
|
||||
|
||||
/* Since MC only calls this func from get_random_hint we return
|
||||
* some value, not exactly the "correct" one
|
||||
*/
|
||||
DosGetDateTime(&pdt);
|
||||
|
@ -543,7 +543,7 @@ gettimeofday (struct timeval* tvp, void *p)
|
|||
|
||||
/* FAKE functions */
|
||||
|
||||
int
|
||||
int
|
||||
look_for_exe(const char* pathname)
|
||||
{
|
||||
int j;
|
||||
|
@ -557,9 +557,9 @@ look_for_exe(const char* pathname)
|
|||
for (j=0; j<lgh-4; j++) {
|
||||
p++;
|
||||
}
|
||||
if (!stricmp(p, ".exe") ||
|
||||
!stricmp(p, ".bat") ||
|
||||
!stricmp(p, ".com") ||
|
||||
if (!stricmp(p, ".exe") ||
|
||||
!stricmp(p, ".bat") ||
|
||||
!stricmp(p, ".com") ||
|
||||
!stricmp(p, ".cmd")) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -567,7 +567,7 @@ look_for_exe(const char* pathname)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
lstat (const char* pathname, struct stat *buffer)
|
||||
{
|
||||
int rc = stat (pathname, buffer);
|
||||
|
@ -583,61 +583,61 @@ lstat (const char* pathname, struct stat *buffer)
|
|||
return rc;
|
||||
}
|
||||
|
||||
int
|
||||
getuid ()
|
||||
int
|
||||
getuid ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
getgid ()
|
||||
int
|
||||
getgid ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
readlink (char* path, char* buf, int size)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
symlink (char *n1, char *n2)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
link (char *p1, char *p2)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
chown (char *path, int owner, int group)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
mknod (char *path, int mode, int dev)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
init_uid_gid_cache (void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
mc_doublepopen (int inhandle, int inlen, pid_t *the_pid, char *command, ...)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
mc_doublepclose (int pipe, pid_t pid)
|
||||
{
|
||||
return 0;
|
||||
|
@ -650,13 +650,13 @@ vfs_get_current_dir (void)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
vfs_current_is_extfs (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
vfs_file_is_ftp (char *filename)
|
||||
{
|
||||
return 0;
|
||||
|
@ -695,7 +695,7 @@ mc_chdir(char *pathname)
|
|||
/* First set the default drive */
|
||||
if (lgh > 1) {
|
||||
if (pathname[1] == ':') {
|
||||
ret = DosSetDefaultDisk(toupper(pathname[0]) - 'A' + 1);
|
||||
ret = DosSetDefaultDisk(toupper(pathname[0]) - 'A' + 1);
|
||||
}
|
||||
}
|
||||
/* After that, set the current dir! */
|
||||
|
@ -703,7 +703,7 @@ mc_chdir(char *pathname)
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mc_chmod(char *pathName, int unxmode)
|
||||
{
|
||||
|
@ -731,7 +731,7 @@ conv_os2_unx_rc(int os2rc)
|
|||
case ERROR_INVALID_PARAMETER:
|
||||
errCode = EINVAL;
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
errCode = EINVAL;
|
||||
break;
|
||||
}
|
||||
|
@ -747,7 +747,7 @@ mc_open (char *file, int flags, int pmode)
|
|||
int
|
||||
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! */
|
||||
APIRET rc;
|
||||
rc = DosDelete(pathName);
|
||||
|
@ -776,7 +776,7 @@ get_default_editor (void)
|
|||
APIRET rc;
|
||||
char pathValue[5] = "PATH";
|
||||
UCHAR searchResult[MC_MAXPATHLEN + 1];
|
||||
|
||||
|
||||
/* EPM is not always be installed */
|
||||
rc = DosSearchPath((SEARCH_IGNORENETERRS | SEARCH_ENVIRONMENT | SEARCH_CUR_DIRECTORY),
|
||||
(PSZ) pathValue,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
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>
|
||||
|
@ -39,8 +39,8 @@ int win32_GetPlatform ()
|
|||
return (platform ? platform : (platform = win32_GetVersionEx()) );
|
||||
}
|
||||
|
||||
/* int win32_GetVersionEx ()
|
||||
intended for use by win32_GetPlatform only
|
||||
/* int win32_GetVersionEx ()
|
||||
intended for use by win32_GetPlatform only
|
||||
*/
|
||||
int win32_GetVersionEx ()
|
||||
{
|
||||
|
@ -177,7 +177,7 @@ int win32_GetEXEType (const char* a_szFileName)
|
|||
return EXE_Unknown; /* FIXME: what is "NATIVE??" */
|
||||
default:
|
||||
win32Trace(("Unknown type %u.\n", image_optional_header.Subsystem));
|
||||
return EXE_Unknown;
|
||||
return EXE_Unknown;
|
||||
}
|
||||
#else
|
||||
return EXE_Unknown;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
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 */
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
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 <windows.h>
|
||||
|
@ -29,7 +29,7 @@
|
|||
0 if not
|
||||
|
||||
Note: Code taken from MSKbase Number: Q118626.
|
||||
|
||||
|
||||
To determine whether or not a user is an administrator, you need to examine
|
||||
the user's access token with GetTokenInformation(). The access token
|
||||
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())
|
||||
return 0;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
need. Use slang.h for that purpose. */
|
||||
/* Copyright (c) 1992, 1995 John E. Davis
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* You may distribute under the terms of either the GNU General Public
|
||||
* License or the Perl Artistic License.
|
||||
*/
|
||||
|
@ -34,7 +34,7 @@
|
|||
|
||||
|
||||
/* 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
|
||||
* the name table.
|
||||
*/
|
||||
|
@ -156,7 +156,7 @@ typedef struct SLBlock_Type
|
|||
{
|
||||
unsigned char main_type;
|
||||
unsigned char sub_type;
|
||||
union
|
||||
union
|
||||
{
|
||||
struct SLBlock_Type *blk;
|
||||
int i_blk;
|
||||
|
@ -290,7 +290,7 @@ extern void SLang_push_float(float64);
|
|||
extern void SLadd_variable(char *);
|
||||
extern void SLang_clear_error(void);
|
||||
extern void SLarray_info (void);
|
||||
extern int SLPreprocess_Only; /* preprocess instead of
|
||||
extern int SLPreprocess_Only; /* preprocess instead of
|
||||
* bytecompiling
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _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.
|
||||
*/
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
|||
|
||||
#ifdef HAVE_MEMORY_H
|
||||
# include <memory.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef SLMEMSET
|
||||
# ifdef HAVE_MEMSET
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/* -*- mode: C; mode: fold; -*- */
|
||||
/* Copyright (c) 1992, 1995 John E. Davis
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* You may distribute under the terms of either the GNU General Public
|
||||
* License or the Perl Artistic License.
|
||||
*/
|
||||
|
@ -96,13 +96,13 @@ extern "C" {
|
|||
# define VOID unsigned char
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#if 1
|
||||
typedef int (*FVOID_STAR)(void);
|
||||
#else
|
||||
# define FVOID_STAR VOID_STAR
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(msdos) && !defined(DOS386) && !defined(__GO32__) && !defined(__WIN32__)
|
||||
# define SLFREE(buf) farfree((void far *)(buf))
|
||||
# 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 SLREALLOC(p, x) SLdebug_realloc((unsigned char *)(p), (unsigned long)(x))
|
||||
#endif /* SL_MALLOC_DEBUG */
|
||||
|
||||
|
||||
extern unsigned char *SLdebug_malloc (unsigned long);
|
||||
extern unsigned char *SLdebug_calloc (unsigned long, 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 int SLstrcmp(register char *, register char *);
|
||||
extern char *SLstrncpy(char *, register char *, register int);
|
||||
|
||||
|
||||
extern void SLmemset (char *, char, int);
|
||||
extern char *SLmemchr (register char *, register char, register int);
|
||||
extern char *SLmemcpy (char *, char *, int);
|
||||
|
@ -154,7 +154,7 @@ extern "C" {
|
|||
#ifdef float64
|
||||
# undef float64
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef FLOAT64_TYPEDEFED
|
||||
# define FLOAT64_TYPEDEFED
|
||||
typedef double float64;
|
||||
|
@ -182,7 +182,7 @@ typedef struct SLang_Name_Type
|
|||
char name[SLANG_MAX_NAME_LEN + 2]; /* [0] is hash */
|
||||
|
||||
unsigned char sub_type;
|
||||
|
||||
|
||||
/* Values for main_type may be as follows. The particlular values are
|
||||
* for compatability.
|
||||
*/
|
||||
|
@ -204,9 +204,9 @@ typedef struct SLang_Load_Type
|
|||
{
|
||||
long name; /* file name, string address, ... */
|
||||
long handle; /* FILE *, string address, etc... */
|
||||
|
||||
|
||||
char *ptr; /* input pointer to next line in object
|
||||
* to be read.
|
||||
* to be read.
|
||||
*/
|
||||
/* Things below here are used by S-Lang. */
|
||||
int type; /* 'F' = file, 'S' = String, etc.. */
|
||||
|
@ -215,7 +215,7 @@ typedef struct SLang_Load_Type
|
|||
int n; /* line number, etc... */
|
||||
char token[256]; /* token to be parsed */
|
||||
int ofs; /* offset from buf where last read
|
||||
* took place
|
||||
* took place
|
||||
*/
|
||||
int top_level; /* 1 if at top level of parsing */
|
||||
} SLang_Load_Type;
|
||||
|
@ -225,8 +225,8 @@ typedef struct SLang_Load_Type
|
|||
# define NO_PROTOTYPES
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef NO_PROTOTYPES
|
||||
|
||||
#ifndef NO_PROTOTYPES
|
||||
# define _PROTO(x) x
|
||||
#else
|
||||
# define _PROTO(x) ()
|
||||
|
@ -235,14 +235,14 @@ typedef struct SLang_Load_Type
|
|||
typedef struct SL_OOBinary_Type
|
||||
{
|
||||
unsigned char sub_type; /* partner type for binary op */
|
||||
|
||||
|
||||
/* 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
|
||||
* 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.
|
||||
*/
|
||||
int (*binary_function)_PROTO((int, unsigned char, unsigned char,
|
||||
int (*binary_function)_PROTO((int, unsigned char, unsigned char,
|
||||
VOID_STAR, VOID_STAR));
|
||||
|
||||
struct SL_OOBinary_Type *next;
|
||||
|
@ -259,13 +259,13 @@ typedef struct
|
|||
int (*unary_function)_PROTO((int, unsigned char, VOID_STAR));
|
||||
/* unary operation function */
|
||||
SL_OOBinary_Type *binary_ops;
|
||||
|
||||
|
||||
int (*copy_function)_PROTO((unsigned char, VOID_STAR));
|
||||
/* This function is called do make a copy of the object */
|
||||
} SLang_Class_Type;
|
||||
|
||||
extern SLang_Class_Type *SLang_Registered_Types[256];
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char main_type; /* SLANG_RVARIABLE, etc.. */
|
||||
|
@ -277,7 +277,7 @@ typedef struct
|
|||
}
|
||||
SLuser_Object_Type;
|
||||
|
||||
|
||||
|
||||
/*}}}*/
|
||||
/*{{{ Interpreter Function Prototypes */
|
||||
|
||||
|
@ -285,7 +285,7 @@ SLuser_Object_Type;
|
|||
/* Non zero if error occurs. Must be reset to zero to continue. */
|
||||
|
||||
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. */
|
||||
|
||||
extern char *SLang_User_Prompt;
|
||||
|
@ -299,16 +299,16 @@ SLuser_Object_Type;
|
|||
extern void (*SLang_Exit_Error_Hook)(char *);
|
||||
extern void SLang_exit_error (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. */
|
||||
|
||||
|
||||
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. */
|
||||
|
||||
extern void (*SLang_User_Clear_Error)(void);
|
||||
/* 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 *);
|
||||
/* user defined loading routines. */
|
||||
|
||||
|
@ -320,7 +320,7 @@ SLuser_Object_Type;
|
|||
|
||||
/* Functions: */
|
||||
|
||||
extern int init_SLang(void);
|
||||
extern int init_SLang(void);
|
||||
/* This function is mandatory and must be called by all applications */
|
||||
extern int init_SLfiles(void);
|
||||
/* called if fputs, fgets, etc are need in S-Lang */
|
||||
|
@ -331,10 +331,10 @@ SLuser_Object_Type;
|
|||
/* unix system functions chmod, stat, etc... */
|
||||
|
||||
extern int init_SLmatrix(void);
|
||||
|
||||
|
||||
extern int SLang_add_table(SLang_Name_Type *, char *);
|
||||
/* add application dependent function table p1 to S-Lang. A name p2 less
|
||||
* than 32 characters must also be supplied.
|
||||
/* add application dependent function table p1 to S-Lang. A name p2 less
|
||||
* than 32 characters must also be supplied.
|
||||
* Returns 0 upon failure or 1 upon success. */
|
||||
|
||||
extern int SLang_add_global_variable (char *);
|
||||
|
@ -345,28 +345,28 @@ SLuser_Object_Type;
|
|||
|
||||
extern void SLang_restart(int);
|
||||
/* 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
|
||||
* should be called with a non-zero argument (e.g., if setjmp/longjmp is
|
||||
* called). */
|
||||
* called). */
|
||||
|
||||
extern void SLang_byte_compile_file(char *, int *);
|
||||
/* 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
|
||||
* 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.
|
||||
*/
|
||||
|
||||
extern void SLang_autoload(char *, char *);
|
||||
/* Automatically load S-Lang function p1 from file p2. This function
|
||||
is also available via S-Lang */
|
||||
|
||||
|
||||
extern char *SLang_load_string(char *);
|
||||
/* Like SLang_load_file except input is from a null terminated string. */
|
||||
|
||||
|
||||
extern void SLang_do_pop(void);
|
||||
/* pops item off stack and frees any memory associated with it */
|
||||
|
||||
|
||||
extern int SLang_pop_integer(int *);
|
||||
/* 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.
|
||||
|
@ -377,11 +377,11 @@ SLuser_Object_Type;
|
|||
/* 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
|
||||
* success */
|
||||
|
||||
|
||||
extern int SLang_pop_float(float64 *, int *, int *);
|
||||
/* Pops float *p1 from stack. If *p3 is non-zero, *p1 was derived
|
||||
from the integer *p2. Returns zero upon success. */
|
||||
|
||||
|
||||
extern SLuser_Object_Type *SLang_pop_user_object (unsigned char);
|
||||
extern void SLang_free_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 SLuser_Object_Type *SLang_create_user_object (unsigned char);
|
||||
|
||||
|
||||
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_register_class (unsigned char, FVOID_STAR, FVOID_STAR);
|
||||
extern int SLang_add_copy_operation (unsigned char, FVOID_STAR);
|
||||
|
||||
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. */
|
||||
|
||||
|
||||
|
@ -408,7 +408,7 @@ SLuser_Object_Type;
|
|||
|
||||
extern void SLang_push_string(char *);
|
||||
/* Push string p1 onto stack */
|
||||
|
||||
|
||||
extern void SLang_push_integer(int);
|
||||
/* push integer p1 on stack */
|
||||
|
||||
|
@ -418,20 +418,20 @@ SLuser_Object_Type;
|
|||
|
||||
extern int SLang_is_defined(char *);
|
||||
/* Return non-zero is p1 is defined otherwise returns 0. */
|
||||
|
||||
|
||||
extern int SLang_run_hooks(char *, char *, char *);
|
||||
/* 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
|
||||
* defined, 0 is returned. */
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
extern char *SLang_find_name(char *);
|
||||
/* 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 *);
|
||||
|
@ -439,14 +439,14 @@ SLuser_Object_Type;
|
|||
|
||||
extern void SLang_doerror(char *);
|
||||
/* set SLang_Error and display p1 as error message */
|
||||
|
||||
extern SLuser_Object_Type *SLang_add_array(char *, long *,
|
||||
int, int, int, int,
|
||||
|
||||
extern SLuser_Object_Type *SLang_add_array(char *, long *,
|
||||
int, int, int, int,
|
||||
unsigned char, unsigned char);
|
||||
/* 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
|
||||
/* 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
|
||||
* you have an array of 100 ints defined as:
|
||||
*
|
||||
*
|
||||
* int c_array[100];
|
||||
*
|
||||
* By calling something like:
|
||||
|
@ -454,39 +454,39 @@ SLuser_Object_Type;
|
|||
* SLang_add_array ("array_name", (long *) c_array, 1, 100, 0, 0,
|
||||
* 'i', SLANG_IVARIABLE);
|
||||
*
|
||||
* the array can be accessed by the name 'array_name'. This function
|
||||
* returns -1 upon failure. The 3rd argument specifies the dimension
|
||||
* the array can be accessed by the name 'array_name'. This function
|
||||
* returns -1 upon failure. The 3rd argument specifies the dimension
|
||||
* 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
|
||||
* be one of:
|
||||
*
|
||||
* there are in the x,y, and z directions. The last argument must
|
||||
* be one of:
|
||||
*
|
||||
* SLANG_IVARIABLE: indicates array is writable
|
||||
* SLANG_RVARIABLE: indicates array is read only
|
||||
*
|
||||
*
|
||||
* Returns NULL upon failure.
|
||||
*/
|
||||
|
||||
|
||||
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
|
||||
* -2 if the handle is not associated with a C array.
|
||||
*/
|
||||
|
||||
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 *);
|
||||
|
||||
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
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
extern void SLexecute_function(SLang_Name_Type *);
|
||||
/* 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'.
|
||||
*/
|
||||
extern void SLroll_stack (int *);
|
||||
|
@ -514,9 +514,9 @@ extern char *SLcurrent_time_string (void);
|
|||
extern int SLatoi(unsigned char *);
|
||||
|
||||
extern int SLang_extract_token(char **, char *, int);
|
||||
/* 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.
|
||||
* The second parameter is the buffer where the token is placed. The third
|
||||
/* 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.
|
||||
* 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
|
||||
* user applications.
|
||||
*/
|
||||
|
@ -524,12 +524,12 @@ extern int SLang_extract_token(char **, char *, int);
|
|||
/*}}}*/
|
||||
|
||||
/*{{{ SLang getkey interface Functions */
|
||||
|
||||
|
||||
#ifdef REAL_UNIX_SYSTEM
|
||||
extern int SLang_TT_Baud_Rate;
|
||||
extern int SLang_TT_Read_FD;
|
||||
#endif
|
||||
|
||||
|
||||
extern int SLang_init_tty (int, int, int);
|
||||
/* 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;
|
||||
|
@ -571,7 +571,7 @@ extern int SLang_Ignore_User_Abort;
|
|||
|
||||
extern void SLang_set_abort_signal (void (*)(int));
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
|
@ -635,19 +635,19 @@ extern SLKeyMap_List_Type SLKeyMap_List[SLANG_MAX_KEYMAPS]; /* these better be
|
|||
|
||||
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 *);
|
||||
/* 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
|
||||
* 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. */
|
||||
#else
|
||||
extern int SLkm_define_key (char *, FVOID_STAR, SLKeyMap_List_Type *);
|
||||
#endif
|
||||
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
|
@ -696,7 +696,7 @@ typedef struct SLang_Read_Line_Type
|
|||
/* Maximum size of display */
|
||||
#define SLRL_DISPLAY_BUFFER_SIZE 256
|
||||
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
SLang_Read_Line_Type *root, *tail, *last;
|
||||
unsigned char *buf; /* edit buffer */
|
||||
|
@ -704,14 +704,14 @@ typedef struct
|
|||
int point; /* current editing point */
|
||||
int tab; /* tab width */
|
||||
int len; /* current line size */
|
||||
|
||||
|
||||
/* display variables */
|
||||
int edit_width; /* length of display field */
|
||||
int curs_pos; /* current column */
|
||||
int start_column; /* column offset of display */
|
||||
int dhscroll; /* amount to use for horiz scroll */
|
||||
char *prompt;
|
||||
|
||||
|
||||
FVOID_STAR last_fun; /* last function executed by rl */
|
||||
|
||||
/* 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 *old_upd, *new_upd; /* pointers to previous two buffers */
|
||||
int new_upd_len, old_upd_len; /* length of output buffers */
|
||||
|
||||
|
||||
SLKeyMap_List_Type *keymap;
|
||||
|
||||
/* tty variables */
|
||||
|
@ -731,7 +731,7 @@ typedef struct
|
|||
void (*tt_insert)(char);
|
||||
void (*update_hook)(unsigned char *, int, int);
|
||||
/* 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
|
||||
* 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_read_line (SLang_RLine_Info_Type *);
|
||||
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;
|
||||
|
||||
/*}}}*/
|
||||
|
@ -770,7 +770,7 @@ extern int SLtt_Ignore_Beep;
|
|||
#if defined(REAL_UNIX_SYSTEM)
|
||||
extern int SLtt_Force_Keypad_Init;
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef __GO32__
|
||||
#if defined(VMS) || defined(REAL_UNIX_SYSTEM)
|
||||
extern int SLtt_Blink_Mode;
|
||||
|
@ -787,8 +787,8 @@ extern int SLtt_Try_Termcap;
|
|||
#ifdef msdos
|
||||
extern int SLtt_Msdos_Cheap_Video;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
extern int SLtt_flush_output (void);
|
||||
extern void SLtt_set_scroll_region(int, int);
|
||||
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_screen_size (void);
|
||||
extern int SLtt_set_cursor_visibility (int);
|
||||
|
||||
|
||||
#if defined(VMS) || defined(REAL_UNIX_SYSTEM)
|
||||
extern void SLtt_enable_cursor_keys(void);
|
||||
extern void SLtt_set_term_vtxxx(int *);
|
||||
|
@ -833,19 +833,19 @@ extern void SLtt_disable_status_line (void);
|
|||
extern int SLtt_tigetnum (char *, char **);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
extern SLtt_Char_Type SLtt_get_color_object (int);
|
||||
extern void SLtt_set_color_object (int, SLtt_Char_Type);
|
||||
extern void SLtt_set_color (int, char *, char *, char *);
|
||||
extern void SLtt_set_mono (int, char *, 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);
|
||||
|
||||
|
||||
/*}}}*/
|
||||
|
||||
/*{{{ SLang Preprocessor Interface */
|
||||
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
int this_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
|
||||
defines MSDOS, UNIX, and VMS on the appropriate system. */
|
||||
extern int (*SLprep_exists_hook) (char *, char);
|
||||
|
||||
|
||||
|
||||
|
||||
/*}}}*/
|
||||
|
||||
/*{{{ SLsmg Screen Management Functions */
|
||||
|
@ -909,7 +909,7 @@ extern void SLsmg_forward (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_write_raw (unsigned short *, unsigned int);
|
||||
|
||||
|
||||
extern int SLsmg_Display_Eight_Bit;
|
||||
extern int SLsmg_Tab_Width;
|
||||
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. */
|
||||
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.
|
||||
*/
|
||||
extern int SLkp_getkey (void);
|
||||
|
@ -1016,7 +1016,7 @@ typedef struct _SLscroll_Type
|
|||
}
|
||||
SLscroll_Type;
|
||||
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
unsigned int flags;
|
||||
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. */
|
||||
# define SLANG_NOOP 9
|
||||
#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.
|
||||
*/
|
||||
#define STRING_TYPE 10
|
||||
|
@ -1154,14 +1154,14 @@ extern void SLadd_at_handler (long *, char *);
|
|||
|
||||
#define MAKE_INTRINSIC(n, f, out, in) \
|
||||
{0, n, (out | (in << 4)), SLANG_INTRINSIC, (long) f}
|
||||
|
||||
|
||||
#define MAKE_VARIABLE(n, v, t, r) \
|
||||
{0, n, t, (SLANG_IVARIABLE + r), (long) v}
|
||||
|
||||
#else
|
||||
#define MAKE_INTRINSIC(n, f, out, in) \
|
||||
{n, (out | (in << 4)), SLANG_INTRINSIC, (long) f}
|
||||
|
||||
|
||||
#define MAKE_VARIABLE(n, v, t, r) \
|
||||
{n, t, (SLANG_IVARIABLE + r), (long) v}
|
||||
#endif
|
||||
|
@ -1202,13 +1202,13 @@ typedef struct
|
|||
int beg_matches[10]; /* offset of start of \( */
|
||||
unsigned int end_matches[10]; /* length of nth submatch
|
||||
* Note that the entire match corresponds
|
||||
* to \0
|
||||
* to \0
|
||||
*/
|
||||
int offset; /* offset to be added to beg_matches */
|
||||
} SLRegexp_Type;
|
||||
|
||||
extern unsigned char *SLang_regexp_match(unsigned char *,
|
||||
unsigned int,
|
||||
extern unsigned char *SLang_regexp_match(unsigned char *,
|
||||
unsigned int,
|
||||
SLRegexp_Type *);
|
||||
extern int SLang_regexp_compile (SLRegexp_Type *);
|
||||
extern char *SLregexp_quote_string (char *, char *, unsigned int);
|
||||
|
@ -1254,21 +1254,21 @@ typedef struct
|
|||
} SLsearch_Type;
|
||||
|
||||
extern int SLsearch_init (char *, int, int, SLsearch_Type *);
|
||||
/* This routine must first be called before any search can take place.
|
||||
* 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
|
||||
/* This routine must first be called before any search can take place.
|
||||
* 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
|
||||
* 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.
|
||||
*/
|
||||
|
||||
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
|
||||
* is to take place. The third parameter is the structure that was previously
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,7 @@
|
|||
/* error handling common to all routines. */
|
||||
/* Copyright (c) 1992, 1995 John E. Davis
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* You may distribute under the terms of either the GNU General Public
|
||||
* License or the Perl Artistic License.
|
||||
*/
|
||||
|
@ -32,11 +32,11 @@ void SLang_doerror (char *error)
|
|||
char *str = NULL;
|
||||
|
||||
*err = 0;
|
||||
|
||||
|
||||
str = "Slang/Midnight Commander unknown error";
|
||||
|
||||
sprintf(err, "S-Lang Error: %s", str);
|
||||
|
||||
|
||||
if (SLang_Error_Routine == NULL)
|
||||
{
|
||||
fputs (err, stderr);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* Copyright (c) 1992, 1995 John E. Davis
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* You may distribute under the terms of either the GNU General Public
|
||||
* License or the Perl Artistic License.
|
||||
*/
|
||||
|
@ -18,7 +18,7 @@ int SLang_Abort_Char = 7;
|
|||
int SLang_Ignore_User_Abort = 0;
|
||||
|
||||
/* This has the effect of mapping all characters in the range 128-169 to
|
||||
* ESC [ something
|
||||
* ESC [ something
|
||||
*/
|
||||
#ifndef __GO32__
|
||||
# if defined(__unix__) || defined(vms)
|
||||
|
@ -31,18 +31,18 @@ unsigned int SLang_getkey (void)
|
|||
{
|
||||
unsigned int imax;
|
||||
unsigned int ch;
|
||||
|
||||
|
||||
if (SLang_Input_Buffer_Len)
|
||||
{
|
||||
ch = (unsigned int) *SLang_Input_Buffer;
|
||||
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);
|
||||
}
|
||||
else if (0xFFFF == (ch = SLsys_getkey ())) return ch;
|
||||
|
||||
|
||||
#ifdef DEC_8BIT_HACK
|
||||
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;
|
||||
|
||||
SLMEMCPY ((char *) SLang_Input_Buffer + SLang_Input_Buffer_Len,
|
||||
|
||||
SLMEMCPY ((char *) SLang_Input_Buffer + SLang_Input_Buffer_Len,
|
||||
(char *) s, n);
|
||||
SLang_Input_Buffer_Len += n;
|
||||
}
|
||||
|
@ -95,14 +95,14 @@ int SLang_input_pending (int tsecs)
|
|||
int n;
|
||||
unsigned char c;
|
||||
if (SLang_Input_Buffer_Len) return (int) SLang_Input_Buffer_Len;
|
||||
|
||||
|
||||
n = SLsys_input_pending (tsecs);
|
||||
|
||||
|
||||
if (n <= 0) return 0;
|
||||
|
||||
|
||||
c = (unsigned char) SLang_getkey ();
|
||||
SLang_ungetkey_string (&c, 1);
|
||||
|
||||
|
||||
return n;
|
||||
}
|
||||
#endif /* OS2_NT */
|
||||
|
@ -110,10 +110,10 @@ int SLang_input_pending (int tsecs)
|
|||
void SLang_flush_input (void)
|
||||
{
|
||||
int quit = SLKeyBoard_Quit;
|
||||
|
||||
|
||||
SLang_Input_Buffer_Len = 0;
|
||||
SLKeyBoard_Quit = 0;
|
||||
while (SLsys_input_pending (0) > 0)
|
||||
SLKeyBoard_Quit = 0;
|
||||
while (SLsys_input_pending (0) > 0)
|
||||
{
|
||||
(void) SLsys_getkey ();
|
||||
/* Set this to 0 because SLsys_getkey may stuff keyboard buffer if
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* Copyright (c) 1992, 1995 John E. Davis
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* You may distribute under the terms of either the GNU General Public
|
||||
* License or the Perl Artistic License.
|
||||
*/
|
||||
|
@ -10,7 +10,7 @@
|
|||
use system rouines. For msdos, I use inline assembly. */
|
||||
|
||||
/* The current versions only work in the forward direction only!! */
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -32,20 +32,20 @@ char *SLmemcpy(char *s1, char *s2, int n)
|
|||
asm mov si, bx
|
||||
asm mov di, dx
|
||||
return(s1);
|
||||
|
||||
|
||||
#else
|
||||
register char *smax, *s = s1;
|
||||
int n2;
|
||||
|
||||
|
||||
n2 = 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 += 4;
|
||||
s2 += 4;
|
||||
}
|
||||
while (n2--) *s++ = *s2++;
|
||||
return(s1);
|
||||
return(s1);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* Copyright (c) 1992, 1995 John E. Davis
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* You may distribute under the terms of either the GNU General Public
|
||||
* License or the Perl Artistic License.
|
||||
*/
|
||||
|
@ -10,7 +10,7 @@
|
|||
use system rouines. For msdos, I use inline assembly. */
|
||||
|
||||
/* The current versions only work in the forward direction only!! */
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -34,10 +34,10 @@ void SLmemset(char *p, char space, int n)
|
|||
|
||||
pmax = p + (n - 4);
|
||||
n = n % 4;
|
||||
while (p <= pmax)
|
||||
while (p <= pmax)
|
||||
{
|
||||
*p++ = space; *p++ = space; *p++ = space; *p++= space;
|
||||
}
|
||||
while (n--) *p++ = space;
|
||||
while (n--) *p++ = space;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* Copyright (c) 1992, 1995 John E. Davis
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* You may distribute under the terms of either the GNU General Public
|
||||
* License or the Perl Artistic License.
|
||||
*/
|
||||
|
@ -235,10 +235,10 @@ unsigned int SLsys_getkey ()
|
|||
{
|
||||
unsigned int c;
|
||||
unsigned char scan;
|
||||
|
||||
|
||||
int tsecs = 300;
|
||||
|
||||
if (!keyWaiting())
|
||||
|
||||
if (!keyWaiting())
|
||||
while (!SLsys_input_pending(tsecs));
|
||||
|
||||
/* read codes from buffer */
|
||||
|
|
|
@ -21,7 +21,7 @@ SLSig_Fun_Type *SLsignal (int sig, SLSig_Fun_Type *f)
|
|||
{
|
||||
#ifdef SLANG_POSIX_SIGNALS
|
||||
struct sigaction old_sa, new_sa;
|
||||
|
||||
|
||||
# ifdef SIGALRM
|
||||
/* We want system calls to be interrupted by SIGALRM. */
|
||||
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);
|
||||
new_sa.sa_handler = f;
|
||||
|
||||
|
||||
new_sa.sa_flags = 0;
|
||||
# ifdef SA_RESTART
|
||||
new_sa.sa_flags |= SA_RESTART;
|
||||
# endif
|
||||
|
||||
|
||||
if (-1 == sigaction (sig, &new_sa, &old_sa))
|
||||
return (SLSig_Fun_Type *) SIG_ERR;
|
||||
|
||||
|
||||
return old_sa.sa_handler;
|
||||
#else
|
||||
/* Not POSIX. */
|
||||
|
@ -45,25 +45,25 @@ SLSig_Fun_Type *SLsignal (int sig, SLSig_Fun_Type *f)
|
|||
#endif
|
||||
}
|
||||
|
||||
/* This function will NOT cause system calls to be restarted after
|
||||
* signal if possible
|
||||
/* This function will NOT cause system calls to be restarted after
|
||||
* signal if possible
|
||||
*/
|
||||
SLSig_Fun_Type *SLsignal_intr (int sig, SLSig_Fun_Type *f)
|
||||
{
|
||||
#ifdef SLANG_POSIX_SIGNALS
|
||||
struct sigaction old_sa, new_sa;
|
||||
|
||||
|
||||
sigemptyset (&new_sa.sa_mask);
|
||||
new_sa.sa_handler = f;
|
||||
|
||||
|
||||
new_sa.sa_flags = 0;
|
||||
# ifdef SA_INTERRUPT
|
||||
new_sa.sa_flags |= SA_INTERRUPT;
|
||||
# endif
|
||||
|
||||
|
||||
if (-1 == sigaction (sig, &new_sa, &old_sa))
|
||||
return (SLSig_Fun_Type *) SIG_ERR;
|
||||
|
||||
|
||||
return old_sa.sa_handler;
|
||||
#else
|
||||
/* 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
|
||||
* possibly interrupt signals.
|
||||
*/
|
||||
|
@ -87,13 +87,13 @@ int SLsig_block_signals (void)
|
|||
#ifdef SLANG_POSIX_SIGNALS
|
||||
sigset_t new_mask;
|
||||
#endif
|
||||
|
||||
|
||||
Blocked_Depth++;
|
||||
if (Blocked_Depth != 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef SLANG_POSIX_SIGNALS
|
||||
sigemptyset (&new_mask);
|
||||
# ifdef SIGQUIT
|
||||
|
@ -111,7 +111,7 @@ int SLsig_block_signals (void)
|
|||
# ifdef SIGTTOU
|
||||
sigaddset (&new_mask, SIGTTOU);
|
||||
# endif
|
||||
|
||||
|
||||
(void) sigprocmask (SIG_BLOCK, &new_mask, &Old_Signal_Mask);
|
||||
return 0;
|
||||
#else
|
||||
|
@ -124,12 +124,12 @@ int SLsig_unblock_signals (void)
|
|||
{
|
||||
if (Blocked_Depth == 0)
|
||||
return -1;
|
||||
|
||||
|
||||
Blocked_Depth--;
|
||||
|
||||
|
||||
if (Blocked_Depth != 0)
|
||||
return 0;
|
||||
|
||||
|
||||
#ifdef SLANG_POSIX_SIGNALS
|
||||
(void) sigprocmask (SIG_SETMASK, &Old_Signal_Mask, NULL);
|
||||
return 0;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* SLang Screen management routines */
|
||||
/* Copyright (c) 1992, 1995 John E. Davis
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* You may distribute under the terms of either the GNU General Public
|
||||
* 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;
|
||||
|
||||
color_ch = (This_Color << 8) | (unsigned short) ch;
|
||||
|
||||
|
||||
while (p < pmax)
|
||||
{
|
||||
*p++ = color_ch;
|
||||
|
@ -72,7 +72,7 @@ static void clear_region (int row, int n)
|
|||
{
|
||||
int i;
|
||||
int imax = row + n;
|
||||
|
||||
|
||||
if (imax > Screen_Rows) imax = Screen_Rows;
|
||||
for (i = row; i < imax; i++)
|
||||
{
|
||||
|
@ -87,10 +87,10 @@ static void clear_region (int row, int n)
|
|||
void SLsmg_erase_eol (void)
|
||||
{
|
||||
int r, c;
|
||||
|
||||
|
||||
c = This_Col - Start_Col;
|
||||
r = This_Row - Start_Row;
|
||||
|
||||
|
||||
if ((r < 0) || (r >= Screen_Rows)) return;
|
||||
if (c < 0) c = 0; else if (c >= Screen_Cols) return;
|
||||
blank_line (SL_Screen[This_Row].neew + c , Screen_Cols - c, ' ');
|
||||
|
@ -115,7 +115,7 @@ static void scroll_up (void)
|
|||
This_Row--;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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;
|
||||
else This_Alt_Char = 0;
|
||||
|
||||
|
||||
This_Color &= 0x7F;
|
||||
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)
|
||||
&& ((col_too == 0)
|
||||
|| ((This_Col >= Start_Col)
|
||||
|| ((This_Col >= Start_Col)
|
||||
&& (This_Col < Start_Col + Screen_Cols))));
|
||||
}
|
||||
|
||||
|
||||
void SLsmg_printf (char *fmt, ...)
|
||||
{
|
||||
char p[1000];
|
||||
|
@ -191,7 +191,7 @@ void SLsmg_printf (char *fmt, ...)
|
|||
va_start(ap, fmt);
|
||||
(void) vsprintf(p, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
|
||||
SLsmg_write_string (p);
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,7 @@ void SLsmg_write_nstring (char *str, int n)
|
|||
int width;
|
||||
char blank = ' ';
|
||||
if (str == NULL) width = 0;
|
||||
else
|
||||
else
|
||||
{
|
||||
width = strlen (str);
|
||||
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;
|
||||
int maxc = dc;
|
||||
|
||||
|
||||
if ((dr == 0) || (dc == 0)) return;
|
||||
p = s;
|
||||
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'))
|
||||
{
|
||||
int diff;
|
||||
|
||||
|
||||
diff = maxc - dc;
|
||||
|
||||
|
||||
SLsmg_gotorc (r, c);
|
||||
SLsmg_write_nchars (s, dc);
|
||||
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 (' ');
|
||||
}
|
||||
if ((ch == 0) || (dr == 1)) break;
|
||||
|
||||
|
||||
r++;
|
||||
dc = 0;
|
||||
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;
|
||||
|
||||
|
@ -282,30 +282,30 @@ void SLsmg_write_nchars (char *str, int n)
|
|||
int newline_flag;
|
||||
#ifndef pc_system
|
||||
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));
|
||||
#endif
|
||||
|
||||
str_max = str + n;
|
||||
color = This_Color << 8;
|
||||
|
||||
|
||||
top: /* get here only on newline */
|
||||
|
||||
|
||||
newline_flag = 0;
|
||||
start_len = Start_Col;
|
||||
|
||||
|
||||
if (point_visible (0) == 0) return;
|
||||
|
||||
|
||||
len = This_Col;
|
||||
max_len = start_len + Screen_Cols;
|
||||
|
||||
p = SL_Screen[This_Row].neew;
|
||||
if (len > start_len) p += (len - start_len);
|
||||
|
||||
|
||||
flags = SL_Screen[This_Row].flags;
|
||||
while ((len < max_len) && (str < str_max))
|
||||
{
|
||||
{
|
||||
ch = (unsigned char) *str++;
|
||||
|
||||
#ifndef pc_system
|
||||
|
@ -332,7 +332,7 @@ void SLsmg_write_nchars (char *str, int n)
|
|||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
else if ((ch == '\t') && (SLsmg_Tab_Width > 0))
|
||||
{
|
||||
n = len;
|
||||
|
@ -345,7 +345,7 @@ void SLsmg_write_nchars (char *str, int n)
|
|||
len += 1;
|
||||
if (len > start_len)
|
||||
{
|
||||
if (*p != neew)
|
||||
if (*p != neew)
|
||||
{
|
||||
flags |= TOUCHED;
|
||||
*p = neew;
|
||||
|
@ -381,7 +381,7 @@ void SLsmg_write_nchars (char *str, int n)
|
|||
ch &= 0x7F;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
len += 1;
|
||||
if (len > start_len)
|
||||
{
|
||||
|
@ -394,7 +394,7 @@ void SLsmg_write_nchars (char *str, int n)
|
|||
p++;
|
||||
if (len == max_len) break;
|
||||
}
|
||||
|
||||
|
||||
if (ch == 127) ch = '?'; else ch = ch + '@';
|
||||
len++;
|
||||
if (len > start_len)
|
||||
|
@ -409,13 +409,13 @@ void SLsmg_write_nchars (char *str, int n)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SL_Screen[This_Row].flags = flags;
|
||||
This_Col = len;
|
||||
|
||||
|
||||
if (SLsmg_Newline_Moves == 0)
|
||||
return;
|
||||
|
||||
|
||||
if (newline_flag == 0)
|
||||
{
|
||||
while (str < str_max)
|
||||
|
@ -426,7 +426,7 @@ void SLsmg_write_nchars (char *str, int n)
|
|||
if (str == str_max) return;
|
||||
str++;
|
||||
}
|
||||
|
||||
|
||||
This_Row++;
|
||||
This_Col = 0;
|
||||
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)
|
||||
{
|
||||
unsigned short *amax = a + Screen_Cols;
|
||||
|
||||
|
||||
while (a < amax) *a++ = *b++;
|
||||
}
|
||||
#endif
|
||||
|
@ -469,16 +469,16 @@ static unsigned long compute_hash (unsigned short *s, int n)
|
|||
register unsigned long sum = 0;
|
||||
register unsigned short *smax, ch;
|
||||
int is_blank = 2;
|
||||
|
||||
|
||||
s += SLsmg_Scroll_Hash_Border;
|
||||
smax = s + (n - SLsmg_Scroll_Hash_Border);
|
||||
while (s < smax)
|
||||
while (s < smax)
|
||||
{
|
||||
ch = *s++;
|
||||
if (is_blank && ((ch & 0xFF) != 32)) is_blank--;
|
||||
|
||||
|
||||
sum += ch;
|
||||
|
||||
|
||||
h = sum + (h << 3);
|
||||
if ((g = h & 0xE0000000UL) != 0)
|
||||
{
|
||||
|
@ -499,9 +499,9 @@ static void try_scroll (void)
|
|||
int color, did_scroll = 0;
|
||||
unsigned short *tmp;
|
||||
int ignore;
|
||||
|
||||
|
||||
/* find region limits. */
|
||||
|
||||
|
||||
for (rmax = Screen_Rows - 1; rmax > 0; rmax--)
|
||||
{
|
||||
if (SL_Screen[rmax].new_hash != SL_Screen[rmax].old_hash)
|
||||
|
@ -510,11 +510,11 @@ static void try_scroll (void)
|
|||
if ((r1 == 0)
|
||||
|| (SL_Screen[r1].new_hash != SL_Screen[r1].old_hash))
|
||||
break;
|
||||
|
||||
|
||||
rmax = r1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (rmin = 0; rmin < rmax; rmin++)
|
||||
{
|
||||
if (SL_Screen[rmin].new_hash != SL_Screen[rmin].old_hash)
|
||||
|
@ -523,30 +523,30 @@ static void try_scroll (void)
|
|||
if ((r1 == rmax)
|
||||
|| (SL_Screen[r1].new_hash != SL_Screen[r1].old_hash))
|
||||
break;
|
||||
|
||||
|
||||
rmin = r1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (i = rmax; i > rmin; i--)
|
||||
{
|
||||
hash = SL_Screen[i].new_hash;
|
||||
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 > rmin) && (SL_Screen[i].old_hash == SL_Screen[i - 1].new_hash)))
|
||||
continue;
|
||||
|
||||
|
||||
for (j = i - 1; j >= rmin; j--)
|
||||
{
|
||||
if (hash == SL_Screen[j].old_hash) break;
|
||||
}
|
||||
if (j < rmin) continue;
|
||||
|
||||
|
||||
r2 = i; /* end scroll region */
|
||||
|
||||
|
||||
di = i - j;
|
||||
j--;
|
||||
ignore = 0;
|
||||
|
@ -556,12 +556,12 @@ static void try_scroll (void)
|
|||
j--;
|
||||
}
|
||||
r1 = j + 1;
|
||||
|
||||
|
||||
/* If this scroll only scrolls this line into place, don't do it.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
|
||||
|
@ -576,7 +576,7 @@ static void try_scroll (void)
|
|||
}
|
||||
}
|
||||
if (j <= r2) continue;
|
||||
|
||||
|
||||
color = This_Color; This_Color = 0;
|
||||
did_scroll = 1;
|
||||
SLtt_normal_video ();
|
||||
|
@ -584,11 +584,11 @@ static void try_scroll (void)
|
|||
SLtt_goto_rc (0, 0);
|
||||
SLtt_reverse_index (di);
|
||||
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.
|
||||
*/
|
||||
for (j = r1; j <= r2; j++) SL_Screen[j].flags = TOUCHED;
|
||||
|
||||
|
||||
while (di--)
|
||||
{
|
||||
tmp = SL_Screen[r2].old;
|
||||
|
@ -605,7 +605,7 @@ static void try_scroll (void)
|
|||
This_Color = color;
|
||||
}
|
||||
if (did_scroll) return;
|
||||
|
||||
|
||||
/* Try other direction */
|
||||
|
||||
for (i = rmin; i < rmax; i++)
|
||||
|
@ -613,18 +613,18 @@ static void try_scroll (void)
|
|||
hash = SL_Screen[i].new_hash;
|
||||
if (hash == Blank_Hash) continue;
|
||||
if (hash == SL_Screen[i].old_hash) continue;
|
||||
|
||||
|
||||
/* find a match further down screen */
|
||||
for (j = i + 1; j <= rmax; j++)
|
||||
{
|
||||
if (hash == SL_Screen[j].old_hash) break;
|
||||
}
|
||||
if (j > rmax) continue;
|
||||
|
||||
|
||||
r1 = i; /* beg scroll region */
|
||||
di = j - i; /* number of lines to scroll */
|
||||
j++; /* since we know this is a match */
|
||||
|
||||
|
||||
/* find end of scroll region */
|
||||
ignore = 0;
|
||||
while ((j <= rmax) && (SL_Screen[j].old_hash == SL_Screen[j - di].new_hash))
|
||||
|
@ -633,15 +633,15 @@ static void try_scroll (void)
|
|||
j++;
|
||||
}
|
||||
r2 = j - 1; /* end of scroll region */
|
||||
|
||||
|
||||
/* If this scroll only scrolls this line into place, don't do it.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
|
||||
|
||||
for (j = r1; j <= r2; j++)
|
||||
{
|
||||
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))
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (j <= r2) continue;
|
||||
|
||||
|
||||
color = This_Color; This_Color = 0;
|
||||
SLtt_normal_video ();
|
||||
SLtt_set_scroll_region (r1, r2);
|
||||
SLtt_goto_rc (0, 0); /* relative to scroll region */
|
||||
SLtt_delete_nlines (di);
|
||||
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.
|
||||
*/
|
||||
for (j = r1; j <= r2; j++) SL_Screen[j].flags = TOUCHED;
|
||||
|
||||
|
||||
while (di--)
|
||||
{
|
||||
tmp = SL_Screen[r1].old;
|
||||
|
@ -683,15 +683,15 @@ static void try_scroll (void)
|
|||
}
|
||||
|
||||
#endif /* NOT pc_system */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static int Smg_Inited;
|
||||
|
||||
void SLsmg_refresh (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
if (Smg_Inited == 0) return;
|
||||
#ifndef pc_system
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (Cls_Flag)
|
||||
|
||||
if (Cls_Flag)
|
||||
{
|
||||
SLtt_normal_video (); SLtt_cls ();
|
||||
}
|
||||
|
@ -712,9 +712,9 @@ void SLsmg_refresh (void)
|
|||
for (i = 0; i < Screen_Rows; i++)
|
||||
{
|
||||
int trashed;
|
||||
|
||||
|
||||
if (SL_Screen[i].flags == 0) continue;
|
||||
|
||||
|
||||
if (SL_Screen[i].flags & TRASHED)
|
||||
{
|
||||
SLtt_goto_rc (i, -1); /* Force cursor to move */
|
||||
|
@ -723,21 +723,21 @@ void SLsmg_refresh (void)
|
|||
trashed = 1;
|
||||
}
|
||||
else trashed = 0;
|
||||
|
||||
if (Cls_Flag || trashed)
|
||||
|
||||
if (Cls_Flag || trashed)
|
||||
{
|
||||
int color = This_Color;
|
||||
This_Color = 0;
|
||||
blank_line (SL_Screen[i].old, Screen_Cols, ' ');
|
||||
This_Color = color;
|
||||
}
|
||||
|
||||
|
||||
SL_Screen[i].old[Screen_Cols] = 0;
|
||||
SL_Screen[i].neew[Screen_Cols] = 0;
|
||||
|
||||
|
||||
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));
|
||||
|
||||
SL_Screen[i].flags = 0;
|
||||
|
@ -745,7 +745,7 @@ void SLsmg_refresh (void)
|
|||
SL_Screen[i].old_hash = SL_Screen[i].new_hash;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
if (point_visible (1)) SLtt_goto_rc (This_Row - Start_Row, This_Col - Start_Col);
|
||||
SLtt_flush_output ();
|
||||
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 row_max;
|
||||
|
||||
|
||||
if (n < 0) return 0;
|
||||
if (row >= box_end) return 0;
|
||||
row_max = row + n;
|
||||
if (row_max <= box_start) return 0;
|
||||
|
||||
|
||||
if (row < box_start) row = box_start;
|
||||
if (row_max >= box_end) row_max = box_end;
|
||||
*rmin = row;
|
||||
|
@ -772,10 +772,10 @@ void SLsmg_touch_lines (int row, int n)
|
|||
{
|
||||
int i;
|
||||
int r1, r2;
|
||||
|
||||
|
||||
if (0 == compute_clip (row, n, Start_Row, Start_Row + Screen_Rows, &r1, &r2))
|
||||
return;
|
||||
|
||||
|
||||
r1 -= Start_Row;
|
||||
r2 -= Start_Row;
|
||||
for (i = r1; i < r2; i++)
|
||||
|
@ -791,17 +791,17 @@ static void init_alt_char_set (void)
|
|||
{
|
||||
int i;
|
||||
unsigned char *p, *pmax, ch;
|
||||
|
||||
|
||||
if (Alt_Char_Set[128] == 128) return;
|
||||
|
||||
i = 32;
|
||||
memset ((char *)Alt_Char_Set, ' ', i);
|
||||
while (i <= 128)
|
||||
while (i <= 128)
|
||||
{
|
||||
Alt_Char_Set [i] = i;
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
/* Map to VT100 */
|
||||
if (SLtt_Has_Alt_Charset)
|
||||
{
|
||||
|
@ -810,7 +810,7 @@ static void init_alt_char_set (void)
|
|||
}
|
||||
else p = (unsigned char *) Fake_Alt_Char_Pairs;
|
||||
pmax = p + strlen ((char *) p);
|
||||
|
||||
|
||||
/* Some systems have messed up entries for this */
|
||||
while (p < pmax)
|
||||
{
|
||||
|
@ -840,7 +840,7 @@ void SLsmg_suspend_smg (void)
|
|||
SLtt_reset_video ();
|
||||
Smg_Suspended = 1;
|
||||
}
|
||||
|
||||
|
||||
UNBLOCK_SIGNALS
|
||||
}
|
||||
|
||||
|
@ -849,19 +849,19 @@ void SLsmg_resume_smg (void)
|
|||
int i;
|
||||
BLOCK_SIGNALS
|
||||
|
||||
if (Smg_Suspended == 0)
|
||||
if (Smg_Suspended == 0)
|
||||
{
|
||||
UNBLOCK_SIGNALS
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Smg_Suspended = 0;
|
||||
SLtt_init_video ();
|
||||
Cls_Flag = 1;
|
||||
for (i = 0; i < Screen_Rows; i++)
|
||||
SL_Screen[i].flags |= TRASHED;
|
||||
SLsmg_refresh ();
|
||||
|
||||
|
||||
UNBLOCK_SIGNALS
|
||||
}
|
||||
|
||||
|
@ -870,7 +870,7 @@ int SLsmg_init_smg (void)
|
|||
int i, len;
|
||||
unsigned short *old, *neew;
|
||||
BLOCK_SIGNALS
|
||||
|
||||
|
||||
if (Smg_Inited) SLsmg_reset_smg ();
|
||||
SLtt_init_video ();
|
||||
Screen_Cols = SLtt_Screen_Cols;
|
||||
|
@ -913,8 +913,8 @@ void SLsmg_reset_smg (void)
|
|||
{
|
||||
int i;
|
||||
BLOCK_SIGNALS
|
||||
|
||||
if (Smg_Inited == 0)
|
||||
|
||||
if (Smg_Inited == 0)
|
||||
{
|
||||
UNBLOCK_SIGNALS
|
||||
return;
|
||||
|
@ -928,7 +928,7 @@ void SLsmg_reset_smg (void)
|
|||
SLtt_reset_video ();
|
||||
This_Alt_Char = This_Color = 0;
|
||||
Smg_Inited = 0;
|
||||
|
||||
|
||||
UNBLOCK_SIGNALS
|
||||
}
|
||||
|
||||
|
@ -946,16 +946,16 @@ unsigned short SLsmg_char_at (void)
|
|||
void SLsmg_vprintf (char *fmt, va_list ap)
|
||||
{
|
||||
char p[1000];
|
||||
|
||||
|
||||
(void) vsprintf(p, fmt, ap);
|
||||
|
||||
|
||||
SLsmg_write_string (p);
|
||||
}
|
||||
|
||||
void SLsmg_set_screen_start (int *r, int *c)
|
||||
{
|
||||
int or = Start_Row, oc = Start_Col;
|
||||
|
||||
|
||||
if (c == NULL) Start_Col = 0;
|
||||
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)
|
||||
{
|
||||
This_Row = r; This_Col = c;
|
||||
|
||||
|
||||
if (point_visible (1))
|
||||
{
|
||||
int color = This_Color;
|
||||
|
@ -992,33 +992,33 @@ void SLsmg_draw_hline (int n)
|
|||
int cmin, cmax;
|
||||
int final_col = This_Col + n;
|
||||
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,
|
||||
&cmin, &cmax)))
|
||||
{
|
||||
This_Col = final_col;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (hbuf[0] == 0)
|
||||
{
|
||||
SLMEMSET ((char *) hbuf, SLSMG_HLINE_CHAR, 16);
|
||||
}
|
||||
|
||||
|
||||
n = cmax - cmin;
|
||||
count = n / 16;
|
||||
|
||||
|
||||
save_color = This_Color;
|
||||
This_Color |= ALT_CHAR_FLAG;
|
||||
This_Col = cmin;
|
||||
|
||||
|
||||
SLsmg_write_nchars ((char *) hbuf, n % 16);
|
||||
while (count-- > 0)
|
||||
{
|
||||
SLsmg_write_nchars ((char *) hbuf, 16);
|
||||
}
|
||||
|
||||
|
||||
This_Color = save_color;
|
||||
This_Col = final_col;
|
||||
}
|
||||
|
@ -1029,7 +1029,7 @@ void SLsmg_draw_vline (int n)
|
|||
int c = This_Col, rmin, rmax;
|
||||
int final_row = This_Row + n;
|
||||
int save_color;
|
||||
|
||||
|
||||
if (((c < Start_Col) || (c >= Start_Col + Screen_Cols)) ||
|
||||
(0 == compute_clip (This_Row, n, Start_Row, Start_Row + Screen_Rows,
|
||||
&rmin, &rmax)))
|
||||
|
@ -1037,52 +1037,52 @@ void SLsmg_draw_vline (int n)
|
|||
This_Row = final_row;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
save_color = This_Color;
|
||||
This_Color |= ALT_CHAR_FLAG;
|
||||
|
||||
|
||||
for (This_Row = rmin; This_Row < rmax; This_Row++)
|
||||
{
|
||||
This_Col = c;
|
||||
SLsmg_write_nchars ((char *) &ch, 1);
|
||||
}
|
||||
|
||||
|
||||
This_Col = c; This_Row = final_row;
|
||||
This_Color = save_color;
|
||||
}
|
||||
|
||||
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;
|
||||
dr--; dc--;
|
||||
SLsmg_draw_hline (dc);
|
||||
SLsmg_draw_hline (dc);
|
||||
SLsmg_draw_vline (dr);
|
||||
This_Row = r; This_Col = c;
|
||||
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 + dc, SLSMG_URCORN_CHAR);
|
||||
SLsmg_draw_object (r + dr, c, SLSMG_LLCORN_CHAR);
|
||||
SLsmg_draw_object (r + dr, c + dc, SLSMG_LRCORN_CHAR);
|
||||
This_Row = r; This_Col = c;
|
||||
}
|
||||
|
||||
|
||||
void SLsmg_fill_region (int r, int c, int dr, int dc, unsigned char ch)
|
||||
{
|
||||
static unsigned char hbuf[16];
|
||||
int count;
|
||||
int dcmax, rmax;
|
||||
|
||||
|
||||
|
||||
|
||||
if ((dc < 0) || (dr < 0)) return;
|
||||
|
||||
|
||||
SLsmg_gotorc (r, c);
|
||||
r = This_Row; c = This_Col;
|
||||
|
||||
|
||||
dcmax = Screen_Cols - This_Col;
|
||||
if (dc > dcmax) dc = dcmax;
|
||||
|
||||
|
||||
rmax = This_Row + dr;
|
||||
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];
|
||||
#endif
|
||||
if (ch != hbuf[0]) SLMEMSET ((char *) hbuf, (char) ch, 16);
|
||||
|
||||
|
||||
for (This_Row = r; This_Row < rmax; This_Row++)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
This_Row = r;
|
||||
}
|
||||
|
||||
|
@ -1115,21 +1115,21 @@ void SLsmg_write_color_chars (unsigned short *s, unsigned int len)
|
|||
unsigned short *smax, sh;
|
||||
char buf[32], *b, *bmax;
|
||||
int color, save_color;
|
||||
|
||||
|
||||
smax = s + len;
|
||||
b = buf;
|
||||
bmax = b + sizeof (buf);
|
||||
|
||||
|
||||
save_color = This_Color;
|
||||
|
||||
while (s < smax)
|
||||
{
|
||||
sh = *s++;
|
||||
|
||||
|
||||
color = sh >> 8;
|
||||
if ((color != This_Color) || (b == bmax))
|
||||
{
|
||||
if (b != buf)
|
||||
if (b != buf)
|
||||
{
|
||||
SLsmg_write_nchars (buf, (int) (b - buf));
|
||||
b = buf;
|
||||
|
@ -1138,10 +1138,10 @@ void SLsmg_write_color_chars (unsigned short *s, unsigned int len)
|
|||
}
|
||||
*b++ = (char) (sh & 0xFF);
|
||||
}
|
||||
|
||||
|
||||
if (b != buf)
|
||||
SLsmg_write_nchars (buf, (int) (b - buf));
|
||||
|
||||
|
||||
This_Color = save_color;
|
||||
}
|
||||
|
||||
|
@ -1150,13 +1150,13 @@ unsigned int SLsmg_read_raw (unsigned short *buf, unsigned int len)
|
|||
unsigned int r, c;
|
||||
|
||||
if (0 == point_visible (1)) return 0;
|
||||
|
||||
|
||||
r = (unsigned int) (This_Row - Start_Row);
|
||||
c = (unsigned int) (This_Col - Start_Col);
|
||||
|
||||
|
||||
if (c + len > (unsigned int) Screen_Cols)
|
||||
len = (unsigned int) Screen_Cols - c;
|
||||
|
||||
|
||||
memcpy ((char *) buf, (char *) (SL_Screen[r].neew + c), len * sizeof (short));
|
||||
return len;
|
||||
}
|
||||
|
@ -1165,19 +1165,19 @@ unsigned int SLsmg_write_raw (unsigned short *buf, unsigned int len)
|
|||
{
|
||||
unsigned int r, c;
|
||||
unsigned short *dest;
|
||||
|
||||
|
||||
if (0 == point_visible (1)) return 0;
|
||||
|
||||
|
||||
r = (unsigned int) (This_Row - Start_Row);
|
||||
c = (unsigned int) (This_Col - Start_Col);
|
||||
|
||||
|
||||
if (c + len > (unsigned int) Screen_Cols)
|
||||
len = (unsigned int) Screen_Cols - c;
|
||||
|
||||
|
||||
dest = SL_Screen[r].neew + c;
|
||||
|
||||
|
||||
if (0 != memcmp ((char *) dest, (char *) buf, len * sizeof (short)))
|
||||
{
|
||||
{
|
||||
memcpy ((char *) dest, (char *) buf, len * sizeof (short));
|
||||
SL_Screen[r].flags |= TOUCHED;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
/* Copyright (c) 1992, 1995 John E. Davis
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* You may distribute under the terms of either the GNU General Public
|
||||
* License or the Perl Artistic License.
|
||||
*/
|
||||
|
@ -24,7 +24,7 @@
|
|||
* The majority of the comments found in the file were taken from the
|
||||
* term(4) man page on an SGI.
|
||||
*/
|
||||
|
||||
|
||||
/* 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 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
|
||||
* divided into six parts in the following order: the header, terminal
|
||||
* names, boolean flags, numbers, strings, and string table.
|
||||
*
|
||||
*
|
||||
* The header section begins the file. This section contains six short
|
||||
* 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)
|
||||
|
@ -65,7 +65,7 @@ static int make_integer (unsigned char *buf)
|
|||
|
||||
#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
|
||||
* and the other fields are pointers into it.
|
||||
*/
|
||||
|
@ -77,19 +77,19 @@ typedef struct
|
|||
|
||||
unsigned int name_section_size;
|
||||
char *terminal_names;
|
||||
|
||||
|
||||
unsigned int boolean_section_size;
|
||||
unsigned char *boolean_flags;
|
||||
|
||||
|
||||
unsigned int num_numbers;
|
||||
unsigned char *numbers;
|
||||
|
||||
|
||||
unsigned int num_string_offsets;
|
||||
unsigned char *string_offsets;
|
||||
|
||||
|
||||
unsigned int string_table_size;
|
||||
char *string_table;
|
||||
|
||||
|
||||
} Terminfo_Type;
|
||||
|
||||
static char *tcap_getstr (char *, Terminfo_Type *);
|
||||
|
@ -101,10 +101,10 @@ static FILE *open_terminfo (char *file, Terminfo_Type *h)
|
|||
{
|
||||
FILE *fp;
|
||||
unsigned char buf[12];
|
||||
|
||||
|
||||
fp = fopen (file, "rb");
|
||||
if (fp == NULL) return NULL;
|
||||
|
||||
|
||||
if ((12 == fread ((char *) buf, 1, 12, fp) && (MAGIC == make_integer (buf))))
|
||||
{
|
||||
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->string_table_size = make_integer (buf + 10);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
fclose (fp);
|
||||
fp = NULL;
|
||||
}
|
||||
return fp;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
/*
|
||||
* The terminal names section comes next. It contains the first line of the
|
||||
* terminfo description, listing the various names for the terminal,
|
||||
* 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)
|
||||
{
|
||||
char *s;
|
||||
|
||||
|
||||
if (NULL == (s = (char *) SLMALLOC (size))) return NULL;
|
||||
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
|
||||
* boundary.
|
||||
*/
|
||||
|
||||
|
||||
unsigned int size = (t->name_section_size + t->boolean_section_size) % 2;
|
||||
size += t->boolean_section_size;
|
||||
|
||||
|
||||
return t->boolean_flags = read_terminfo_section (fp, size);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* 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
|
||||
* 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
|
||||
static char *Terminfo_Dirs [MAX_TI_DIRS] =
|
||||
static char *Terminfo_Dirs [MAX_TI_DIRS] =
|
||||
{
|
||||
NULL,
|
||||
"/usr/lib/terminfo",
|
||||
|
@ -232,25 +232,25 @@ static char *Terminfo_Dirs [MAX_TI_DIRS] =
|
|||
|
||||
char *SLtt_tigetent (char *term)
|
||||
{
|
||||
char *tidir;
|
||||
char *tidir;
|
||||
int i;
|
||||
FILE *fp = NULL;
|
||||
char file[256];
|
||||
Terminfo_Type *ti;
|
||||
|
||||
if (
|
||||
(term == NULL)
|
||||
(term == NULL)
|
||||
#ifdef SLANG_UNTIC
|
||||
&& (SLang_Untic_Terminfo_File == NULL)
|
||||
#endif
|
||||
)
|
||||
return NULL;
|
||||
|
||||
|
||||
if (NULL == (ti = (Terminfo_Type *) SLMALLOC (sizeof (Terminfo_Type))))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
#ifdef SLANG_UNTIC
|
||||
if (SLang_Untic_Terminfo_File != NULL)
|
||||
{
|
||||
|
@ -261,7 +261,7 @@ char *SLtt_tigetent (char *term)
|
|||
#endif
|
||||
/* If we are on a termcap based system, use termcap */
|
||||
if (0 == tcap_getent (term, ti)) return (char *) ti;
|
||||
|
||||
|
||||
Terminfo_Dirs[0] = getenv ("TERMINFO");
|
||||
i = 0;
|
||||
while (i < MAX_TI_DIRS)
|
||||
|
@ -277,8 +277,8 @@ char *SLtt_tigetent (char *term)
|
|||
#ifdef SLANG_UNTIC
|
||||
fp_open_label:
|
||||
#endif
|
||||
|
||||
if (fp != NULL)
|
||||
|
||||
if (fp != NULL)
|
||||
{
|
||||
if (NULL != read_terminal_names (fp, ti))
|
||||
{
|
||||
|
@ -305,7 +305,7 @@ char *SLtt_tigetent (char *term)
|
|||
}
|
||||
fclose (fp);
|
||||
}
|
||||
|
||||
|
||||
SLFREE (ti);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -316,7 +316,7 @@ char *SLtt_tigetent (char *term)
|
|||
# define UNTIC_COMMENT(x)
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
char name[3];
|
||||
int offset;
|
||||
|
@ -413,7 +413,7 @@ static int compute_cap_offset (char *cap, Terminfo_Type *t, Tgetstr_Map_Type *ma
|
|||
|
||||
(void) t;
|
||||
cha = *cap++; chb = *cap;
|
||||
|
||||
|
||||
while (*map->name != 0)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
char *SLtt_tigetstr (char *cap, char **pp)
|
||||
{
|
||||
int offset;
|
||||
Terminfo_Type *t;
|
||||
|
||||
|
||||
if ((pp == NULL) || (NULL == (t = (Terminfo_Type *) *pp))) return NULL;
|
||||
|
||||
|
||||
if (t->flags == SLTERMCAP) return tcap_getstr (cap, t);
|
||||
|
||||
|
||||
offset = compute_cap_offset (cap, t, Tgetstr_Map, t->num_string_offsets);
|
||||
if (offset < 0) return NULL;
|
||||
offset = make_integer (t->string_offsets + 2 * offset);
|
||||
|
@ -458,7 +458,7 @@ int SLtt_tigetnum (char *cap, char **pp)
|
|||
{
|
||||
int offset;
|
||||
Terminfo_Type *t;
|
||||
|
||||
|
||||
if ((pp == NULL) || (NULL == (t = (Terminfo_Type *) *pp))) return -1;
|
||||
|
||||
if (t->flags == SLTERMCAP) return tcap_getnum (cap, t);
|
||||
|
@ -483,13 +483,13 @@ int SLtt_tigetflag (char *cap, char **pp)
|
|||
{
|
||||
int offset;
|
||||
Terminfo_Type *t;
|
||||
|
||||
|
||||
if ((pp == NULL) || (NULL == (t = (Terminfo_Type *) *pp))) return -1;
|
||||
|
||||
if (t->flags == SLTERMCAP) return tcap_getflag (cap, t);
|
||||
|
||||
|
||||
offset = compute_cap_offset (cap, t, Tgetflag_Map, t->boolean_section_size);
|
||||
|
||||
|
||||
if (offset < 0) return -1;
|
||||
return (int) *(t->boolean_flags + offset);
|
||||
}
|
||||
|
@ -505,7 +505,7 @@ static int tcap_getflag (char *cap, Terminfo_Type *t)
|
|||
char a, b;
|
||||
char *f = (char *) t->boolean_flags;
|
||||
char *fmax;
|
||||
|
||||
|
||||
if (f == NULL) return 0;
|
||||
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 *caps_max;
|
||||
|
||||
|
||||
c0 = cap[0];
|
||||
c1 = cap[1];
|
||||
|
||||
|
||||
if (caps == NULL) return NULL;
|
||||
caps_max = caps + len;
|
||||
while (caps < caps_max)
|
||||
|
@ -541,7 +541,7 @@ static char *tcap_get_cap (unsigned char *cap, unsigned char *caps, unsigned int
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int tcap_getnum (char *cap, Terminfo_Type *t)
|
||||
{
|
||||
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 *t;
|
||||
int len;
|
||||
|
||||
|
||||
if (SLtt_Try_Termcap == 0) return -1;
|
||||
#if 1
|
||||
/* XFREE86 xterm sets the TERMCAP environment variable to an invalid
|
||||
|
@ -580,8 +580,8 @@ static int tcap_getent (char *term, Terminfo_Type *ti)
|
|||
#endif
|
||||
termcap = (unsigned char *) getenv ("TERMCAP");
|
||||
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
|
||||
* 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
|
||||
|
@ -595,17 +595,17 @@ static int tcap_getent (char *term, Terminfo_Type *ti)
|
|||
return -1;
|
||||
t += (len + 1);
|
||||
}
|
||||
|
||||
|
||||
/* malloc some extra space just in case it is needed. */
|
||||
len = strlen ((char *) termcap) + 256;
|
||||
if (NULL == (buf = (unsigned char *) SLMALLOC ((unsigned int) len))) return -1;
|
||||
|
||||
b = buf;
|
||||
|
||||
|
||||
/* 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;
|
||||
t = termcap;
|
||||
len = tcap_extract_field (t);
|
||||
|
@ -618,14 +618,14 @@ static int tcap_getent (char *term, Terminfo_Type *ti)
|
|||
b[len] = 0;
|
||||
b += len + 1;
|
||||
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 = t + (len + 1);
|
||||
|
||||
|
||||
|
||||
|
||||
/* Process strings first. */
|
||||
ti->string_table = (char *) b;
|
||||
t = termcap;
|
||||
|
@ -633,7 +633,7 @@ static int tcap_getent (char *term, Terminfo_Type *ti)
|
|||
{
|
||||
unsigned char *b1;
|
||||
unsigned char *tmax;
|
||||
|
||||
|
||||
/* We are looking for: XX=something */
|
||||
if ((len < 4) || (t[2] != '=') || (*t == '.'))
|
||||
{
|
||||
|
@ -642,7 +642,7 @@ static int tcap_getent (char *term, Terminfo_Type *ti)
|
|||
}
|
||||
tmax = t + len;
|
||||
b1 = b;
|
||||
|
||||
|
||||
while (t < tmax)
|
||||
{
|
||||
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 */
|
||||
/* skip colon to next field. */
|
||||
t++;
|
||||
}
|
||||
}
|
||||
ti->string_table_size = (int) (b - (unsigned char *) ti->string_table);
|
||||
|
||||
/* Now process the numbers. */
|
||||
|
@ -675,7 +675,7 @@ static int tcap_getent (char *term, Terminfo_Type *ti)
|
|||
{
|
||||
unsigned char *b1;
|
||||
unsigned char *tmax;
|
||||
|
||||
|
||||
/* We are looking for: XX#NUMBER */
|
||||
if ((len < 4) || (t[2] != '#') || (*t == '.'))
|
||||
{
|
||||
|
@ -684,7 +684,7 @@ static int tcap_getent (char *term, Terminfo_Type *ti)
|
|||
}
|
||||
tmax = t + len;
|
||||
b1 = b;
|
||||
|
||||
|
||||
while (t < tmax)
|
||||
{
|
||||
*b++ = *t++;
|
||||
|
@ -694,16 +694,16 @@ static int tcap_getent (char *term, Terminfo_Type *ti)
|
|||
len = (int) (b - b1);
|
||||
b1[2] = (unsigned char) len; /* replace the # by the length */
|
||||
t++;
|
||||
}
|
||||
}
|
||||
ti->num_numbers = (int) (b - ti->numbers);
|
||||
|
||||
|
||||
/* Now process the flags. */
|
||||
t = termcap;
|
||||
ti->boolean_flags = b;
|
||||
while (-1 != (len = tcap_extract_field (t)))
|
||||
{
|
||||
/* We are looking for: XX#NUMBER */
|
||||
if ((len != 2) || (*t == '.') || (*t <= ' '))
|
||||
if ((len != 2) || (*t == '.') || (*t <= ' '))
|
||||
{
|
||||
t += len + 1;
|
||||
continue;
|
||||
|
@ -712,7 +712,7 @@ static int tcap_getent (char *term, Terminfo_Type *ti)
|
|||
b[1] = t[1];
|
||||
t += 3;
|
||||
b += 2;
|
||||
}
|
||||
}
|
||||
ti->boolean_section_size = (int) (b - ti->boolean_flags);
|
||||
ti->flags = SLTERMCAP;
|
||||
return 0;
|
||||
|
|
|
@ -62,9 +62,9 @@ char *SLexpand_escaped_char(char *p, char *ch)
|
|||
int i = 0;
|
||||
int max = 0, num, base = 0;
|
||||
char ch1;
|
||||
|
||||
|
||||
ch1 = *p++;
|
||||
|
||||
|
||||
switch (ch1)
|
||||
{
|
||||
default: num = ch1; break;
|
||||
|
@ -75,23 +75,23 @@ char *SLexpand_escaped_char(char *p, char *ch)
|
|||
case 'r': num = '\r'; break;
|
||||
case 'f': num = '\f'; break;
|
||||
case 'E': case 'e': num = 27; break;
|
||||
case 'a': num = 7;
|
||||
case 'a': num = 7;
|
||||
break;
|
||||
|
||||
|
||||
/* octal */
|
||||
case '0': case '1': case '2': case '3':
|
||||
case '4': case '5': case '6': case '7':
|
||||
max = '7';
|
||||
case '0': case '1': case '2': case '3':
|
||||
case '4': case '5': case '6': case '7':
|
||||
max = '7';
|
||||
base = 8; i = 2; num = ch1 - '0';
|
||||
break;
|
||||
|
||||
|
||||
case 'd': /* decimal -- S-Lang extension */
|
||||
base = 10;
|
||||
base = 10;
|
||||
i = 3;
|
||||
max = '9';
|
||||
num = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 'x': /* hex */
|
||||
base = 16;
|
||||
max = '9';
|
||||
|
@ -99,11 +99,11 @@ char *SLexpand_escaped_char(char *p, char *ch)
|
|||
num = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
while (i--)
|
||||
{
|
||||
ch1 = *p;
|
||||
|
||||
|
||||
if ((ch1 <= max) && (ch1 >= '0'))
|
||||
{
|
||||
num = base * num + (ch1 - '0');
|
||||
|
@ -117,16 +117,16 @@ char *SLexpand_escaped_char(char *p, char *ch)
|
|||
else break;
|
||||
p++;
|
||||
}
|
||||
|
||||
|
||||
*ch = (char) num;
|
||||
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)
|
||||
{
|
||||
char ch;
|
||||
|
||||
|
||||
while (t < tmax)
|
||||
{
|
||||
ch = *t++;
|
||||
|
@ -146,13 +146,13 @@ int SLang_extract_token (char **linep, char *word_parm, int byte_comp)
|
|||
int string;
|
||||
char ch1;
|
||||
char *word_max;
|
||||
|
||||
|
||||
word_max = word + 250;
|
||||
|
||||
|
||||
line = *linep;
|
||||
|
||||
/* skip white space */
|
||||
while (((ch = *line) == ' ')
|
||||
while (((ch = *line) == ' ')
|
||||
|| (ch == '\t')) line++;
|
||||
|
||||
if ((!ch) || (ch == '\n'))
|
||||
|
@ -160,26 +160,26 @@ int SLang_extract_token (char **linep, char *word_parm, int byte_comp)
|
|||
*linep = line;
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
*word++ = ch;
|
||||
line++;
|
||||
|
||||
|
||||
/* Look for -something and rule out --something and -= something */
|
||||
if ((ch == '-') &&
|
||||
if ((ch == '-') &&
|
||||
(*line != '-') && (*line != '=') && ((*line > '9') || (*line < '0')))
|
||||
{
|
||||
*word = 0;
|
||||
*linep = line;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (ch == '"') string = 1; else string = 0;
|
||||
if (ch == '\'')
|
||||
{
|
||||
if ((ch = *line++) != 0)
|
||||
{
|
||||
if (ch == '\\')
|
||||
if (ch == '\\')
|
||||
{
|
||||
line = SLexpand_escaped_char(line, &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])
|
||||
{
|
||||
while (ch = *line++,
|
||||
(ch > '"') ||
|
||||
while (ch = *line++,
|
||||
(ch > '"') ||
|
||||
((ch != '\n') && (ch != 0) && (ch != '"')))
|
||||
{
|
||||
if (string)
|
||||
|
@ -207,7 +207,7 @@ int SLang_extract_token (char **linep, char *word_parm, int byte_comp)
|
|||
ch = *line++;
|
||||
if ((ch == 0) || (ch == '\n')) break;
|
||||
if (byte_comp) *word++ = '\\';
|
||||
else
|
||||
else
|
||||
{
|
||||
line = SLexpand_escaped_char(line - 1, &ch1);
|
||||
ch = ch1;
|
||||
|
@ -219,7 +219,7 @@ int SLang_extract_token (char **linep, char *word_parm, int byte_comp)
|
|||
line--;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
*word++ = ch;
|
||||
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 == '"') && string) *word++ = '"'; else if (string) SLang_Error = SYNTAX_ERROR;
|
||||
*word = 0;
|
||||
|
@ -259,7 +259,7 @@ int SLang_guess_type (char *t)
|
|||
if (*t == '-') t++;
|
||||
p = t;
|
||||
#ifdef FLOAT_TYPE
|
||||
if (*p != '.')
|
||||
if (*p != '.')
|
||||
{
|
||||
#endif
|
||||
while ((*p >= '0') && (*p <= '9')) p++;
|
||||
|
@ -267,7 +267,7 @@ int SLang_guess_type (char *t)
|
|||
if ((*p == 'x') && (p == t + 1)) /* 0x?? */
|
||||
{
|
||||
p++;
|
||||
while (ch = *p,
|
||||
while (ch = *p,
|
||||
((ch >= '0') && (ch <= '9'))
|
||||
|| (((ch | 0x20) >= 'a') && ((ch | 0x20) <= 'f'))) p++;
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ int SLang_guess_type (char *t)
|
|||
return(STRING_TYPE);
|
||||
#else
|
||||
}
|
||||
|
||||
|
||||
/* now down to float case */
|
||||
if (*p == '.')
|
||||
{
|
||||
|
@ -297,24 +297,24 @@ int SLatoi (unsigned char *s)
|
|||
register unsigned char ch;
|
||||
register unsigned int value;
|
||||
register int base;
|
||||
|
||||
|
||||
if (*s != '0') return atoi((char *) s);
|
||||
|
||||
/* look for 'x' which indicates hex */
|
||||
s++;
|
||||
if ((*s | 0x20) == 'x')
|
||||
if ((*s | 0x20) == 'x')
|
||||
{
|
||||
base = 16;
|
||||
s++;
|
||||
if (*s == 0)
|
||||
if (*s == 0)
|
||||
{
|
||||
SLang_Error = SYNTAX_ERROR;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else base = 8;
|
||||
|
||||
|
||||
|
||||
|
||||
value = 0;
|
||||
while ((ch = *s++) != 0)
|
||||
{
|
||||
|
@ -338,7 +338,7 @@ int SLatoi (unsigned char *s)
|
|||
case '7':
|
||||
ch1 -= '0';
|
||||
break;
|
||||
|
||||
|
||||
case 'a':
|
||||
case 'b':
|
||||
case 'c':
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* slutty.c --- Unix Low level terminal (tty) functions for S-Lang */
|
||||
/* Copyright (c) 1992, 1995 John E. Davis
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* You may distribute under the terms of either the GNU General Public
|
||||
* License or the Perl Artistic License.
|
||||
*/
|
||||
|
@ -104,27 +104,27 @@ typedef struct termios TTY_Termio_Type;
|
|||
static TTY_Termio_Type Old_TTY;
|
||||
|
||||
#ifdef HAVE_TERMIOS_H
|
||||
static struct
|
||||
static struct
|
||||
{
|
||||
speed_t key;
|
||||
int value;
|
||||
} Baud_Rates[] =
|
||||
} Baud_Rates[] =
|
||||
{
|
||||
{B0, 0},
|
||||
{B50, 50},
|
||||
{B75, 75},
|
||||
{B110, 110},
|
||||
{B134, 134},
|
||||
{B150, 150},
|
||||
{B200, 200},
|
||||
{B300, 300},
|
||||
{B600, 600},
|
||||
{B1200, 1200},
|
||||
{B1800, 1800},
|
||||
{B2400, 2400},
|
||||
{B4800, 4800},
|
||||
{B9600, 9600},
|
||||
{B19200, 19200},
|
||||
{B50, 50},
|
||||
{B75, 75},
|
||||
{B110, 110},
|
||||
{B134, 134},
|
||||
{B150, 150},
|
||||
{B200, 200},
|
||||
{B300, 300},
|
||||
{B600, 600},
|
||||
{B1200, 1200},
|
||||
{B1800, 1800},
|
||||
{B2400, 2400},
|
||||
{B4800, 4800},
|
||||
{B9600, 9600},
|
||||
{B19200, 19200},
|
||||
{B38400, 38400}
|
||||
#ifdef B57600
|
||||
, {B57600, 57600}
|
||||
|
@ -175,7 +175,7 @@ static int
|
|||
speed_t2baud_rate (speed_t s)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
for (i = 0; i < sizeof (Baud_Rates)/sizeof (Baud_Rates[0]); i++)
|
||||
if (Baud_Rates[i].key == s)
|
||||
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)
|
||||
{
|
||||
TTY_Termio_Type newtty;
|
||||
|
||||
|
||||
SLsig_block_signals ();
|
||||
|
||||
if (TTY_Inited)
|
||||
|
||||
if (TTY_Inited)
|
||||
{
|
||||
SLsig_unblock_signals ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
TTY_Open = 0;
|
||||
|
||||
|
||||
if ((SLang_TT_Read_FD == -1)
|
||||
|| (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
|
||||
/* 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
|
||||
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
|
||||
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.
|
||||
*/
|
||||
SLang_TT_Read_FD = fileno (stderr);
|
||||
if (1 != isatty (SLang_TT_Read_FD))
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
SLang_TT_Read_FD = fileno (stdin);
|
||||
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;
|
||||
|
||||
/* 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.
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
while (-1 == GET_TERMIOS(SLang_TT_Read_FD, &newtty))
|
||||
{
|
||||
if (errno != EINTR)
|
||||
|
@ -256,7 +256,7 @@ int SLang_init_tty (int abort_char, int no_flow_control, int opost)
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifndef HAVE_TERMIOS_H
|
||||
newtty.s.sg_flags &= ~(ECHO);
|
||||
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.s.sg_flags |= CBREAK; /* do I want cbreak or raw????? */
|
||||
#else
|
||||
|
||||
|
||||
/* get baud rate */
|
||||
|
||||
|
||||
/* [not only QNX related !?!]
|
||||
* 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)
|
||||
{
|
||||
/* Note: if this generates an compiler error, simply remove
|
||||
/* Note: if this generates an compiler error, simply remove
|
||||
the statement */
|
||||
#ifdef HAVE_CFGETOSPEED
|
||||
SLang_TT_Baud_Rate = cfgetospeed (&newtty);
|
||||
#endif
|
||||
#endif
|
||||
SLang_TT_Baud_Rate = speed_t2baud_rate (SLang_TT_Baud_Rate);
|
||||
}
|
||||
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 */
|
||||
#endif
|
||||
#endif /* NOT HAVE_TERMIOS_H */
|
||||
|
||||
|
||||
while (-1 == SET_TERMIOS(SLang_TT_Read_FD, &newtty))
|
||||
{
|
||||
if (errno != EINTR)
|
||||
|
@ -315,7 +315,7 @@ int SLang_init_tty (int abort_char, int no_flow_control, int opost)
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TTY_Inited = 1;
|
||||
SLsig_unblock_signals ();
|
||||
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)
|
||||
{
|
||||
TTY_Termio_Type newtty;
|
||||
|
||||
|
||||
SLsig_block_signals ();
|
||||
|
||||
|
||||
if (TTY_Inited == 0)
|
||||
{
|
||||
SLsig_unblock_signals ();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
while ((-1 == GET_TERMIOS (SLang_TT_Read_FD, &newtty))
|
||||
&& (errno == EINTR))
|
||||
;
|
||||
|
||||
|
||||
#ifndef HAVE_TERMIOS_H
|
||||
if (mode == 0) newtty.lt.t_suspc = 255;
|
||||
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;
|
||||
else newtty.c_cc[VSUSP] = Old_TTY.c_cc[VSUSP];
|
||||
#endif
|
||||
|
||||
|
||||
while ((-1 == SET_TERMIOS (SLang_TT_Read_FD, &newtty))
|
||||
&& (errno == EINTR))
|
||||
;
|
||||
|
@ -355,27 +355,27 @@ void SLtty_set_suspend_state (int mode)
|
|||
void SLang_reset_tty (void)
|
||||
{
|
||||
SLsig_block_signals ();
|
||||
|
||||
|
||||
if (TTY_Inited == 0)
|
||||
{
|
||||
SLsig_unblock_signals ();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
while ((-1 == SET_TERMIOS(SLang_TT_Read_FD, &Old_TTY))
|
||||
&& (errno == EINTR))
|
||||
;
|
||||
|
||||
|
||||
if (TTY_Open)
|
||||
{
|
||||
while ((-1 == close (SLang_TT_Read_FD))
|
||||
&& (errno == EINTR))
|
||||
;
|
||||
|
||||
|
||||
TTY_Open = 0;
|
||||
SLang_TT_Read_FD = -1;
|
||||
}
|
||||
|
||||
|
||||
TTY_Inited = 0;
|
||||
SLsig_unblock_signals ();
|
||||
}
|
||||
|
@ -383,7 +383,7 @@ void SLang_reset_tty (void)
|
|||
static void default_sigint (int sig)
|
||||
{
|
||||
sig = errno; /* use parameter */
|
||||
|
||||
|
||||
SLKeyBoard_Quit = 1;
|
||||
if (SLang_Ignore_User_Abort == 0) SLang_Error = USER_BREAK;
|
||||
SLsignal_intr (SIGINT, default_sigint);
|
||||
|
@ -393,10 +393,10 @@ static void default_sigint (int sig)
|
|||
void SLang_set_abort_signal (void (*hand)(int))
|
||||
{
|
||||
int save_errno = errno;
|
||||
|
||||
|
||||
if (hand == NULL) hand = default_sigint;
|
||||
SLsignal_intr (SIGINT, hand);
|
||||
|
||||
|
||||
errno = save_errno;
|
||||
}
|
||||
|
||||
|
@ -418,7 +418,7 @@ int SLsys_input_pending(int tsecs)
|
|||
long usecs, secs;
|
||||
|
||||
if (TTY_Inited == 0) return -1;
|
||||
|
||||
|
||||
if (tsecs >= 0)
|
||||
{
|
||||
secs = tsecs / 10;
|
||||
|
@ -430,13 +430,13 @@ int SLsys_input_pending(int tsecs)
|
|||
secs = tsecs / 1000;
|
||||
usecs = (tsecs % 1000) * 1000;
|
||||
}
|
||||
|
||||
|
||||
wait.tv_sec = secs;
|
||||
wait.tv_usec = usecs;
|
||||
|
||||
FD_ZERO(&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);
|
||||
}
|
||||
|
||||
|
@ -448,69 +448,69 @@ static int handle_interrupt (void)
|
|||
if (SLang_getkey_intr_hook != NULL)
|
||||
{
|
||||
int save_tty_fd = SLang_TT_Read_FD;
|
||||
|
||||
|
||||
if (-1 == (*SLang_getkey_intr_hook) ())
|
||||
return -1;
|
||||
|
||||
|
||||
if (save_tty_fd != SLang_TT_Read_FD)
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int SLsys_getkey (void)
|
||||
{
|
||||
unsigned char c;
|
||||
|
||||
|
||||
if (TTY_Inited == 0)
|
||||
{
|
||||
int ic = fgetc (stdin);
|
||||
if (ic == EOF) return SLANG_GETKEY_ERROR;
|
||||
return (unsigned int) ic;
|
||||
}
|
||||
|
||||
|
||||
while (1)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (SLKeyBoard_Quit)
|
||||
|
||||
if (SLKeyBoard_Quit)
|
||||
return SLang_Abort_Char;
|
||||
|
||||
|
||||
if (0 == (ret = SLsys_input_pending (100)))
|
||||
continue;
|
||||
|
||||
|
||||
if (ret != -1)
|
||||
break;
|
||||
|
||||
if (SLKeyBoard_Quit)
|
||||
|
||||
if (SLKeyBoard_Quit)
|
||||
return SLang_Abort_Char;
|
||||
|
||||
|
||||
if (errno == EINTR)
|
||||
{
|
||||
if (-1 == handle_interrupt ())
|
||||
return SLANG_GETKEY_ERROR;
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
break; /* let read handle it */
|
||||
}
|
||||
|
||||
|
||||
while (-1 == read(SLang_TT_Read_FD, (char *) &c, 1))
|
||||
{
|
||||
if (errno == EINTR)
|
||||
if (errno == EINTR)
|
||||
{
|
||||
if (-1 == handle_interrupt ())
|
||||
return SLANG_GETKEY_ERROR;
|
||||
|
||||
if (SLKeyBoard_Quit)
|
||||
|
||||
if (SLKeyBoard_Quit)
|
||||
return SLang_Abort_Char;
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
#ifdef EAGAIN
|
||||
if (errno == EAGAIN)
|
||||
if (errno == EAGAIN)
|
||||
{
|
||||
sleep (1);
|
||||
continue;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* Copyright (c) 1992, 1995 John E. Davis
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* You may distribute under the terms of either the GNU General Public
|
||||
* License or the Perl Artistic License.
|
||||
*/
|
||||
|
@ -85,7 +85,7 @@ static int Blink_Killed; /* high intensity background enabled */
|
|||
#define JNORMAL_COLOR 0
|
||||
#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, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7,
|
||||
|
@ -210,24 +210,24 @@ static int Saved_Cursor_Row;
|
|||
static void save_screen (void)
|
||||
{
|
||||
int row, col;
|
||||
|
||||
|
||||
if (Saved_Screen_Buffer != NULL)
|
||||
{
|
||||
SLFREE (Saved_Screen_Buffer);
|
||||
Saved_Screen_Buffer = NULL;
|
||||
}
|
||||
#ifdef GO32_VIDEO
|
||||
Saved_Screen_Buffer = SLMALLOC (sizeof (short) *
|
||||
#ifdef GO32_VIDEO
|
||||
Saved_Screen_Buffer = SLMALLOC (sizeof (short) *
|
||||
ScreenCols () * ScreenRows ());
|
||||
|
||||
if (Saved_Screen_Buffer == NULL)
|
||||
return;
|
||||
|
||||
|
||||
ScreenRetrieve (Saved_Screen_Buffer);
|
||||
ScreenGetCursor (&row, &col);
|
||||
Saved_Cursor_Row = row;
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void restore_screen (void)
|
||||
|
@ -237,7 +237,7 @@ static void restore_screen (void)
|
|||
ScreenUpdate (Saved_Screen_Buffer);
|
||||
SLtt_goto_rc (Saved_Cursor_Row, 0);
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
#endif /* HAS_SAVE_SCREEN */
|
||||
/*----------------------------------------------------------------------*\
|
||||
|
@ -249,7 +249,7 @@ void SLtt_write_string (char *str)
|
|||
{
|
||||
#ifdef WIN32
|
||||
unsigned long bytes;
|
||||
|
||||
|
||||
(void) WriteConsole(hStdout, str, strlen(str), &bytes, NULL);
|
||||
#else
|
||||
fputs (str, stdout);
|
||||
|
@ -292,7 +292,7 @@ void SLtt_goto_rc (int row, int col)
|
|||
newPosition.X = col;
|
||||
newPosition.Y = row;
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined (USE_ASM)
|
||||
if (row > SLtt_Screen_Rows) row = SLtt_Screen_Rows;
|
||||
if (col > SLtt_Screen_Cols) col = SLtt_Screen_Cols;
|
||||
|
@ -398,10 +398,10 @@ static void slvid_deleol (int x)
|
|||
unsigned char *p, *pmax;
|
||||
int w = mkSpaceChar ();
|
||||
int count = SLtt_Screen_Cols - x;
|
||||
|
||||
|
||||
p = Line_Buffer;
|
||||
pmax = p + 2 * count;
|
||||
|
||||
|
||||
while (p < pmax)
|
||||
{
|
||||
*p++ = (unsigned char) w;
|
||||
|
@ -430,7 +430,7 @@ void SLtt_begin_insert (void)
|
|||
slvid_getxy ();
|
||||
n = SLtt_Screen_Cols - Cursor_Col;
|
||||
/* Msdos_Insert_Mode = 1; */
|
||||
|
||||
|
||||
# ifndef WIN32
|
||||
# if defined (EMX_VIDEO)
|
||||
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);
|
||||
# else /* __os2__ */
|
||||
p = mkScreenPointer (Cursor_Row, SLtt_Screen_Cols - 1);
|
||||
|
||||
|
||||
# if defined (HAS_LINEAR_SCREEN)
|
||||
/* pmin = p - (n-1); */
|
||||
pmin = mkScreenPointer (Cursor_Row, Cursor_Col);
|
||||
|
@ -452,23 +452,23 @@ void SLtt_begin_insert (void)
|
|||
asm mov ax, ds
|
||||
asm mov bx, di
|
||||
asm mov dx, si
|
||||
|
||||
|
||||
asm mov cx, n
|
||||
asm les di, p
|
||||
asm lds si, p
|
||||
asm sub si, 2
|
||||
asm std
|
||||
asm rep movsw
|
||||
|
||||
|
||||
asm mov ds, ax
|
||||
asm mov di, bx
|
||||
asm mov si, dx
|
||||
# endif /* HAS_LINEAR_SCREEN */
|
||||
# endif /* __os2__ */
|
||||
# endif /* EMX_VIDEO */
|
||||
|
||||
|
||||
# endif /* WIN32 */
|
||||
|
||||
|
||||
#endif /* not GO32_VIDEO */
|
||||
}
|
||||
|
||||
|
@ -497,12 +497,12 @@ void SLtt_delete_char (void)
|
|||
# endif
|
||||
# endif
|
||||
int n;
|
||||
|
||||
|
||||
slvid_getxy ();
|
||||
n = SLtt_Screen_Cols - Cursor_Col - 1;
|
||||
|
||||
|
||||
# ifndef WIN32
|
||||
|
||||
|
||||
# if defined (EMX_VIDEO)
|
||||
v_getline (Line_Buffer, Cursor_Col+1, Cursor_Row, n);
|
||||
v_putline (Line_Buffer, Cursor_Col, Cursor_Row, n);
|
||||
|
@ -514,7 +514,7 @@ void SLtt_delete_char (void)
|
|||
return;
|
||||
# else /* __os2__ */
|
||||
p = mkScreenPointer (Cursor_Row, Cursor_Col);
|
||||
|
||||
|
||||
# if defined (HAS_LINEAR_SCREEN)
|
||||
while (n--)
|
||||
{
|
||||
|
@ -527,23 +527,23 @@ void SLtt_delete_char (void)
|
|||
asm mov ax, ds
|
||||
asm mov bx, si
|
||||
asm mov dx, di
|
||||
|
||||
|
||||
asm mov cx, n
|
||||
asm les di, p
|
||||
asm lds si, p
|
||||
asm add si, 2
|
||||
asm cld
|
||||
asm rep movsw
|
||||
|
||||
|
||||
asm mov ds, ax
|
||||
asm mov si, bx
|
||||
asm mov di, dx
|
||||
# endif /* HAS_LINEAR_SCREEN */
|
||||
# endif /* __os2__ */
|
||||
# endif /* EMX_VIDEO */
|
||||
|
||||
|
||||
# endif /* WIN32 */
|
||||
|
||||
|
||||
#endif /* not GO32_VIDEO */
|
||||
}
|
||||
|
||||
|
@ -555,9 +555,9 @@ void SLtt_delete_char (void)
|
|||
\*----------------------------------------------------------------------*/
|
||||
void SLtt_erase_line (void)
|
||||
{
|
||||
|
||||
|
||||
#ifndef WIN32
|
||||
|
||||
|
||||
# if defined (GO32_VIDEO) || defined (EMX_VIDEO)
|
||||
Attribute_Byte = 0x07;
|
||||
slvid_deleol (0);
|
||||
|
@ -572,7 +572,7 @@ void SLtt_erase_line (void)
|
|||
unsigned short *p = mkScreenPointer (Cursor_Row, 0);
|
||||
# if defined (HAS_LINEAR_SCREEN)
|
||||
register unsigned short *pmax = p + SLtt_Screen_Cols;
|
||||
|
||||
|
||||
Attribute_Byte = 0x07;
|
||||
w = mkSpaceChar ();
|
||||
while (p < pmax) *p++ = w;
|
||||
|
@ -591,9 +591,9 @@ void SLtt_erase_line (void)
|
|||
# endif /* __os2__ */
|
||||
# endif /* GO32_VIDEO or EMX_VIDEO */
|
||||
Current_Color = JNO_COLOR; /* since we messed with attribute byte */
|
||||
|
||||
|
||||
#endif /* WIN32 */
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*\
|
||||
|
@ -604,9 +604,9 @@ void SLtt_erase_line (void)
|
|||
void SLtt_delete_nlines (int nlines)
|
||||
{
|
||||
SLtt_normal_video ();
|
||||
|
||||
|
||||
#ifndef WIN32
|
||||
|
||||
|
||||
# if defined (EMX_VIDEO)
|
||||
v_attrib (Attribute_Byte);
|
||||
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 /* __os2__ */
|
||||
# endif /* EMX_VIDEO */
|
||||
|
||||
|
||||
#endif /* WIN32 */
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*\
|
||||
|
@ -662,9 +662,9 @@ void SLtt_delete_nlines (int nlines)
|
|||
void SLtt_reverse_index (int nlines)
|
||||
{
|
||||
SLtt_normal_video ();
|
||||
|
||||
|
||||
#ifndef WIN32
|
||||
|
||||
|
||||
# if defined (EMX_VIDEO)
|
||||
v_attrib (Attribute_Byte);
|
||||
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 /* __os2__ */
|
||||
# endif /* EMX_VIDEO */
|
||||
|
||||
|
||||
#endif /* WIN32 */
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*\
|
||||
|
@ -718,12 +718,12 @@ void SLtt_reverse_index (int nlines)
|
|||
\*----------------------------------------------------------------------*/
|
||||
static void slvid_invert_region (int top_row, int bot_row)
|
||||
{
|
||||
|
||||
|
||||
#ifndef WIN32
|
||||
|
||||
|
||||
# if defined (EMX_VIDEO)
|
||||
int row, col;
|
||||
|
||||
|
||||
for (row = top_row; row < bot_row; row++)
|
||||
{
|
||||
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__
|
||||
int row, col;
|
||||
USHORT length = SLtt_Screen_Cols * 2;
|
||||
|
||||
|
||||
for (row = top_row; row < bot_row; row++)
|
||||
{
|
||||
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__)
|
||||
unsigned char buf [2 * 180 * 80]; /* 180 cols x 80 rows */
|
||||
unsigned char *b, *bmax;
|
||||
|
||||
|
||||
b = buf + 1 + 2 * SLtt_Screen_Cols * top_row;
|
||||
bmax = buf + 1 + 2 * SLtt_Screen_Cols * bot_row;
|
||||
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 *pmin = mkScreenPointer (top_row, 0);
|
||||
register unsigned short *pmax = mkScreenPointer (bot_row, 0);
|
||||
|
||||
|
||||
while (pmin < pmax)
|
||||
{
|
||||
sh = *pmin;
|
||||
|
@ -773,9 +773,9 @@ static void slvid_invert_region (int top_row, int bot_row)
|
|||
# endif /* __GO32__ or __WATCOMC__ */
|
||||
# endif /* __os2__ */
|
||||
# endif /* EMX_VIDEO */
|
||||
|
||||
|
||||
#endif /* WIN32 */
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*\
|
||||
|
@ -800,7 +800,7 @@ void SLtt_beep (void)
|
|||
int special = 0; /* first row to invert */
|
||||
int visual = 0; /* final row to invert */
|
||||
if (!SLtt_Ignore_Beep) return;
|
||||
|
||||
|
||||
audible = (SLtt_Ignore_Beep & 1);
|
||||
if ( (SLtt_Ignore_Beep & 4) )
|
||||
{
|
||||
|
@ -811,16 +811,16 @@ void SLtt_beep (void)
|
|||
{
|
||||
visual = SLtt_Screen_Rows;
|
||||
}
|
||||
|
||||
|
||||
if (visual) slvid_invert_region (special, visual);
|
||||
#if defined (EMX_VIDEO)
|
||||
if (audible) /*sound (1500)*/; _sleep2 (100); if (audible) /* nosound () */;
|
||||
#else
|
||||
# ifdef __os2__
|
||||
if (audible) DosBeep (1500, 100); else DosSleep (100);
|
||||
|
||||
|
||||
# elif defined(WIN32)
|
||||
|
||||
|
||||
# else
|
||||
if (audible) sound (1500); delay (100); if (audible) nosound ();
|
||||
# endif
|
||||
|
@ -835,9 +835,9 @@ void SLtt_beep (void)
|
|||
\*----------------------------------------------------------------------*/
|
||||
void SLtt_del_eol (void)
|
||||
{
|
||||
|
||||
|
||||
#ifndef WIN32
|
||||
|
||||
|
||||
# if defined (GO32_VIDEO) || defined (EMX_VIDEO)
|
||||
if (Current_Color != JNO_COLOR) SLtt_normal_video ();
|
||||
slvid_deleol (Cursor_Col);
|
||||
|
@ -854,7 +854,7 @@ void SLtt_del_eol (void)
|
|||
unsigned short w;
|
||||
# if defined (HAS_LINEAR_SCREEN)
|
||||
unsigned short *pmax = p + n;
|
||||
|
||||
|
||||
if (Current_Color != JNO_COLOR) SLtt_normal_video ();
|
||||
w = mkSpaceChar ();
|
||||
while (p < pmax) *p++ = w;
|
||||
|
@ -868,14 +868,14 @@ void SLtt_del_eol (void)
|
|||
asm mov cx, n
|
||||
asm cld
|
||||
asm rep stosw
|
||||
|
||||
|
||||
asm mov di, dx
|
||||
# endif /* HAS_LINEAR_SCREEN */
|
||||
# endif /* __os2__ */
|
||||
# endif /* GO32_VIDEO or EMX_VIDEO */
|
||||
|
||||
|
||||
#endif /* WIN32 */
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*\
|
||||
|
@ -918,57 +918,57 @@ static unsigned short *video_write (register unsigned char *pp,
|
|||
register unsigned short *pos)
|
||||
{
|
||||
int n = (int) (p - pp); /* num of characters of PP to write */
|
||||
|
||||
|
||||
asm push si
|
||||
asm push ds
|
||||
asm push di
|
||||
|
||||
|
||||
/* set up register for BOTH fast and slow */
|
||||
asm mov bx, SLtt_Msdos_Cheap_Video
|
||||
|
||||
|
||||
/* These are the registers needed for both fast AND slow */
|
||||
asm mov ah, byte ptr Attribute_Byte
|
||||
asm mov cx, n
|
||||
asm lds si, dword ptr pp
|
||||
asm les di, dword ptr pos
|
||||
asm cld
|
||||
|
||||
|
||||
asm cmp bx, 0 /* cheap video test */
|
||||
asm je L_fast
|
||||
asm mov bx, ax
|
||||
asm mov dx, CGA_STATUS
|
||||
asm jg L_slow_blank
|
||||
|
||||
|
||||
/* slow video */
|
||||
asm cli
|
||||
|
||||
|
||||
/* wait for retrace */
|
||||
L_slow:
|
||||
asm in al, dx
|
||||
asm test al, 1
|
||||
asm jnz L_slow
|
||||
|
||||
|
||||
L_slow1:
|
||||
asm in al, dx
|
||||
asm test al, 1
|
||||
asm jz L_slow1
|
||||
|
||||
|
||||
/* move a character out */
|
||||
asm mov ah, bh
|
||||
asm lodsb
|
||||
asm stosw
|
||||
asm loop L_slow
|
||||
|
||||
|
||||
asm sti
|
||||
asm jmp done
|
||||
|
||||
|
||||
/* -------------- slow video, vertical retace and pump --------------*/
|
||||
L_slow_blank:
|
||||
L_slow_blank_loop:
|
||||
asm in al, dx
|
||||
asm test al, 8
|
||||
asm jnz L_slow_blank_loop
|
||||
|
||||
|
||||
L_slow_blank1:
|
||||
asm in al, dx
|
||||
asm test al, 8
|
||||
|
@ -979,10 +979,10 @@ static unsigned short *video_write (register unsigned char *pp,
|
|||
asm lodsb
|
||||
asm stosw
|
||||
asm loop L_slow_blank2
|
||||
|
||||
|
||||
asm jmp done
|
||||
/*-------------- Fast video --------------*/
|
||||
|
||||
|
||||
L_fast:
|
||||
asm lodsb
|
||||
asm stosw
|
||||
|
@ -1026,7 +1026,7 @@ static void write_attributes (unsigned short *src, int count)
|
|||
register unsigned short *pos = mkScreenPointer (Cursor_Row, 0);
|
||||
# endif
|
||||
int n = count;
|
||||
|
||||
|
||||
/* write into a character/attribute pair */
|
||||
while (n-- > 0)
|
||||
{
|
||||
|
@ -1044,7 +1044,7 @@ static void write_attributes (unsigned short *src, int count)
|
|||
# endif
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
# if !defined (HAS_LINEAR_SCREEN)
|
||||
# if defined (EMX_VIDEO)
|
||||
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.Y = Cursor_Row;
|
||||
WriteConsoleOutputCharacter(hStdout, p, count, coord, &bytes);
|
||||
|
||||
|
||||
/* write color attributes */
|
||||
p = Line_Buffer;
|
||||
n = count;
|
||||
src = (unsigned short*)org_src; /* restart the src pointer */
|
||||
|
||||
|
||||
/* write into attributes only */
|
||||
while (n-- > 0)
|
||||
{
|
||||
|
@ -1072,7 +1072,7 @@ static void write_attributes (unsigned short *src, int count)
|
|||
*(p++) = Attribute_Byte; /* attribute byte */
|
||||
*(p++) = 0; /* what's this for? */
|
||||
}
|
||||
|
||||
|
||||
WriteConsoleOutputAttribute(hStdout, (WORD*)Line_Buffer, count, coord, &bytes);
|
||||
# else /* __os2__ */
|
||||
/* ScreenUpdateLine (void *virtual_screen_line, int row); */
|
||||
|
@ -1089,7 +1089,7 @@ static void write_attributes (unsigned short *src, int count)
|
|||
#else /* not USE_ASM */
|
||||
unsigned char ch, color;
|
||||
register unsigned short *pos = mkScreenPointer (Cursor_Row, 0);
|
||||
|
||||
|
||||
while (count--)
|
||||
{
|
||||
pair = *(src++); /* character/color pair */
|
||||
|
@ -1181,15 +1181,15 @@ void SLtt_cls (void)
|
|||
/* clear the WIN32 screen in one shot */
|
||||
coord.X = 0;
|
||||
coord.Y = 0;
|
||||
|
||||
|
||||
ch = ' ';
|
||||
|
||||
|
||||
(void) FillConsoleOutputCharacter(hStdout,
|
||||
ch,
|
||||
csbiInfo.dwMaximumWindowSize.Y * csbiInfo.dwMaximumWindowSize.X,
|
||||
coord,
|
||||
&bytes);
|
||||
|
||||
|
||||
/* now set screen to the current attribute */
|
||||
ch = Attribute_Byte;
|
||||
(void) FillConsoleOutputAttribute(hStdout,
|
||||
|
@ -1227,7 +1227,7 @@ void SLtt_putchar (char ch)
|
|||
long bytes;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
if (Current_Color) SLtt_normal_video ();
|
||||
slvid_getxy (); /* get current position */
|
||||
switch (ch)
|
||||
|
@ -1253,7 +1253,7 @@ void SLtt_putchar (char ch)
|
|||
# else /* GO32_VIDEO */
|
||||
pp = mkScreenPointer (Cursor_Row, Cursor_Col);
|
||||
p = (Attribute_Byte << 8) | (unsigned char) ch;
|
||||
|
||||
|
||||
# ifdef USE_ASM
|
||||
SNOW_CHECK;
|
||||
# endif
|
||||
|
@ -1280,12 +1280,12 @@ void SLtt_set_color (int obj, char *what, char *fg, char *bg)
|
|||
#ifdef WIN32
|
||||
int newcolor;
|
||||
#endif
|
||||
|
||||
|
||||
(void) what;
|
||||
|
||||
|
||||
if ( !IsColor || (obj < 0) || (obj >= JMAX_COLORS))
|
||||
return;
|
||||
|
||||
|
||||
for (i = 0; i < JMAX_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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < JMAX_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
|
||||
Color_Map [obj] = (b << 4) | f;
|
||||
#else
|
||||
|
||||
|
||||
/*
|
||||
0 1 2 3
|
||||
"black", "blue", "green", "cyan",
|
||||
|
@ -1318,32 +1318,32 @@ void SLtt_set_color (int obj, char *what, char *fg, char *bg)
|
|||
12 13 14 15
|
||||
"brightred", "brightmagenta", "yellow", "white"
|
||||
*/
|
||||
|
||||
|
||||
/* these aren't all right yet */
|
||||
switch (f)
|
||||
switch (f)
|
||||
{
|
||||
case 0: newcolor = 0; break;
|
||||
case 1: newcolor = FOREGROUND_BLUE; break;
|
||||
case 2: newcolor = FOREGROUND_GREEN; break;
|
||||
case 3: newcolor = FOREGROUND_GREEN | FOREGROUND_BLUE; break;
|
||||
|
||||
|
||||
case 4: newcolor = FOREGROUND_RED; break;
|
||||
case 5: newcolor = FOREGROUND_RED | FOREGROUND_BLUE; break;
|
||||
case 6: newcolor = FOREGROUND_GREEN | FOREGROUND_RED; break;
|
||||
case 7: newcolor = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY; break;
|
||||
|
||||
|
||||
case 8: newcolor = FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN; break;
|
||||
case 9: newcolor = FOREGROUND_BLUE | FOREGROUND_INTENSITY; break;
|
||||
case 10: newcolor = FOREGROUND_GREEN | FOREGROUND_INTENSITY; break;
|
||||
case 11: newcolor = FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY; break;
|
||||
|
||||
|
||||
case 12: newcolor = FOREGROUND_RED | FOREGROUND_INTENSITY; break;
|
||||
case 13: newcolor = FOREGROUND_RED | 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;
|
||||
}
|
||||
// switch
|
||||
|
||||
|
||||
/*
|
||||
0 1 2 3
|
||||
"black", "blue", "green", "cyan",
|
||||
|
@ -1354,37 +1354,37 @@ void SLtt_set_color (int obj, char *what, char *fg, char *bg)
|
|||
12 13 14 15
|
||||
"brightred", "brightmagenta", "yellow", "white"
|
||||
*/
|
||||
|
||||
switch (b)
|
||||
|
||||
switch (b)
|
||||
{
|
||||
case 0: newcolor |= 0; break;
|
||||
case 1: newcolor |= BACKGROUND_BLUE; break;
|
||||
case 2: newcolor |= BACKGROUND_GREEN; break;
|
||||
case 3: newcolor |= BACKGROUND_GREEN | BACKGROUND_BLUE; break;
|
||||
|
||||
|
||||
case 4: newcolor |= BACKGROUND_RED; break;
|
||||
case 5: newcolor |= BACKGROUND_RED | BACKGROUND_BLUE; break;
|
||||
case 6: newcolor |= BACKGROUND_GREEN | BACKGROUND_RED; break;
|
||||
case 7: newcolor |= BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY; break;
|
||||
|
||||
|
||||
case 8: newcolor |= BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE; break;
|
||||
case 9: newcolor |= BACKGROUND_BLUE | BACKGROUND_INTENSITY; break;
|
||||
case 10: newcolor |= BACKGROUND_GREEN | BACKGROUND_INTENSITY; break;
|
||||
case 11: newcolor |= BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY; break;
|
||||
|
||||
|
||||
case 12: newcolor |= BACKGROUND_RED | BACKGROUND_INTENSITY; break;
|
||||
case 13: newcolor |= BACKGROUND_RED | 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;
|
||||
}
|
||||
// switch
|
||||
|
||||
|
||||
Color_Map [obj] = newcolor;
|
||||
|
||||
|
||||
#endif
|
||||
/* if we're setting the normal color, and the attribute byte hasn't
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -1411,15 +1411,15 @@ void SLtt_init_video (void)
|
|||
#if defined (EMX_VIDEO)
|
||||
int OldCol, OldRow;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HAS_SAVE_SCREEN
|
||||
save_screen ();
|
||||
#endif
|
||||
|
||||
Cursor_Row = Cursor_Col = 0;
|
||||
|
||||
|
||||
#if defined (EMX_VIDEO)
|
||||
|
||||
|
||||
v_init ();
|
||||
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 */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!Attribute_Byte)
|
||||
{
|
||||
/* find the attribute currently under the cursor */
|
||||
|
@ -1452,7 +1452,7 @@ void SLtt_init_video (void)
|
|||
Attribute_Byte = Line_Buffer[1];
|
||||
set_color_from_attribute (Attribute_Byte);
|
||||
}
|
||||
|
||||
|
||||
v_attrib (Attribute_Byte);
|
||||
/* SLtt_Term_Cannot_Insert = 1; */
|
||||
#else /* EMX_VIDEO */
|
||||
|
@ -1466,7 +1466,7 @@ void SLtt_init_video (void)
|
|||
VioSetState (&RequestBlock, 0); /* nop if !fullscreen */
|
||||
Blink_Killed = 1;
|
||||
}
|
||||
|
||||
|
||||
if (!Attribute_Byte)
|
||||
{
|
||||
/* find the attribute currently under the cursor */
|
||||
|
@ -1488,7 +1488,7 @@ void SLtt_init_video (void)
|
|||
# endif
|
||||
if (!Attribute_Byte) Attribute_Byte = 0x17;
|
||||
IsColor = 1; /* is it really? */
|
||||
|
||||
|
||||
if (IsColor)
|
||||
{
|
||||
union REGS r;
|
||||
|
@ -1516,11 +1516,11 @@ void SLtt_init_video (void)
|
|||
IsColor = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
|
||||
/* Use Ralf Brown test for EGA or greater */
|
||||
asm mov ah, 0x12
|
||||
asm mov bl, 0x10
|
||||
|
@ -1528,7 +1528,7 @@ void SLtt_init_video (void)
|
|||
asm int 10h
|
||||
asm cmp bh, 0xFF
|
||||
asm je L1
|
||||
|
||||
|
||||
/* (V)EGA */
|
||||
asm xor bx, bx
|
||||
asm mov SLtt_Msdos_Cheap_Video, bx
|
||||
|
@ -1538,7 +1538,7 @@ void SLtt_init_video (void)
|
|||
asm mov ax, 0x17
|
||||
asm mov Attribute_Byte, ax
|
||||
asm jmp L2
|
||||
|
||||
|
||||
L1:
|
||||
/* Not (V)EGA */
|
||||
asm mov ah, 0x0F
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* Copyright (c) 1992, 1995 John E. Davis
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* You may distribute under the terms of either the GNU General Public
|
||||
* 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) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(void) SetConsoleCursorPosition(hStdout, newPosition);
|
||||
(void) SetConsoleCursorPosition(hStdout, newPosition);
|
||||
|
||||
/* success */
|
||||
return 0;
|
||||
|
@ -136,17 +136,17 @@ int SLsys_input_pending (int tsecs)
|
|||
|
||||
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)
|
||||
&& record.Event.KeyEvent.bKeyDown)
|
||||
&& record.Event.KeyEvent.bKeyDown)
|
||||
{
|
||||
/* ok, there is a keypress here */
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
/* something else is here, so read it and try again */
|
||||
(void) ReadConsoleInput(hStdin, &record, 1, &bytesRead);
|
||||
|
@ -173,7 +173,7 @@ int SLsys_input_pending (int tsecs)
|
|||
if (keyWaiting()) return 1;
|
||||
while (count > 0)
|
||||
{
|
||||
delay (20); 20 ms or 1/50 sec
|
||||
delay (20); 20 ms or 1/50 sec
|
||||
if (keyWaiting()) break;
|
||||
count--;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
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>
|
||||
|
@ -163,7 +163,7 @@ static umode_t get_perm (char *s, int base)
|
|||
|
||||
m |= (s [1] == '-') ? 0 :
|
||||
((s[1] == '+') ? (1 << (base + 1)) : (1 << (base + 1)) & ch_cmode);
|
||||
|
||||
|
||||
m |= (s [2] == '-') ? 0 :
|
||||
((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);
|
||||
addch (ch_flags [i]);
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < 3; i++){
|
||||
dlg_move (ch_dlg, BY + 1, 17 + i);
|
||||
addch (ch_flags [i+3]);
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < 3; i++){
|
||||
dlg_move (ch_dlg, BY + 1, 25 + i);
|
||||
addch (ch_flags [i+6]);
|
||||
|
@ -239,7 +239,7 @@ static int chl_callback (Dlg_head * h, int Par, int Msg)
|
|||
dlg_erase (h);
|
||||
draw_box (h, 0, 0, 13, 17);
|
||||
break;
|
||||
|
||||
|
||||
case DLG_KEY:
|
||||
switch (Par) {
|
||||
case KEY_LEFT:
|
||||
|
@ -259,20 +259,20 @@ static void do_enter_key (Dlg_head *h, int f_pos)
|
|||
struct group *chl_grp;
|
||||
WLEntry *fe;
|
||||
int lxx, lyy, chl_end, b_pos;
|
||||
|
||||
|
||||
do {
|
||||
lxx = (COLS - 74) / 2 + ((f_pos == 3) ? 35 : 53);
|
||||
lyy = (LINES - 13) / 2;
|
||||
chl_end = 0;
|
||||
|
||||
|
||||
chl_dlg = create_dlg (lyy, lxx, 13, 17, dialog_colors, chl_callback,
|
||||
"[Chown-advanced]", "achown_enter", DLG_NONE);
|
||||
|
||||
|
||||
/* get new listboxes */
|
||||
chl_list = listbox_new (1, 1, 15, 11, 0, l_call, NULL);
|
||||
|
||||
|
||||
listbox_add_item (chl_list, 0, 0, "<Unknown>", NULL);
|
||||
|
||||
|
||||
if (f_pos == 3) {
|
||||
/* get and put user names in the listbox */
|
||||
setpwent ();
|
||||
|
@ -284,22 +284,22 @@ static void do_enter_key (Dlg_head *h, int f_pos)
|
|||
else
|
||||
{
|
||||
/* get and put group names in the listbox */
|
||||
setgrent ();
|
||||
setgrent ();
|
||||
while ((chl_grp = getgrent ())) {
|
||||
listbox_add_item (chl_list, 0, 0, chl_grp->gr_name, NULL);
|
||||
}
|
||||
endgrent ();
|
||||
fe = listbox_search_text (chl_list, get_group (sf_stat->st_gid));
|
||||
}
|
||||
|
||||
|
||||
if (fe)
|
||||
listbox_select_entry (chl_list, fe);
|
||||
|
||||
|
||||
b_pos = chl_list->pos;
|
||||
add_widget (chl_dlg, chl_list);
|
||||
|
||||
|
||||
run_dlg (chl_dlg);
|
||||
|
||||
|
||||
if (b_pos != chl_list->pos){
|
||||
int ok = 0;
|
||||
if (f_pos == 3){
|
||||
|
@ -352,19 +352,19 @@ static void chown_refresh (void)
|
|||
addstr (_("group"));
|
||||
dlg_move (ch_dlg, BY - 1, 24);
|
||||
addstr (_("other"));
|
||||
|
||||
|
||||
dlg_move (ch_dlg, BY - 1, 35);
|
||||
addstr (_("owner"));
|
||||
dlg_move (ch_dlg, BY - 1, 53);
|
||||
addstr (_("group"));
|
||||
|
||||
|
||||
dlg_move (ch_dlg, 3, 4);
|
||||
addstr (_("On"));
|
||||
dlg_move (ch_dlg, BY + 1, 4);
|
||||
addstr (_("Flag"));
|
||||
dlg_move (ch_dlg, BY + 2, 4);
|
||||
addstr (_("Mode"));
|
||||
|
||||
|
||||
|
||||
if (!single_set){
|
||||
dlg_move (ch_dlg, 3, 54);
|
||||
|
@ -383,13 +383,13 @@ static void chown_info_update ()
|
|||
{
|
||||
/* display file info */
|
||||
attrset (COLOR_NORMAL);
|
||||
|
||||
|
||||
/* name && mode */
|
||||
dlg_move (ch_dlg, 3, 8);
|
||||
printw ("%s", name_trunc (fname, 45));
|
||||
dlg_move (ch_dlg, BY + 2, 9);
|
||||
printw ("%12o", get_mode ());
|
||||
|
||||
|
||||
/* permissions */
|
||||
set_perm (b_att[0]->text, sf_stat->st_mode >> 6);
|
||||
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_info_update ();
|
||||
return 1;
|
||||
|
||||
|
||||
case DLG_POST_KEY:
|
||||
if (f_pos < 3)
|
||||
b_setpos (f_pos);
|
||||
|
@ -429,37 +429,37 @@ static int advanced_chown_callback (Dlg_head * h, int Par, int Msg)
|
|||
|
||||
case DLG_KEY:
|
||||
switch (Par) {
|
||||
|
||||
|
||||
case XCTRL('b'):
|
||||
case KEY_LEFT:
|
||||
if (f_pos < 5)
|
||||
return (dec_flag_pos (f_pos));
|
||||
break;
|
||||
|
||||
|
||||
case XCTRL('f'):
|
||||
case KEY_RIGHT:
|
||||
if (f_pos < 5)
|
||||
return (inc_flag_pos (f_pos));
|
||||
break;
|
||||
|
||||
|
||||
case ' ':
|
||||
if (f_pos < 3)
|
||||
return 1;
|
||||
break;
|
||||
|
||||
|
||||
case '\n':
|
||||
case KEY_ENTER:
|
||||
if (f_pos <= 2 || f_pos >= 5)
|
||||
break;
|
||||
do_enter_key (h, f_pos);
|
||||
return 1;
|
||||
|
||||
|
||||
case ALT ('x'):
|
||||
i++;
|
||||
|
||||
|
||||
case ALT ('w'):
|
||||
i++;
|
||||
|
||||
|
||||
case ALT ('r'):
|
||||
Par = i + 3;
|
||||
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);
|
||||
send_message (h, h->current->widget, WIDGET_FOCUS, 0);
|
||||
break;
|
||||
|
||||
|
||||
case XCTRL ('x'):
|
||||
i++;
|
||||
|
||||
|
||||
case XCTRL ('w'):
|
||||
i++;
|
||||
|
||||
|
||||
case XCTRL ('r'):
|
||||
Par = 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);
|
||||
send_message (h, h->current->widget, WIDGET_FOCUS, 0);
|
||||
break;
|
||||
|
||||
|
||||
case 'x':
|
||||
i++;
|
||||
|
||||
|
||||
case 'w':
|
||||
i++;
|
||||
|
||||
|
||||
case 'r':
|
||||
if (f_pos > 2)
|
||||
break;
|
||||
|
@ -505,10 +505,10 @@ static int advanced_chown_callback (Dlg_head * h, int Par, int Msg)
|
|||
|
||||
case '4':
|
||||
i++;
|
||||
|
||||
|
||||
case '2':
|
||||
i++;
|
||||
|
||||
|
||||
case '1':
|
||||
if (f_pos > 2)
|
||||
break;
|
||||
|
@ -516,15 +516,15 @@ static int advanced_chown_callback (Dlg_head * h, int Par, int Msg)
|
|||
ch_flags[flag_pos] = '=';
|
||||
update_mode (h);
|
||||
break;
|
||||
|
||||
|
||||
case '-':
|
||||
if (f_pos > 2)
|
||||
break;
|
||||
|
||||
|
||||
case '*':
|
||||
if (Par == '*')
|
||||
Par = '=';
|
||||
|
||||
|
||||
case '=':
|
||||
case '+':
|
||||
if (f_pos > 4)
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
|
||||
/* Background support.
|
||||
Copyright (C) 1996 The Free Software Foundation
|
||||
|
||||
|
||||
Written by: 1996 Miguel de Icaza
|
||||
|
||||
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
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
|
@ -78,7 +78,7 @@ static int parent_fd;
|
|||
#define mymsg "Desde el hijo\n\r"
|
||||
|
||||
struct TaskList *task_list = NULL;
|
||||
|
||||
|
||||
void
|
||||
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 pid;
|
||||
|
||||
|
||||
if (socketpair (AF_UNIX, SOCK_STREAM, 0, comm) == -1)
|
||||
return -1;
|
||||
|
||||
|
||||
if ((pid = fork ()) == -1)
|
||||
return -1;
|
||||
|
||||
|
||||
if (pid == 0){
|
||||
int nullfd;
|
||||
|
||||
parent_fd = comm [1];
|
||||
we_are_background = 1;
|
||||
|
||||
|
||||
/* Make stdin/stdout/stderr point somewhere */
|
||||
close (0);
|
||||
close (1);
|
||||
|
@ -157,11 +157,11 @@ do_background (char *info)
|
|||
/* To make it obvious if it fails, there is a bug report on this */
|
||||
write (2, mymsg, sizeof (mymsg));
|
||||
write (1, mymsg, sizeof (mymsg));
|
||||
|
||||
|
||||
/* Just for debugging the background back end */
|
||||
if (background_wait){
|
||||
volatile int i = 1;
|
||||
|
||||
|
||||
while (i)
|
||||
;
|
||||
}
|
||||
|
@ -186,12 +186,12 @@ void
|
|||
real_message_1s (enum OperationMode mode, int *flags, char *title, char *str1)
|
||||
{
|
||||
char *full_title;
|
||||
|
||||
|
||||
if (mode == Background)
|
||||
full_title = background_title (title);
|
||||
else
|
||||
full_title = title;
|
||||
|
||||
|
||||
message (*flags, title, str1);
|
||||
|
||||
if (title != full_title)
|
||||
|
@ -202,14 +202,14 @@ void
|
|||
real_message_2s (enum OperationMode mode, int *flags, char *title, char *str1, char *str2)
|
||||
{
|
||||
char *full_title;
|
||||
|
||||
|
||||
if (mode == Background)
|
||||
full_title = background_title (title);
|
||||
else
|
||||
full_title = title;
|
||||
|
||||
|
||||
message (*flags, title, str1, str2);
|
||||
|
||||
|
||||
if (title != 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)
|
||||
{
|
||||
char *full_title;
|
||||
|
||||
|
||||
if (mode == Background)
|
||||
full_title = background_title (title);
|
||||
else
|
||||
full_title = title;
|
||||
|
||||
|
||||
message (*flags, title, str1, str2, str3);
|
||||
|
||||
|
||||
if (title != 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
|
||||
* specified routine
|
||||
* specified routine
|
||||
*/
|
||||
|
||||
int
|
||||
|
@ -282,7 +282,7 @@ background_attention (int fd, void *xpid)
|
|||
int bytes;
|
||||
enum ReturnType type;
|
||||
char *background_process_error = _(" Background process error ");
|
||||
|
||||
|
||||
bytes = read (fd, &routine, sizeof (routine));
|
||||
if (bytes < (sizeof (routine))){
|
||||
if (errno == ECHILD)
|
||||
|
@ -300,7 +300,7 @@ background_attention (int fd, void *xpid)
|
|||
waitpid (pid, &status, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
read (fd, &argc, sizeof (argc));
|
||||
if (argc > MAXCALLARGS){
|
||||
message (1, _(" Background protocol error "),
|
||||
|
@ -308,14 +308,14 @@ background_attention (int fd, void *xpid)
|
|||
" than we can handle. \n"));
|
||||
}
|
||||
read (fd, &type, sizeof (type));
|
||||
|
||||
|
||||
for (i = 0; i < argc; i++){
|
||||
int size;
|
||||
|
||||
|
||||
read (fd, &size, sizeof (size));
|
||||
data [i] = xmalloc (size+1, "RPC Arguments");
|
||||
read (fd, data [i], size);
|
||||
|
||||
|
||||
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]);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* Send the result code and the value for shared variables */
|
||||
write (fd, &result, sizeof (int));
|
||||
write (fd, &do_append, sizeof (do_append));
|
||||
write (fd, &recursive_result, sizeof (recursive_result));
|
||||
|
||||
|
||||
} else if (type == Return_String) {
|
||||
int len;
|
||||
|
||||
|
@ -407,7 +407,7 @@ parent_call (void *routine, int argc, ...)
|
|||
{
|
||||
va_list ap;
|
||||
int i;
|
||||
|
||||
|
||||
va_start (ap, argc);
|
||||
parent_call_header (routine, argc, Return_Integer);
|
||||
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, 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
|
||||
*/
|
||||
read (parent_fd, &i, sizeof (int));
|
||||
|
@ -434,7 +434,7 @@ parent_call_string (void *routine, int argc, ...)
|
|||
va_list ap;
|
||||
char *str;
|
||||
int i;
|
||||
|
||||
|
||||
va_start (ap, argc);
|
||||
parent_call_header (routine, argc, Return_String);
|
||||
for (i = 0; i < argc; i++){
|
||||
|
@ -466,7 +466,7 @@ call_1s (int (*routine)(enum OperationMode, char *), char *str)
|
|||
{
|
||||
if (we_are_background)
|
||||
return parent_call ((void *)routine, 1, strlen (str), str);
|
||||
else
|
||||
else
|
||||
return (*routine)(Foreground, str);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
/* Some misc dialog boxes for the program.
|
||||
|
||||
|
||||
Copyright (C) 1994, 1995 the Free Software Foundation
|
||||
|
||||
|
||||
Authors: 1994, 1995 Miguel de Icaza
|
||||
1995 Jakub Jelinek
|
||||
|
||||
|
||||
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
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
char *text;
|
||||
WInput *input;
|
||||
|
||||
|
||||
switch (Msg){
|
||||
case DLG_DRAW:
|
||||
attrset (COLOR_NORMAL);
|
||||
|
@ -101,7 +101,7 @@ static int display_callback (struct Dlg_head *h, int id, int Msg)
|
|||
input_set_point (status, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case DLG_KEY:
|
||||
if (id == '\n'){
|
||||
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);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ((WInput *) h->current->widget == user){
|
||||
h->ret_value = B_USER + 6;
|
||||
dlg_stop (h);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ((WInput *) h->current->widget == status){
|
||||
h->ret_value = B_USER + 7;
|
||||
dlg_stop (h);
|
||||
|
@ -131,7 +131,7 @@ static int display_callback (struct Dlg_head *h, int id, int Msg)
|
|||
return MSG_HANDLED;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
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* ok_button = _("&Ok");
|
||||
char* cancel_button = _("&Cancel");
|
||||
|
||||
|
||||
static int button_start = 30;
|
||||
|
||||
|
||||
displays_status = _status;
|
||||
|
||||
if (!i18n_displays_flag){
|
||||
|
@ -169,13 +169,13 @@ static void display_init (int radio_sel, char *init_text,
|
|||
i = strlen (user_mini_status) + 13;
|
||||
if (i > DISPLAY_X)
|
||||
DISPLAY_X = i;
|
||||
|
||||
|
||||
i = strlen (display_title) + 8;
|
||||
if (i > DISPLAY_X)
|
||||
DISPLAY_X = i;
|
||||
|
||||
button_start = DISPLAY_X - l - 5;
|
||||
|
||||
|
||||
/* get hotkey of user-defined format string */
|
||||
cp = strchr(displays[LIST_TYPES-1],'&');
|
||||
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"));
|
||||
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"),
|
||||
XV_WLAY_RIGHTOF);
|
||||
|
||||
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"),
|
||||
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");
|
||||
add_widgetl (dd, check_status, XV_WLAY_NEXTROW);
|
||||
|
||||
|
||||
user = input_new (7, 9, INPUT_COLOR, DISPLAY_X-14, init_text, "user-fmt-input");
|
||||
add_widgetl (dd, user, XV_WLAY_RIGHTDOWN);
|
||||
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;
|
||||
display_init (current_mode, panel->user_format,
|
||||
display_init (current_mode, panel->user_format,
|
||||
panel->user_mini_status, panel->user_status_format);
|
||||
|
||||
|
||||
run_dlg (dd);
|
||||
|
||||
result = -1;
|
||||
|
||||
|
||||
if (section) {
|
||||
free (panel->user_format);
|
||||
for (i = 0; i < LIST_TYPES; i++)
|
||||
free (panel->user_status_format [i]);
|
||||
free (panel);
|
||||
}
|
||||
|
||||
|
||||
if (dd->ret_value != B_CANCEL){
|
||||
result = my_radio->sel;
|
||||
*userp = strdup (user->buffer);
|
||||
|
@ -303,12 +303,12 @@ sortfn *sort_box (sortfn *sort_fn, int *reverse, int *case_sensitive)
|
|||
i = strlen (case_label) + 4;
|
||||
if (i > r)
|
||||
r = i;
|
||||
|
||||
|
||||
l = strlen (ok_button) + 6;
|
||||
i = strlen (cancel_button) + 4;
|
||||
if (i > l)
|
||||
l = i;
|
||||
|
||||
|
||||
i = check_pos + max(r,l) + 2;
|
||||
|
||||
if (i > SORT_X)
|
||||
|
@ -324,23 +324,23 @@ sortfn *sort_box (sortfn *sort_fn, int *reverse, int *case_sensitive)
|
|||
}
|
||||
|
||||
result = 0;
|
||||
|
||||
|
||||
for (i = 0; i < SORT_TYPES; i++)
|
||||
if ((sortfn *) (sort_orders [i].sort_fn) == sort_fn){
|
||||
current_mode = i;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
dd = create_dlg (0, 0, SORT_Y, SORT_X, dialog_colors, common_dialog_callback,
|
||||
"[Left and Right Menus]", "sort", DLG_CENTER | DLG_GRID);
|
||||
|
||||
|
||||
x_set_dialog_title (dd, sort_title);
|
||||
|
||||
add_widgetl (dd,
|
||||
button_new (10, button_pos, B_CANCEL, NORMAL_BUTTON, cancel_button,
|
||||
add_widgetl (dd,
|
||||
button_new (10, button_pos, B_CANCEL, NORMAL_BUTTON, cancel_button,
|
||||
0, 0, "cancel-button"), XV_WLAY_CENTERROW);
|
||||
|
||||
add_widgetl (dd,
|
||||
add_widgetl (dd,
|
||||
button_new (9, button_pos, B_ENTER, DEFPUSH_BUTTON, ok_button,
|
||||
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->sel = my_radio->pos = current_mode;
|
||||
|
||||
|
||||
add_widget (dd, my_radio);
|
||||
run_dlg (dd);
|
||||
|
||||
|
@ -401,7 +401,7 @@ void confirm_box ()
|
|||
|
||||
#ifdef ENABLE_NLS
|
||||
static int i18n_flag = 0;
|
||||
|
||||
|
||||
if (!i18n_flag)
|
||||
{
|
||||
register int i = sizeof(conf_widgets)/sizeof(QuickWidget) - 1;
|
||||
|
@ -434,7 +434,7 @@ void confirm_box ()
|
|||
confirmation.xlen = i;
|
||||
|
||||
confirmation.title = _(confirmation.title);
|
||||
|
||||
|
||||
i18n_flag = confirmation.i18n = 1;
|
||||
}
|
||||
|
||||
|
@ -499,7 +499,7 @@ void display_bits_box ()
|
|||
l1 = strlen (display_widgets [2].text);
|
||||
if (l1 > maxlen)
|
||||
maxlen = l1;
|
||||
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
return MSG_HANDLED;
|
||||
|
||||
|
||||
case DLG_DRAW:
|
||||
common_dialog_repaint (h);
|
||||
break;
|
||||
|
@ -574,7 +574,7 @@ char *tree (char *current_dir)
|
|||
|
||||
tree_colors [3] = dialog_colors [0];
|
||||
tree_colors [1] = dialog_colors [1];
|
||||
|
||||
|
||||
/* Create the components */
|
||||
dlg = create_dlg (0, 0, TREE_Y, TREE_X, tree_colors,
|
||||
tree_callback, "[Directory Tree]", "tree", DLG_CENTER);
|
||||
|
@ -584,13 +584,13 @@ char *tree (char *current_dir)
|
|||
add_widget (dlg, bar);
|
||||
bar->widget.x = 0;
|
||||
bar->widget.y = LINES - 1;
|
||||
|
||||
|
||||
run_dlg (dlg);
|
||||
if (dlg->ret_value == B_ENTER)
|
||||
val = strdup (mytree->selected_ptr->name);
|
||||
else
|
||||
val = 0;
|
||||
|
||||
|
||||
destroy_dlg (dlg);
|
||||
return val;
|
||||
}
|
||||
|
@ -662,17 +662,17 @@ static QuickWidget confvfs_widgets [] = {
|
|||
{ quick_label, 4, VFSX, 8, VFSY, N_("ftp anonymous password:"),
|
||||
0, 0, 0, 0, XV_WLAY_NEXTROW, "label-pass"},
|
||||
#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" },
|
||||
{ quick_radio, 4, VFSX, 5, VFSY, "", 2, 0,
|
||||
&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" },
|
||||
{ quick_label, 46, VFSX, 3, VFSY, "sec",
|
||||
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" },
|
||||
{ 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, 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) {
|
||||
char *p;
|
||||
|
||||
|
||||
vfs_timeout = atoi (ret_timeout);
|
||||
free (ret_timeout);
|
||||
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_label, 3, 57, 2, 0, "", 0, 0, 0, 0, XV_WLAY_DONTCARE, "label" },
|
||||
{ 0 } };
|
||||
|
||||
|
||||
char *my_str;
|
||||
int len;
|
||||
|
||||
|
||||
Quick_input.xlen = 57;
|
||||
Quick_input.title = _("Quick cd");
|
||||
Quick_input.help = "[Quick cd]";
|
||||
|
@ -788,7 +788,7 @@ char *cd_dialog (void)
|
|||
len = strlen (quick_widgets [INPUT_INDEX+1].text);
|
||||
|
||||
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_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_widgets [INPUT_INDEX].relative_y = 2;
|
||||
quick_widgets [INPUT_INDEX].str_result = &my_str;
|
||||
|
||||
|
||||
Quick_input.widgets = quick_widgets;
|
||||
if (quick_dialog (&Quick_input) != B_CANCEL){
|
||||
return *(quick_widgets [INPUT_INDEX].str_result);
|
||||
|
@ -808,7 +808,7 @@ char *cd_dialog (void)
|
|||
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)
|
||||
{
|
||||
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_label, 6, 80, 2, 8, "", 0, 0, 0, 0, XV_WLAY_DONTCARE, "label-2" },
|
||||
{ 0 } };
|
||||
|
||||
|
||||
Quick_input.xlen = 64;
|
||||
Quick_input.ylen = 8;
|
||||
Quick_input.title = "Symbolic link";
|
||||
|
@ -842,7 +842,7 @@ void symlink_dialog (char *existing, char *new, char **ret_existing,
|
|||
Quick_input.xpos = -1;
|
||||
quick_widgets [INPUT_INDEX].str_result = ret_new;
|
||||
quick_widgets [INPUT_INDEX+2].str_result = ret_existing;
|
||||
|
||||
|
||||
Quick_input.widgets = quick_widgets;
|
||||
if (quick_dialog (&Quick_input) == B_CANCEL){
|
||||
*ret_new = NULL;
|
||||
|
@ -870,7 +870,7 @@ jobs_fill_listbox (void)
|
|||
state_str [0] = _("Running ");
|
||||
state_str [1] = _("Stopped");
|
||||
}
|
||||
|
||||
|
||||
while (tl){
|
||||
char *s;
|
||||
|
||||
|
@ -880,19 +880,19 @@ jobs_fill_listbox (void)
|
|||
tl = tl->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
task_cb (int action, void *ignored)
|
||||
{
|
||||
TaskList *tl;
|
||||
int sig;
|
||||
|
||||
|
||||
if (!bg_list->list)
|
||||
return 0;
|
||||
|
||||
/* Get this instance information */
|
||||
tl = (TaskList *) bg_list->current->data;
|
||||
|
||||
|
||||
if (action == B_STOP){
|
||||
sig = SIGSTOP;
|
||||
tl->state = Task_Stopped;
|
||||
|
@ -902,7 +902,7 @@ task_cb (int action, void *ignored)
|
|||
} else if (action == B_KILL){
|
||||
sig = SIGKILL;
|
||||
}
|
||||
|
||||
|
||||
if (sig == SIGINT)
|
||||
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 :-) */
|
||||
dlg_redraw (jobs_dlg);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct
|
||||
static struct
|
||||
{
|
||||
char* name;
|
||||
int xpos;
|
||||
int value;
|
||||
int (*callback)();
|
||||
char* tkname;
|
||||
}
|
||||
}
|
||||
job_buttons [] =
|
||||
{
|
||||
{N_("&Stop"), 3, B_STOP, task_cb, "button-stop"},
|
||||
|
@ -968,24 +968,24 @@ jobs_cmd (void)
|
|||
common_dialog_callback, "[Background jobs]", "jobs",
|
||||
DLG_CENTER | DLG_GRID);
|
||||
x_set_dialog_title (jobs_dlg, _("Background Jobs"));
|
||||
|
||||
|
||||
bg_list = listbox_new (2, 3, JOBS_X-7, JOBS_Y-9, listbox_nothing, 0, "listbox");
|
||||
add_widget (jobs_dlg, bg_list);
|
||||
|
||||
i = n_buttons;
|
||||
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,
|
||||
NORMAL_BUTTON, job_buttons [i].name,
|
||||
NORMAL_BUTTON, job_buttons [i].name,
|
||||
job_buttons [i].callback, 0,
|
||||
job_buttons [i].tkname));
|
||||
}
|
||||
|
||||
|
||||
/* Insert all of task information in the list */
|
||||
jobs_fill_listbox ();
|
||||
run_dlg (jobs_dlg);
|
||||
|
||||
|
||||
destroy_dlg (jobs_dlg);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
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>
|
||||
|
@ -91,7 +91,7 @@ struct {
|
|||
char *text;
|
||||
int selected;
|
||||
WCheck *check;
|
||||
} check_perm[PERMISSIONS] =
|
||||
} check_perm[PERMISSIONS] =
|
||||
{
|
||||
{ S_IXOTH, N_("execute/search by others"), 0, 0, },
|
||||
{ S_IWOTH, N_("write by others"), 0, 0, },
|
||||
|
@ -110,7 +110,7 @@ struct {
|
|||
struct {
|
||||
int ret_cmd, flags, y, x;
|
||||
char *text;
|
||||
} chmod_but[BUTTONS] =
|
||||
} chmod_but[BUTTONS] =
|
||||
{
|
||||
{ B_CANCEL, NORMAL_BUTTON, 2, 33, N_("&Cancel") },
|
||||
{ B_ENTER, DEFPUSH_BUTTON, 2, 17, N_("&Set") },
|
||||
|
@ -126,7 +126,7 @@ static void chmod_toggle_select (void)
|
|||
#ifdef HAVE_TK
|
||||
char *wn = (char *) ch_dlg->current->widget->wdata;
|
||||
int id = ch_dlg->current->dlg_id -BUTTONS + single_set * 2;
|
||||
|
||||
|
||||
check_perm [id].selected ^= 1;
|
||||
|
||||
tk_evalf ("%s configure -color $setup(%s)",
|
||||
|
@ -151,7 +151,7 @@ static void chmod_refresh (void)
|
|||
{
|
||||
attrset (COLOR_NORMAL);
|
||||
dlg_erase (ch_dlg);
|
||||
|
||||
|
||||
draw_box (ch_dlg, 1, 2, 20 - single_set, 66);
|
||||
draw_box (ch_dlg, PY, PX, PERMISSIONS + 2, 33);
|
||||
draw_box (ch_dlg, FY, FX, 10, 25);
|
||||
|
@ -164,7 +164,7 @@ static void chmod_refresh (void)
|
|||
addstr (_("Owner name"));
|
||||
dlg_move (ch_dlg, FY + 7, FX + 2);
|
||||
addstr (_("Group name"));
|
||||
|
||||
|
||||
attrset (title_color);
|
||||
dlg_move (ch_dlg, 1, 28);
|
||||
addstr (_(" Chmod command "));
|
||||
|
@ -172,7 +172,7 @@ static void chmod_refresh (void)
|
|||
addstr (_(" Permission "));
|
||||
dlg_move (ch_dlg, FY, FX + 1);
|
||||
addstr (_(" File "));
|
||||
|
||||
|
||||
attrset (selection_color);
|
||||
|
||||
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)
|
||||
{
|
||||
char buffer [10];
|
||||
|
||||
|
||||
switch (Msg) {
|
||||
case DLG_ACTION:
|
||||
if (Par >= BUTTONS - single_set * 2){
|
||||
|
@ -236,10 +236,10 @@ static void init_chmod (void)
|
|||
title_color = SELECTED_COLOR;
|
||||
selection_color = SELECTED_COLOR;
|
||||
}
|
||||
|
||||
|
||||
ch_dlg = create_dlg (0, 0, 22 - single_set, 70, dialog_colors,
|
||||
chmod_callback, "[Chmod]", "chmod", DLG_CENTER);
|
||||
|
||||
|
||||
x_set_dialog_title (ch_dlg, _("Chmod command"));
|
||||
|
||||
#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);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
c_stat = sf_stat.st_mode;
|
||||
mode_change = 0; /* clear changes flag */
|
||||
|
||||
|
@ -369,9 +369,9 @@ void chmod_cmd (void)
|
|||
statl = label_new (FY+4, FX+2, buffer, NULL);
|
||||
add_widget (ch_dlg, statl);
|
||||
tk_end_frame ();
|
||||
|
||||
|
||||
run_dlg (ch_dlg); /* retrieve an action */
|
||||
|
||||
|
||||
/* do action */
|
||||
switch (ch_dlg->ret_value){
|
||||
case B_ENTER:
|
||||
|
@ -381,11 +381,11 @@ void chmod_cmd (void)
|
|||
fname, unix_error_string (errno));
|
||||
need_update = 1;
|
||||
break;
|
||||
|
||||
|
||||
case B_CANCEL:
|
||||
end_chmod = 1;
|
||||
break;
|
||||
|
||||
|
||||
case B_ALL:
|
||||
case B_MARKED:
|
||||
and_mask = or_mask = 0;
|
||||
|
@ -401,7 +401,7 @@ void chmod_cmd (void)
|
|||
|
||||
apply_mask (&sf_stat);
|
||||
break;
|
||||
|
||||
|
||||
case B_SETMRK:
|
||||
and_mask = or_mask = 0;
|
||||
and_mask = ~and_mask;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
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>
|
||||
|
@ -85,7 +85,7 @@ static struct {
|
|||
{ B_SETALL, NORMAL_BUTTON, 0, 3, N_("Set &all") },
|
||||
};
|
||||
|
||||
#define LABELS 5
|
||||
#define LABELS 5
|
||||
static struct {
|
||||
int y, x;
|
||||
WLabel *l;
|
||||
|
@ -119,7 +119,7 @@ static void chown_refresh (void)
|
|||
addstr (N_(" Size "));
|
||||
dlg_move (ch_dlg, TY + 9, TX + 1);
|
||||
addstr (N_(" Permission "));
|
||||
|
||||
|
||||
attrset (COLOR_HOT_NORMAL);
|
||||
dlg_move (ch_dlg, 1, 28);
|
||||
addstr (N_(" Chown command "));
|
||||
|
@ -165,7 +165,7 @@ static void init_chown (void)
|
|||
|
||||
do_refresh ();
|
||||
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,
|
||||
"[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);
|
||||
}
|
||||
endpwent ();
|
||||
|
||||
|
||||
setgrent (); /* get and put group names in the listbox */
|
||||
while ((l_grp = getgrent ())) {
|
||||
listbox_add_item (l_group, 0, 0, l_grp->gr_name, NULL);
|
||||
}
|
||||
endgrent ();
|
||||
|
||||
|
||||
tk_new_frame (ch_dlg, "f.");
|
||||
add_widget (ch_dlg, l_group);
|
||||
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)
|
||||
{
|
||||
char *fname;
|
||||
|
||||
|
||||
need_update = end_chown = 1;
|
||||
do_chown (u,g);
|
||||
|
||||
|
||||
do {
|
||||
fname = next_file ();
|
||||
|
||||
|
||||
do_chown (u,g);
|
||||
} while (cpanel->marked);
|
||||
}
|
||||
|
@ -271,17 +271,17 @@ void chown_cmd (void)
|
|||
fname = next_file (); /* next marked file */
|
||||
else
|
||||
fname = selection (cpanel)->fname; /* single file */
|
||||
|
||||
|
||||
if (!stat_file (fname, &sf_stat)){ /* get status of file */
|
||||
destroy_dlg (ch_dlg);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* select in listboxes */
|
||||
fe = listbox_search_text (l_user, get_owner(sf_stat.st_uid));
|
||||
if (fe)
|
||||
listbox_select_entry (l_user, fe);
|
||||
|
||||
|
||||
fe = listbox_search_text (l_group, get_group(sf_stat.st_gid));
|
||||
if (fe)
|
||||
listbox_select_entry (l_group, fe);
|
||||
|
@ -294,12 +294,12 @@ void chown_cmd (void)
|
|||
chown_label (4, string_perm (sf_stat.st_mode));
|
||||
|
||||
run_dlg (ch_dlg);
|
||||
|
||||
|
||||
switch (ch_dlg->ret_value) {
|
||||
case B_CANCEL:
|
||||
end_chown = 1;
|
||||
break;
|
||||
|
||||
|
||||
case B_SETUSR:
|
||||
{
|
||||
struct passwd *user;
|
||||
|
@ -310,7 +310,7 @@ void chown_cmd (void)
|
|||
apply_chowns (new_user, new_group);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
case B_SETGRP:
|
||||
{
|
||||
struct group *grp;
|
||||
|
@ -327,7 +327,7 @@ void chown_cmd (void)
|
|||
{
|
||||
struct group *grp;
|
||||
struct passwd *user;
|
||||
|
||||
|
||||
grp = getgrnam (l_group->current->text);
|
||||
if (grp)
|
||||
new_group = grp->gr_gid;
|
||||
|
@ -344,13 +344,13 @@ void chown_cmd (void)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (cpanel->marked && ch_dlg->ret_value != B_CANCEL){
|
||||
do_file_mark (cpanel, current_file, 0);
|
||||
need_update = 1;
|
||||
}
|
||||
destroy_dlg (ch_dlg);
|
||||
} while (cpanel->marked && !end_chown);
|
||||
|
||||
|
||||
chown_done ();
|
||||
}
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* Routines invoked by a function key
|
||||
They normally operate on the current panel.
|
||||
|
||||
|
||||
Copyright (C) 1994, 1995 Miguel de Icaza
|
||||
Copyright (C) 1994, 1995 Janne Kukonlehto
|
||||
|
||||
|
||||
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
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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_nroff_flag = 0;
|
||||
int changed_magic_flag = 0;
|
||||
|
||||
|
||||
altered_hex_mode = 0;
|
||||
altered_nroff_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);
|
||||
else
|
||||
strcpy (view_entry, "View");
|
||||
|
||||
|
||||
if (!regex_command (filename, view_entry, NULL, &move_dir)){
|
||||
view (0, filename, &move_dir, start_line);
|
||||
repaint_screen ();
|
||||
}
|
||||
} else {
|
||||
char *localcopy;
|
||||
|
||||
|
||||
if (!viewer){
|
||||
viewer = getenv ("PAGER");
|
||||
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);
|
||||
mc_ungetlocalcopy (filename, localcopy, 0);
|
||||
} else
|
||||
} else
|
||||
execute_internal (viewer, filename);
|
||||
}
|
||||
return move_dir;
|
||||
|
@ -243,7 +243,7 @@ static void do_view_cmd (WPanel *panel, int normal)
|
|||
{
|
||||
int dir, file_idx;
|
||||
panel = get_a_panel (panel);
|
||||
|
||||
|
||||
/* Directories are viewed by changing to them */
|
||||
if (S_ISDIR (selection (panel)->buf.st_mode) ||
|
||||
link_isdir (selection (panel))){
|
||||
|
@ -255,7 +255,7 @@ static void do_view_cmd (WPanel *panel, int normal)
|
|||
}
|
||||
do_cd (selection (panel)->fname, cd_exact);
|
||||
return;
|
||||
|
||||
|
||||
}
|
||||
|
||||
file_idx = panel->selected;
|
||||
|
@ -369,10 +369,10 @@ void copymove_cmd_with_default (int copy, char *thedefault)
|
|||
void mkdir_cmd (WPanel *panel)
|
||||
{
|
||||
char *dir;
|
||||
|
||||
|
||||
panel = get_a_panel (panel);
|
||||
dir = input_expand_dialog (_(" Mkdir "), _(" Enter directory name:") , "");
|
||||
|
||||
|
||||
if (!dir)
|
||||
return;
|
||||
|
||||
|
@ -423,9 +423,9 @@ void set_panel_filter (WPanel *p)
|
|||
{
|
||||
char *reg_exp;
|
||||
char *x;
|
||||
|
||||
|
||||
x = p->filter ? p->filter : easy_patterns ? "*" : ".";
|
||||
|
||||
|
||||
reg_exp = input_dialog (_(" Filter "), _(" Set expression for filtering filenames"), x);
|
||||
if (!reg_exp)
|
||||
return;
|
||||
|
@ -454,7 +454,7 @@ void reread_cmd (void)
|
|||
flag = strcmp (cpanel->cwd, opanel->cwd) ? UP_ONLY_CURRENT : 0;
|
||||
else
|
||||
flag = UP_ONLY_CURRENT;
|
||||
|
||||
|
||||
update_panels (UP_RELOAD|flag, UP_KEEPSEL);
|
||||
repaint_screen ();
|
||||
}
|
||||
|
@ -513,7 +513,7 @@ void select_cmd_panel (WPanel *panel)
|
|||
reg_exp = input_dialog (_(" Select "), "", easy_patterns ? "*" : ".");
|
||||
if (!reg_exp)
|
||||
return;
|
||||
|
||||
|
||||
reg_exp_t = reg_exp;
|
||||
|
||||
/* Check if they specified a directory */
|
||||
|
@ -565,9 +565,9 @@ void unselect_cmd_panel (WPanel *panel)
|
|||
reg_exp = input_dialog (_(" Unselect "),"", easy_patterns ? "*" : ".");
|
||||
if (!reg_exp)
|
||||
return;
|
||||
|
||||
|
||||
reg_exp_t = reg_exp;
|
||||
|
||||
|
||||
/* Check if they specified directory matching */
|
||||
if (*reg_exp_t == PATH_SEP){
|
||||
dirflag = 1;
|
||||
|
@ -578,7 +578,7 @@ void unselect_cmd_panel (WPanel *panel)
|
|||
reg_exp_t [strlen(reg_exp_t) - 1] = 0;
|
||||
}
|
||||
for (i = 0; i < panel->count; i++){
|
||||
if (!strcmp (panel->dir.list [i].fname, ".."))
|
||||
if (!strcmp (panel->dir.list [i].fname, ".."))
|
||||
continue;
|
||||
if (S_ISDIR (panel->dir.list [i].buf.st_mode)){
|
||||
if (!dirflag)
|
||||
|
@ -654,10 +654,10 @@ void menu_edit_cmd (void)
|
|||
char *buffer;
|
||||
char *menufile;
|
||||
int dir = 0;
|
||||
|
||||
|
||||
dir = query_dialog (
|
||||
_("Menu file edit"),
|
||||
_(" Which menu file will you edit? "),
|
||||
_(" Which menu file will you edit? "),
|
||||
0, geteuid() ? 2 : 3,
|
||||
_("&Local"), _("&Home"), _("&System Wide")
|
||||
);
|
||||
|
@ -674,7 +674,7 @@ void menu_edit_cmd (void)
|
|||
buffer = concat_dir_and_file (home_dir, MC_HOME_MENU);
|
||||
check_for_default (menufile, buffer);
|
||||
break;
|
||||
|
||||
|
||||
case 2:
|
||||
buffer = concat_dir_and_file (mc_home, MC_GLOBAL_MENU);
|
||||
break;
|
||||
|
@ -771,12 +771,12 @@ compare_dir (WPanel *panel, WPanel *other, enum CompareMode mode)
|
|||
char *src_name, *dst_name;
|
||||
|
||||
panel = get_a_panel (panel);
|
||||
|
||||
|
||||
/* No marks by default */
|
||||
panel->marked = 0;
|
||||
panel->total = 0;
|
||||
panel->dirs_marked = 0;
|
||||
|
||||
|
||||
/* Handle all files in the panel */
|
||||
for (i = 0; i < panel->count; 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)
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/* Newer version with different size is marked */
|
||||
if (source->buf.st_size != target->buf.st_size){
|
||||
do_file_mark (panel, i, 1);
|
||||
continue;
|
||||
|
||||
|
||||
}
|
||||
if (mode == compare_size_only)
|
||||
continue;
|
||||
|
||||
|
||||
if (mode == compare_quick){
|
||||
/* Thorough compare off, compare only time stamps */
|
||||
/* Mark newer version, don't mark version with the same date */
|
||||
|
@ -963,12 +963,12 @@ view_other_cmd (void)
|
|||
|
||||
reset_prog_mode ();
|
||||
keypad(stdscr, TRUE);
|
||||
#ifndef HAVE_X
|
||||
#ifndef HAVE_X
|
||||
if (use_mouse_p)
|
||||
init_mouse ();
|
||||
if (alternate_plus_minus)
|
||||
application_keypad_mode ();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||
if (use_subshell){
|
||||
|
@ -1008,9 +1008,9 @@ do_link (int symbolic_link, char *fname)
|
|||
if (!S_ISREG (s.st_mode))
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!symbolic_link){
|
||||
src = copy_strings (_(" Link "), name_trunc (fname, 46),
|
||||
src = copy_strings (_(" Link "), name_trunc (fname, 46),
|
||||
_(" to:"), NULL);
|
||||
dest = input_expand_dialog (_(" Link "), src, "");
|
||||
free (src);
|
||||
|
@ -1030,7 +1030,7 @@ do_link (int symbolic_link, char *fname)
|
|||
/* suggest the full path for symlink */
|
||||
char s[MC_MAXPATHLEN];
|
||||
char d[MC_MAXPATHLEN];
|
||||
|
||||
|
||||
strcpy(s, cpanel->cwd);
|
||||
if ( ! ((s[0] == '/') && (s[1] == 0)))
|
||||
strcat(s, "/");
|
||||
|
@ -1039,7 +1039,7 @@ do_link (int symbolic_link, char *fname)
|
|||
strcpy(d, opanel->cwd);
|
||||
else
|
||||
strcpy (d,"");
|
||||
|
||||
|
||||
if ( ! ((d[0] == '/') && (d[1] == 0)))
|
||||
strcat(d, "/");
|
||||
symlink_dialog (s, d, &dest, &src);
|
||||
|
@ -1082,7 +1082,7 @@ void edit_symlink_cmd (void)
|
|||
char buffer [MC_MAXPATHLEN], *p = selection (cpanel)->fname;
|
||||
int i;
|
||||
char *dest, *q = copy_strings (_(" Symlink "), name_trunc (p, 32), _(" points to:"), NULL);
|
||||
|
||||
|
||||
i = readlink (p, buffer, MC_MAXPATHLEN);
|
||||
if (i > 0) {
|
||||
buffer [i] = 0;
|
||||
|
@ -1115,7 +1115,7 @@ void other_symlink_cmd (void)
|
|||
return;
|
||||
p = concat_dir_and_file (cpanel->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);
|
||||
dest = input_expand_dialog (_(" Relative symlink "), q, r);
|
||||
if (dest) {
|
||||
|
@ -1173,7 +1173,7 @@ char *get_random_hint (void)
|
|||
char *hintfile;
|
||||
int len;
|
||||
int start;
|
||||
|
||||
|
||||
/* Do not change hints more often than one minute */
|
||||
|
||||
#ifdef SCO_FLAVOR
|
||||
|
@ -1187,10 +1187,10 @@ char *get_random_hint (void)
|
|||
#else
|
||||
static int last_sec;
|
||||
static struct timeval tv;
|
||||
|
||||
|
||||
gettimeofday (&tv, NULL);
|
||||
if (!(tv.tv_sec> last_sec+60))
|
||||
return strdup ("");
|
||||
return strdup ("");
|
||||
last_sec = tv.tv_sec;
|
||||
#endif
|
||||
|
||||
|
@ -1208,7 +1208,7 @@ char *get_random_hint (void)
|
|||
/* get a random entry */
|
||||
len = strlen (data);
|
||||
start = rand () % len;
|
||||
|
||||
|
||||
for (;start; start--){
|
||||
if (data [start] == '\n'){
|
||||
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)
|
||||
cd_path = copy_strings (machine, to_home ? "/~/" : NULL, NULL);
|
||||
else
|
||||
else
|
||||
cd_path = copy_strings (prefix, machine, to_home ? "/~/" : NULL, NULL);
|
||||
|
||||
|
||||
if (do_panel_cd (MENU_PANEL, cd_path, 0))
|
||||
directory_history_add (MENU_PANEL, (MENU_PANEL)->cwd);
|
||||
else
|
||||
|
@ -1277,7 +1277,7 @@ void source_routing (void)
|
|||
{
|
||||
char *source;
|
||||
struct hostent *hp;
|
||||
|
||||
|
||||
source = input_dialog (_(" Socket source routing setup "),
|
||||
_(" Enter host name to use as a source routing hop: ")n,
|
||||
"");
|
||||
|
@ -1310,7 +1310,7 @@ void quick_cd_cmd (void)
|
|||
|
||||
if (p && *p) {
|
||||
char *q = copy_strings ("cd ", p, NULL);
|
||||
|
||||
|
||||
do_cd_command (q);
|
||||
free (q);
|
||||
}
|
||||
|
@ -1350,7 +1350,7 @@ void dirsizes_cmd (void)
|
|||
strcpy (cmd, dirsizes_command);
|
||||
p = strchr (cmd, 0);
|
||||
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, "..")) {
|
||||
strcpy (p, panel->dir.list [i].fname);
|
||||
p = strchr (p, 0);
|
||||
|
@ -1361,8 +1361,8 @@ void dirsizes_cmd (void)
|
|||
f = popen (cmd, "r");
|
||||
free (cmd);
|
||||
if (f != NULL) {
|
||||
/* Assume that du will display the directories in the order
|
||||
* I've passed to it :(
|
||||
/* Assume that du will display the directories in the order
|
||||
* I've passed to it :(
|
||||
*/
|
||||
i = 0;
|
||||
p = xmalloc (1024, "dirsizes_cmd");
|
||||
|
@ -1379,8 +1379,8 @@ void dirsizes_cmd (void)
|
|||
if (!strncmp (q, panel->dir.list [i].fname,
|
||||
r - q)) {
|
||||
if (panel->dir.list [i].f.marked)
|
||||
panel->total += j -
|
||||
((panel->has_dir_sizes) ? panel->dir.list [i].buf.st_size : 0);
|
||||
panel->total += j -
|
||||
((panel->has_dir_sizes) ? panel->dir.list [i].buf.st_size : 0);
|
||||
panel->dir.list [i].buf.st_size = j;
|
||||
break;
|
||||
}
|
||||
|
@ -1393,7 +1393,7 @@ void dirsizes_cmd (void)
|
|||
message (0, _("Show directory sizes"), _("Pipe close failed"));
|
||||
else
|
||||
#else /* SCO_FLAVOR */
|
||||
/*
|
||||
/*
|
||||
** SCO reports about error while all seems to be ok. Just ignore it...
|
||||
** (alex@bcs.zaporizhzhe.ua)
|
||||
*/
|
||||
|
@ -1411,11 +1411,11 @@ void
|
|||
save_setup_cmd (void)
|
||||
{
|
||||
char *str;
|
||||
|
||||
|
||||
save_setup ();
|
||||
sync_profiles ();
|
||||
str = copy_strings ( _(" Setup saved to ~/"), PROFILE_NAME, NULL);
|
||||
|
||||
|
||||
#ifdef HAVE_GNOME
|
||||
set_hintbar (str);
|
||||
#else
|
||||
|
@ -1428,25 +1428,25 @@ void
|
|||
configure_panel_listing (WPanel *p, int view_type, int use_msformat, char *user, char *status)
|
||||
{
|
||||
int err;
|
||||
|
||||
p->user_mini_status = use_msformat;
|
||||
|
||||
p->user_mini_status = use_msformat;
|
||||
p->list_type = view_type;
|
||||
|
||||
|
||||
if (view_type == list_user || use_msformat){
|
||||
free (p->user_format);
|
||||
p->user_format = user;
|
||||
|
||||
|
||||
free (p->user_status_format [view_type]);
|
||||
p->user_status_format [view_type] = status;
|
||||
|
||||
|
||||
err = set_panel_formats (p);
|
||||
|
||||
|
||||
if (err){
|
||||
if (err & 0x01){
|
||||
free (p->user_format);
|
||||
p->user_format = strdup (DEFAULT_USER_FORMAT);
|
||||
}
|
||||
|
||||
|
||||
if (err & 0x02){
|
||||
free (p->user_status_format [view_type]);
|
||||
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);
|
||||
paint_panel (p);
|
||||
|
||||
|
||||
do_refresh ();
|
||||
}
|
||||
|
||||
|
@ -1541,7 +1541,7 @@ set_basic_panel_listing_to (int panel_index, int listing_mode)
|
|||
p->list_type = listing_mode;
|
||||
if (set_panel_formats (p))
|
||||
return 0;
|
||||
|
||||
|
||||
paint_panel (p);
|
||||
do_refresh ();
|
||||
return 1;
|
||||
|
@ -1554,7 +1554,7 @@ toggle_listing_cmd (void)
|
|||
WPanel *p = (WPanel *) get_panel_widget (current);
|
||||
int list_mode = p->list_type;
|
||||
int m;
|
||||
|
||||
|
||||
switch (list_mode){
|
||||
case list_full:
|
||||
case list_brief:
|
||||
|
|
|
@ -5,7 +5,7 @@ void ftplink_cmd (void);
|
|||
void undelete_cmd (void);
|
||||
void help_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 view_file (char *filename, int normal, int internal);
|
||||
void view_cmd (WPanel *panel);
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/* Color setup
|
||||
Copyright (C) 1994 Miguel de Icaza.
|
||||
|
||||
|
||||
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
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
|
@ -25,7 +25,7 @@
|
|||
#include "color.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 () */
|
||||
int hascolors = 0;
|
||||
|
@ -80,21 +80,21 @@ struct colorpair color_map [] = {
|
|||
{ "dfocus=", 0, 0 }, /* Dialog focused */
|
||||
{ "dhotnormal=", 0, 0 }, /* Dialog normal/hot */
|
||||
{ "dhotfocus=", 0, 0 }, /* Dialog focused/hot */
|
||||
|
||||
|
||||
{ "viewunderline=", 0, 0 }, /* _\b? sequence in view */
|
||||
{ "menusel=", 0, 0 }, /* Menu selected color */
|
||||
{ "menuhot=", 0, 0 }, /* Color for menu hotkeys */
|
||||
{ "menuhotsel=", 0, 0 }, /* Menu hotkeys/selected entry */
|
||||
|
||||
|
||||
{ "helpnormal=", 0, 0 }, /* Help normal */
|
||||
{ "helpitalic=", 0, 0 }, /* Italic in help */
|
||||
{ "helpbold=", 0, 0 }, /* Bold in help */
|
||||
{ "helplink=", 0, 0 }, /* Not selected hyperlink */
|
||||
{ "helpslink=", 0, 0 }, /* Selected hyperlink */
|
||||
|
||||
|
||||
{ "gauge=", 0, 0 }, /* Color of the progress bar (percentage) */
|
||||
{ "input=", 0, 0 },
|
||||
|
||||
|
||||
/* Per file types colors */
|
||||
{ "directory=", 0, 0 },
|
||||
{ "execute=", 0, 0 },
|
||||
|
@ -143,7 +143,7 @@ void get_color (char *cpp, CTYPE *colp);
|
|||
static void get_color (char *cpp, CTYPE *colp)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
for (i = 0; i < ELEMENTS(color_table); i++){
|
||||
if (strcmp (cpp, color_name (i)) == 0){
|
||||
*colp = color_value (i);
|
||||
|
@ -159,7 +159,7 @@ static void get_two_colors (char **cpp, struct colorpair *colorpairp)
|
|||
int state;
|
||||
|
||||
state = 0;
|
||||
|
||||
|
||||
for (; *p; p++){
|
||||
if (*p == ':'){
|
||||
*p = 0;
|
||||
|
@ -219,7 +219,7 @@ static void configure_colors (void)
|
|||
#ifndef HAVE_TK
|
||||
#ifndef HAVE_XVIEW
|
||||
extern char *default_edition_colors;
|
||||
|
||||
|
||||
configure_colors_string (default_edition_colors);
|
||||
#endif
|
||||
#endif
|
||||
|
@ -248,7 +248,7 @@ void
|
|||
init_colors (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
use_colors = 1;
|
||||
start_color ();
|
||||
configure_colors ();
|
||||
|
@ -260,7 +260,7 @@ init_colors (void)
|
|||
void init_colors (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
hascolors = has_colors ();
|
||||
|
||||
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
|
||||
of the terminal */
|
||||
char *Norm_Vid = SLtt_tgetstr ("me");
|
||||
|
||||
|
||||
if (Norm_Vid == NULL)
|
||||
Norm_Vid = SLtt_tgetstr ("se");
|
||||
if (Norm_Vid == NULL)
|
||||
Norm_Vid = "\033[0m";
|
||||
SLtt_set_color_esc (31, Norm_Vid);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
for (i = 0; i < ELEMENTS (color_map); i++){
|
||||
init_pair (i+1, color_map_fg(i), color_map_bg(i));
|
||||
|
|
|
@ -57,18 +57,18 @@ extern int attr_pairs [];
|
|||
#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_SLINK_COLOR (PORT_COLOR (MY_COLOR_PAIR(20),A_BOLD))
|
||||
|
||||
|
||||
extern int sel_mark_color [4];
|
||||
extern int dialog_colors [4];
|
||||
|
||||
|
||||
#define COLOR_NORMAL (PORT_COLOR (MY_COLOR_PAIR (8),A_REVERSE))
|
||||
#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_FOCUS (PORT_COLOR (MY_COLOR_PAIR (11),0))
|
||||
|
||||
|
||||
/* Add this to color panel, on BW all pairs are normal */
|
||||
#define STALLED_COLOR (PORT_COLOR (MY_COLOR_PAIR (12),0))
|
||||
|
||||
|
||||
#define DIRECTORY_COLOR (PORT_COLOR (MY_COLOR_PAIR (23),0))
|
||||
#define EXECUTABLE_COLOR (PORT_COLOR (MY_COLOR_PAIR (24),0))
|
||||
#define LINK_COLOR (PORT_COLOR (MY_COLOR_PAIR (25),0))
|
||||
|
|
|
@ -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
|
||||
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
|
||||
as they might expect :)
|
||||
as they might expect :)
|
||||
FIXME: Perhaps we should do wildcard matching as well? */
|
||||
static int examine_cd (char *path)
|
||||
{
|
||||
|
@ -99,7 +99,7 @@ static int examine_cd (char *path)
|
|||
}
|
||||
}
|
||||
*r = 0;
|
||||
|
||||
|
||||
result = do_cd (q, cd_parse_command);
|
||||
|
||||
/* CDPATH handling */
|
||||
|
@ -143,7 +143,7 @@ void do_cd_command (char *cmd)
|
|||
cmd [len] = 0;
|
||||
len --;
|
||||
}
|
||||
|
||||
|
||||
if (cmd [2] == 0)
|
||||
cmd = "cd ";
|
||||
|
||||
|
@ -180,7 +180,7 @@ void do_cd_command (char *cmd)
|
|||
static int enter (WCommand *cmdline)
|
||||
{
|
||||
Dlg_head *old_dlg;
|
||||
|
||||
|
||||
if (command_prompt && strlen (input_w (cmdline)->buffer)){
|
||||
char *cmd;
|
||||
|
||||
|
@ -203,7 +203,7 @@ static int enter (WCommand *cmdline)
|
|||
new_input (input_w (cmdline));
|
||||
return MSG_HANDLED;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
else {
|
||||
char *command, *s;
|
||||
int i, j;
|
||||
|
@ -232,7 +232,7 @@ static int enter (WCommand *cmdline)
|
|||
new_input (input_w (cmdline));
|
||||
execute (command);
|
||||
free (command);
|
||||
|
||||
|
||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||
if (quit & SUBSHELL_EXIT){
|
||||
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->input.widget.callback = (int (*) (Dlg_head *, void *, int, int))
|
||||
command_callback;
|
||||
|
||||
|
||||
cmd->input.completion_flags |= INPUT_COMPLETE_COMMANDS;
|
||||
return cmd;
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
/* Input line filename/username/hostname/variable/command completion.
|
||||
(Let mc type for you...)
|
||||
|
||||
|
||||
Copyright (C) 1995 The Free Software Foundation
|
||||
|
||||
|
||||
Written by: 1995 Jakub Jelinek
|
||||
|
||||
|
||||
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
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
|
@ -96,7 +96,7 @@ char *filename_completion_function (char *text, int state)
|
|||
|
||||
if (dirname)
|
||||
free (dirname);
|
||||
if (filename)
|
||||
if (filename)
|
||||
free (filename);
|
||||
if (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");
|
||||
struct stat tempstat;
|
||||
|
||||
|
||||
strcpy (tmp, dirname);
|
||||
strcat (tmp, PATH_SEP_STR);
|
||||
strcat (tmp, entry->d_name);
|
||||
|
@ -170,7 +170,7 @@ char *filename_completion_function (char *text, int state)
|
|||
if (!stat (tmp, &tempstat)){
|
||||
uid_t my_uid = getuid ();
|
||||
gid_t my_gid = getgid ();
|
||||
|
||||
|
||||
if (!S_ISDIR (tempstat.st_mode)){
|
||||
isdir = 0;
|
||||
if ((!my_uid && (tempstat.st_mode & 0111)) ||
|
||||
|
@ -268,7 +268,7 @@ char *username_completion_function (char *text, int state)
|
|||
return NULL;
|
||||
} else {
|
||||
char *temp = xmalloc (3 + strlen (entry->pw_name), "Username completion");
|
||||
|
||||
|
||||
*temp = '~';
|
||||
strcpy (temp + 1, entry->pw_name);
|
||||
strcat (temp, PATH_SEP_STR);
|
||||
|
@ -374,10 +374,10 @@ static void fetch_hosts (char *filename)
|
|||
name [i - start] = 0;
|
||||
{
|
||||
char **host_p;
|
||||
|
||||
|
||||
if (hosts_p - hosts >= hosts_alloclen){
|
||||
int j = hosts_p - hosts;
|
||||
|
||||
|
||||
hosts = realloc ((void *)hosts, ((hosts_alloclen += 30) + 1) * sizeof (char *));
|
||||
hosts_p = hosts + j;
|
||||
}
|
||||
|
@ -402,7 +402,7 @@ char *hostname_completion_function (char *text, int state)
|
|||
|
||||
if (!state){ /* Initialization stuff */
|
||||
char *p;
|
||||
|
||||
|
||||
if (hosts != NULL){
|
||||
for (host_p = hosts; *host_p; host_p++)
|
||||
free (*host_p);
|
||||
|
@ -416,7 +416,7 @@ char *hostname_completion_function (char *text, int state)
|
|||
textstart = (*text == '@') ? 1 : 0;
|
||||
textlen = strlen (text + textstart);
|
||||
}
|
||||
|
||||
|
||||
while (*host_p){
|
||||
if (!textlen)
|
||||
break; /* Match all of them */
|
||||
|
@ -424,7 +424,7 @@ char *hostname_completion_function (char *text, int state)
|
|||
break;
|
||||
host_p++;
|
||||
}
|
||||
|
||||
|
||||
if (!*host_p){
|
||||
for (host_p = hosts; *host_p; host_p++)
|
||||
free (*host_p);
|
||||
|
@ -460,13 +460,13 @@ char *command_completion_function (char *text, int state)
|
|||
"case", "esac", "for", "select", "while",
|
||||
"until", "do", "done", "in", "function" , 0};
|
||||
static char *bash_builtins [] = { "alias", "bg", "bind", "break", "builtin",
|
||||
"cd", "command", "continue", "declare",
|
||||
"cd", "command", "continue", "declare",
|
||||
"dirs", "echo", "enable", "eval", "exec",
|
||||
"exit", "export", "fc", "fg", "getopts",
|
||||
"hash", "help", "history", "jobs", "kill",
|
||||
"let", "local", "logout", "popd", "pushd",
|
||||
"pwd", "read", "readonly", "return", "set",
|
||||
"shift", "source", "suspend", "test",
|
||||
"shift", "source", "suspend", "test",
|
||||
"times", "trap", "type", "typeset",
|
||||
"ulimit", "umask", "unalias", "unset",
|
||||
"wait" , 0};
|
||||
|
@ -494,7 +494,7 @@ char *command_completion_function (char *text, int state)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isabsolute){
|
||||
p = filename_completion_function (text, state);
|
||||
if (!p)
|
||||
|
@ -502,7 +502,7 @@ char *command_completion_function (char *text, int state)
|
|||
return p;
|
||||
}
|
||||
|
||||
found = NULL;
|
||||
found = NULL;
|
||||
switch (phase){
|
||||
case 0: /* Reserved words */
|
||||
while (*words){
|
||||
|
@ -527,7 +527,7 @@ char *command_completion_function (char *text, int state)
|
|||
while (!found){
|
||||
if (!cur_word){
|
||||
char *expanded;
|
||||
|
||||
|
||||
if (!*cur_path)
|
||||
break;
|
||||
expanded = tilde_expand (cur_path);
|
||||
|
@ -553,7 +553,7 @@ char *command_completion_function (char *text, int state)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!found){
|
||||
look_for_executables = 0;
|
||||
if (path)
|
||||
|
@ -567,7 +567,7 @@ char *command_completion_function (char *text, int state)
|
|||
return p;
|
||||
}
|
||||
return found;
|
||||
|
||||
|
||||
}
|
||||
|
||||
int match_compare (const void *a, const void *b)
|
||||
|
@ -580,7 +580,7 @@ int match_compare (const void *a, const void *b)
|
|||
completions follows.
|
||||
You have to supply your own CompletionFunction with the word you
|
||||
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. */
|
||||
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;
|
||||
} else {
|
||||
int j;
|
||||
|
||||
|
||||
qsort (match_list + 1, matches, sizeof (char *), match_compare);
|
||||
|
||||
/* 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... */
|
||||
|
||||
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++)
|
||||
if (c1 != c2) break;
|
||||
|
||||
|
||||
if (!c1 && !match_list [j][si]){ /* Two equal strings */
|
||||
free (match_list [j]);
|
||||
j++;
|
||||
|
@ -660,10 +660,10 @@ char **completion_matches (char *text, CompletionFunction entry_function)
|
|||
int check_is_cd (char *text, int start, int flags)
|
||||
{
|
||||
char *p, *q = text + start;
|
||||
|
||||
|
||||
for (p = text; *p && p < q && (*p == ' ' || *p == '\t'); p++);
|
||||
if (((flags & INPUT_COMPLETE_COMMANDS) &&
|
||||
!strncmp (p, "cd", 2) && (p [2] == ' ' || p [2] == '\t') &&
|
||||
if (((flags & INPUT_COMPLETE_COMMANDS) &&
|
||||
!strncmp (p, "cd", 2) && (p [2] == ' ' || p [2] == '\t') &&
|
||||
p + 2 < q) ||
|
||||
(flags & INPUT_COMPLETE_CD))
|
||||
return 1;
|
||||
|
@ -700,7 +700,7 @@ char **try_complete (char *text, int *start, int *end, int flags)
|
|||
register int this_char, prev_char;
|
||||
|
||||
in_command_position++;
|
||||
|
||||
|
||||
if (i){
|
||||
/* Handle the two character tokens `>&', `<&', and `>|'.
|
||||
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, '`');
|
||||
if (flags & (INPUT_COMPLETE_COMMANDS | INPUT_COMPLETE_VARIABLES))
|
||||
q = strrchr (word, '$');
|
||||
if (flags & INPUT_COMPLETE_HOSTNAMES)
|
||||
if (flags & INPUT_COMPLETE_HOSTNAMES)
|
||||
r = strrchr (word, '@');
|
||||
if (q && q [1] == '(' && INPUT_COMPLETE_COMMANDS){
|
||||
if (q > p)
|
||||
p = q + 1;
|
||||
q = NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Command substitution? */
|
||||
if (p > q && p > r){
|
||||
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;
|
||||
}
|
||||
|
||||
/* Starts with '@', then look through the known hostnames for
|
||||
/* Starts with '@', then look through the known hostnames for
|
||||
completion first. */
|
||||
else if (r > p && r > q){
|
||||
matches = completion_matches (r, hostname_completion_function);
|
||||
if (matches)
|
||||
*start += r - word;
|
||||
}
|
||||
|
||||
|
||||
/* Starts with `~' and there is no slash in the word, then
|
||||
try completing this word as a username. */
|
||||
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. */
|
||||
if (!matches && in_command_position)
|
||||
matches = completion_matches (word, command_completion_function);
|
||||
|
||||
|
||||
else if (!matches && (flags & INPUT_COMPLETE_FILENAMES)){
|
||||
if (is_cd)
|
||||
ignore_filenames = 1;
|
||||
|
@ -769,7 +769,7 @@ char **try_complete (char *text, int *start, int *end, int flags)
|
|||
ignore_filenames = 0;
|
||||
if (!matches && is_cd && *word != PATH_SEP && *word != '~'){
|
||||
char *p, *q = text + *start;
|
||||
|
||||
|
||||
for (p = text; *p && p < q && (*p == ' ' || *p == '\t'); p++);
|
||||
if (!strncmp (p, "cd", 2))
|
||||
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, ':');
|
||||
if (s == NULL)
|
||||
s = strchr (cdpath, 0);
|
||||
c = *s;
|
||||
c = *s;
|
||||
*s = 0;
|
||||
if (*cdpath){
|
||||
r = concat_dir_and_file (cdpath, word);
|
||||
|
@ -800,7 +800,7 @@ char **try_complete (char *text, int *start, int *end, int flags)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (word)
|
||||
free (word);
|
||||
|
||||
|
@ -810,7 +810,7 @@ char **try_complete (char *text, int *start, int *end, int flags)
|
|||
void free_completions (WInput *in)
|
||||
{
|
||||
char **p;
|
||||
|
||||
|
||||
if (!in->completions)
|
||||
return;
|
||||
for (p=in->completions; *p; p++)
|
||||
|
@ -861,7 +861,7 @@ static int query_callback (Dlg_head * h, int Par, int Msg)
|
|||
dlg_erase (h);
|
||||
draw_box (h, 0, 0, query_height, query_width);
|
||||
break;
|
||||
|
||||
|
||||
case DLG_KEY:
|
||||
switch (Par) {
|
||||
case KEY_LEFT:
|
||||
|
@ -869,7 +869,7 @@ static int query_callback (Dlg_head * h, int Par, int Msg)
|
|||
h->ret_value = 0;
|
||||
dlg_stop (h);
|
||||
return 1;
|
||||
|
||||
|
||||
case 0177:
|
||||
case KEY_BACKSPACE:
|
||||
case XCTRL('h'):
|
||||
|
@ -879,7 +879,7 @@ static int query_callback (Dlg_head * h, int Par, int Msg)
|
|||
return 1;
|
||||
} else {
|
||||
WLEntry *e, *e1;
|
||||
|
||||
|
||||
e1 = e = ((WListbox *)(h->current->widget))->list;
|
||||
do {
|
||||
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);
|
||||
}
|
||||
return 1;
|
||||
|
||||
|
||||
default:
|
||||
if (Par > 0xff || !is_printable (Par)){
|
||||
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 low = 4096;
|
||||
char *last_text = NULL;
|
||||
|
||||
|
||||
e1 = e = ((WListbox *)(h->current->widget))->list;
|
||||
do {
|
||||
if (!strncmp (input->buffer + start, e1->text, end - start)){
|
||||
if (e1->text [end - start] == Par){
|
||||
if (need_redraw){
|
||||
register int c1, c2, si;
|
||||
|
||||
for (si = end - start + 1;
|
||||
|
||||
for (si = end - start + 1;
|
||||
(c1 = last_text [si]) &&
|
||||
(c2 = e1->text [si]); si++)
|
||||
if (c1 != c2)
|
||||
break;
|
||||
if (low > si)
|
||||
if (low > si)
|
||||
low = si;
|
||||
last_text = e1->text;
|
||||
need_redraw = 2;
|
||||
|
@ -988,7 +988,7 @@ int complete_engine (WInput *in, int what_to_do)
|
|||
char **p, *q;
|
||||
Dlg_head *query_dlg;
|
||||
WListbox *query_list;
|
||||
|
||||
|
||||
for (p=in->completions + 1; *p; count++, p++)
|
||||
if ((i = strlen (*p)) > maxlen)
|
||||
maxlen = i;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/* Client interface for General purpose Linux console save/restore server
|
||||
Copyright (C) 1994 Janne Kukonlehto <jtklehto@stekt.oulu.fi>
|
||||
|
||||
|
||||
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
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
|
@ -194,7 +194,7 @@ void handle_console (unsigned char action)
|
|||
#endif /* #ifdef linux */
|
||||
|
||||
#ifdef SCO_FLAVOR
|
||||
/*
|
||||
/*
|
||||
** SCO console save/restore handling routines
|
||||
** Copyright (C) 1997 Alex Tkachenko <alex@bcs.zaporizhzhe.ua>
|
||||
*/
|
||||
|
@ -271,7 +271,7 @@ console_save()
|
|||
{
|
||||
struct vt_mode smode;
|
||||
|
||||
/*
|
||||
/*
|
||||
** User switched out of our vt. Let's wait until we get SIG_ACQUIRE,
|
||||
** otherwise we could save wrong screen image
|
||||
*/
|
||||
|
@ -364,7 +364,7 @@ handle_console (unsigned char action)
|
|||
console_init();
|
||||
break;
|
||||
|
||||
case CONSOLE_DONE:
|
||||
case CONSOLE_DONE:
|
||||
console_shutdown();
|
||||
break;
|
||||
|
||||
|
|
|
@ -6,12 +6,12 @@
|
|||
This code requires root privileges.
|
||||
You may want to make the cons.saver setuid root.
|
||||
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
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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 */
|
||||
|
||||
*msg = 0;
|
||||
|
||||
|
||||
fd = open (filename, O_RDWR);
|
||||
if (fd == -1)
|
||||
return -1;
|
||||
|
||||
|
||||
if (fstat (fd, &stat_buf) == -1)
|
||||
return -1;
|
||||
|
||||
|
@ -125,19 +125,19 @@ int check_file (char *filename, int check_console, char **msg)
|
|||
*msg = "Not a console";
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if ((stat_buf.st_rdev & 0x00ff) > 63){
|
||||
*msg = "Minor device number too big";
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/* Must be owned by the user */
|
||||
if (stat_buf.st_uid != getuid ()){
|
||||
*msg = "Not a owner";
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Everything seems to be okay */
|
||||
return fd;
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ char *detect_console (void)
|
|||
{
|
||||
char *msg;
|
||||
int xlen;
|
||||
|
||||
|
||||
/* Must be console */
|
||||
/* Handle the case for /dev/tty?? */
|
||||
if (tty_name[len-5] == 't')
|
||||
|
@ -174,7 +174,7 @@ char *detect_console (void)
|
|||
#ifdef DEBUG
|
||||
fprintf (stderr, "vcs_fd = %d console_fd = %d\n", vcs_fd, console_fd);
|
||||
#endif
|
||||
|
||||
|
||||
if (vcs_fd != -1){
|
||||
console_flag = 3;
|
||||
}
|
||||
|
@ -269,9 +269,9 @@ void send_contents ()
|
|||
unsigned char message;
|
||||
unsigned short bytes;
|
||||
int bytes_per_char;
|
||||
|
||||
|
||||
bytes_per_char = console_flag == 1 ? 1 : 2;
|
||||
|
||||
|
||||
/* Calculate the number of used lines */
|
||||
if (console_flag == 2 || console_flag == 1 || console_flag == 3){
|
||||
index = (2 + rows * columns) * bytes_per_char;
|
||||
|
@ -327,7 +327,7 @@ int main (int argc, char **argv)
|
|||
|
||||
/* Lose the control terminal */
|
||||
setsid ();
|
||||
|
||||
|
||||
/* Check that the argument is a legal console */
|
||||
tty_name = argv [1];
|
||||
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 (console_flag == 3)
|
||||
close (console_fd);
|
||||
|
||||
|
||||
/* Inform the invoker about the result of the tests */
|
||||
write (cmd_output, &console_flag, 1);
|
||||
|
||||
|
@ -374,14 +374,14 @@ int main (int argc, char **argv)
|
|||
send_contents ();
|
||||
break;
|
||||
} /* switch (action) */
|
||||
|
||||
|
||||
/* Inform the invoker that command is handled */
|
||||
write (cmd_output, &console_flag, 1);
|
||||
} /* while (read ...) */
|
||||
|
||||
if (buffer)
|
||||
free (buffer);
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/* Dialog managing.
|
||||
Copyright (C) 1994 Miguel de Icaza.
|
||||
|
||||
|
||||
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
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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 "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;
|
||||
|
||||
|
@ -54,7 +54,7 @@ void push_refresh (void (*new_refresh)(void *), void *parameter, int flags)
|
|||
void pop_refresh (void)
|
||||
{
|
||||
Refresh *old;
|
||||
|
||||
|
||||
if (!refresh_list)
|
||||
fprintf (stderr, _("\n\n\nrefresh stack underflow!\n\n\n"));
|
||||
else {
|
||||
|
@ -71,7 +71,7 @@ static void do_complete_refresh (Refresh *refresh_list)
|
|||
|
||||
if (refresh_list->flags != REFRESH_COVERS_ALL)
|
||||
do_complete_refresh (refresh_list->next);
|
||||
|
||||
|
||||
(*(refresh_list->refresh_fn))(refresh_list->parameter);
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ void my_wputs (int y, int x, char *text)
|
|||
while ((p = *text++) != 0){
|
||||
if (p == '\n')
|
||||
move (++y, x);
|
||||
else
|
||||
else
|
||||
addch ((unsigned char)p);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/* Directory routines
|
||||
Copyright (C) 1994 Miguel de Icaza.
|
||||
|
||||
|
||||
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
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
|
@ -33,7 +33,7 @@
|
|||
#include "tree.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 */
|
||||
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 bd = MY_ISDIR (b);
|
||||
|
||||
|
||||
if (ad == bd || mix_all_files)
|
||||
return string_sortcomp (a->fname, b->fname) * reverse;
|
||||
return bd-ad;
|
||||
|
@ -115,7 +115,7 @@ sort_owner (const file_entry *a, const file_entry *b)
|
|||
{
|
||||
int ad = MY_ISDIR (a);
|
||||
int bd = MY_ISDIR (b);
|
||||
|
||||
|
||||
if (ad == bd || mix_all_files)
|
||||
return string_sortcomp (get_owner (a->buf.st_uid), get_owner (a->buf.st_uid)) * reverse;
|
||||
return bd-ad;
|
||||
|
@ -126,7 +126,7 @@ sort_group (const file_entry *a, const file_entry *b)
|
|||
{
|
||||
int ad = MY_ISDIR (a);
|
||||
int bd = MY_ISDIR (b);
|
||||
|
||||
|
||||
if (ad == bd || mix_all_files)
|
||||
return string_sortcomp (get_group (a->buf.st_gid), get_group (a->buf.st_gid)) * reverse;
|
||||
return bd-ad;
|
||||
|
@ -232,7 +232,7 @@ inline static int
|
|||
file_type_to_num (const file_entry *fe)
|
||||
{
|
||||
const struct stat *s = &fe->buf;
|
||||
|
||||
|
||||
if (S_ISDIR (s->st_mode))
|
||||
return 0;
|
||||
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 bb = file_type_to_num (b);
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
char buffer [MC_MAXPATHLEN + MC_MAXPATHLEN];
|
||||
char *p, *s;
|
||||
int i = 0;
|
||||
|
||||
|
||||
/* Need to grow the *list? */
|
||||
if (index == list->size) {
|
||||
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].f.link_to_dir = 0;
|
||||
(list->list) [index].f.stalled_link = 0;
|
||||
|
||||
|
||||
/* FIXME: We need to get the panel definition! to use file_mark */
|
||||
(list->list) [index].f.marked = 0;
|
||||
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))
|
||||
tree_check (dp->d_name);
|
||||
|
||||
|
||||
/* A link to a file or a directory? */
|
||||
*link_to_dir = 0;
|
||||
*stalled_link = 0;
|
||||
|
@ -409,9 +409,9 @@ int handle_dirent (dir_list *list, char *filter, struct dirent *dp,
|
|||
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.
|
||||
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. */
|
||||
/* Return values: -1 = failure, 0 = don't add, 1 = add to the list */
|
||||
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))
|
||||
tree_check (path);
|
||||
|
||||
|
||||
/* A link to a file or a directory? */
|
||||
*link_to_dir = 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;
|
||||
|
||||
start_tree_check (NULL);
|
||||
|
||||
|
||||
dirp = mc_opendir (".");
|
||||
if (!dirp){
|
||||
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;
|
||||
list->list [next_free].fnamelen = NLENGTH (dp);
|
||||
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.link_to_dir = link_to_dir;
|
||||
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
|
||||
return set_zero_dir (list);
|
||||
|
||||
|
||||
mc_closedir (dirp);
|
||||
end_tree_check (NULL);
|
||||
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)
|
||||
{
|
||||
struct stat b;
|
||||
|
||||
|
||||
if (S_ISLNK (file->buf.st_mode)){
|
||||
mc_stat (file->fname, &b);
|
||||
if (S_ISDIR (b.st_mode))
|
||||
|
@ -508,7 +508,7 @@ int link_isdir (file_entry *file)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int if_link_is_exe (file_entry *file)
|
||||
{
|
||||
struct stat b;
|
||||
|
@ -525,7 +525,7 @@ static dir_list dir_copy = { 0, 0 };
|
|||
static void alloc_dir_copy (int size)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
if (dir_copy.size < size){
|
||||
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;
|
||||
struct stat buf;
|
||||
int tmp_len; /* For optimisation */
|
||||
int dotdot_found = 0;
|
||||
int dotdot_found = 0;
|
||||
|
||||
start_tree_check (NULL);
|
||||
dirp = mc_opendir (".");
|
||||
|
@ -584,19 +584,19 @@ int do_reload_dir (dir_list *list, sortfn *sort, int count, int rev,
|
|||
continue;
|
||||
if (status == -1) {
|
||||
mc_closedir (dirp);
|
||||
/* Norbert (Feb 12, 1997):
|
||||
/* Norbert (Feb 12, 1997):
|
||||
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
|
||||
this point he will have more problems than a few memory
|
||||
leaks and because one 'clean_dir' would not be enough (and
|
||||
because I don't want to spent the time to make it working,
|
||||
IMHO it's not worthwhile).
|
||||
because I don't want to spent the time to make it working,
|
||||
IMHO it's not worthwhile).
|
||||
clean_dir (&dir_copy, count);
|
||||
*/
|
||||
return next_free;
|
||||
}
|
||||
|
||||
|
||||
tmp_len = NLENGTH (dp);
|
||||
for (found = i = 0; i < count; i++)
|
||||
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;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (!found)
|
||||
list->list [next_free].f.marked = 0;
|
||||
|
||||
|
||||
list->list [next_free].fnamelen = tmp_len;
|
||||
list->list [next_free].fname = strdup (dp->d_name);
|
||||
list->list [next_free].cache = NULL;
|
||||
|
|
|
@ -13,7 +13,7 @@ typedef struct {
|
|||
struct stat buf;
|
||||
|
||||
/* Flags */
|
||||
struct {
|
||||
struct {
|
||||
unsigned int marked:1; /* File marked in pane window */
|
||||
unsigned int exists:1; /* Use for rereading file */
|
||||
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
|
||||
int handle_dirent (dir_list *list, char *filter, struct dirent *dp,
|
||||
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);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
|
||||
#include <config.h>
|
||||
/* "$Id: dlg.c,v 1.1 2001/12/30 09:55:26 sedwards Exp $" */
|
||||
/* "$Id$" */
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
|
@ -37,7 +37,7 @@
|
|||
#include "dlg.h"
|
||||
#include "dialog.h" /* For push_refresh() and pop_refresh() */
|
||||
#include "layout.h"
|
||||
#include "main.h"
|
||||
#include "main.h"
|
||||
|
||||
/* This is the current frame, used to group Tk packings */
|
||||
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)
|
||||
{
|
||||
extern int slow_terminal;
|
||||
|
||||
|
||||
if (slow_terminal){
|
||||
slow_box (h, y, x, ys, xs);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#ifndef HAVE_SLANG
|
||||
waddc (h, y, x, ACS_ULCORNER);
|
||||
hline (ACS_HLINE, xs - 2);
|
||||
|
@ -154,7 +154,7 @@ void init_widget (Widget *w, int y, int x, int lines, int cols,
|
|||
abort ();
|
||||
}
|
||||
/* 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)
|
||||
|
@ -166,20 +166,20 @@ int default_proc (Dlg_head *h, int Msg, int Par)
|
|||
|
||||
case WIDGET_INIT: /* We could tell if something went wrong */
|
||||
return 1;
|
||||
|
||||
|
||||
case WIDGET_KEY:
|
||||
return 0; /* Didn't use the key */
|
||||
|
||||
|
||||
case WIDGET_FOCUS: /* We accept FOCUSes */
|
||||
if (h->current)
|
||||
x_focus_widget (h->current);
|
||||
return 1;
|
||||
|
||||
|
||||
case WIDGET_UNFOCUS: /* We accept loose FOCUSes */
|
||||
if (h->current)
|
||||
x_unfocus_widget (h->current);
|
||||
return 1;
|
||||
|
||||
|
||||
case WIDGET_DRAW:
|
||||
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);
|
||||
else
|
||||
new_d->wdata = xtoolkit_get_main_dialog (new_d);
|
||||
#endif
|
||||
#endif
|
||||
return (new_d);
|
||||
}
|
||||
|
||||
|
||||
void set_idle_proc (Dlg_head *d, int state)
|
||||
{
|
||||
d->send_idle_msg = state;
|
||||
|
@ -266,7 +266,7 @@ int add_widgetl (Dlg_head *where, void *what, WLay layout)
|
|||
|
||||
/* Only used by Tk */
|
||||
widget->frame = the_frame;
|
||||
|
||||
|
||||
widget->layout = layout;
|
||||
/* Don't accept 0 widgets, this could be from widgets that could not */
|
||||
/* initialize properly */
|
||||
|
@ -303,16 +303,16 @@ int add_widgetl (Dlg_head *where, void *what, WLay layout)
|
|||
where->current->next = where->current;
|
||||
where->first = where->current;
|
||||
}
|
||||
|
||||
|
||||
where->current->prev = where->first;
|
||||
where->last = where->current;
|
||||
where->first->next = where->last;
|
||||
|
||||
|
||||
}
|
||||
where->current->dlg_id = where->count;
|
||||
where->current->widget = what;
|
||||
where->current->widget->parent = where;
|
||||
|
||||
|
||||
where->count++;
|
||||
|
||||
/* 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)
|
||||
{
|
||||
Widget_Item *first, *p;
|
||||
|
||||
|
||||
first = p = h->current;
|
||||
|
||||
|
||||
do {
|
||||
if (p->widget == what){
|
||||
/* Remove links to this Widget_Item */
|
||||
p->prev->next = p->next;
|
||||
p->next->prev = p->prev;
|
||||
|
||||
|
||||
/* Make sure h->current is always valid */
|
||||
if (p == h->current){
|
||||
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)
|
||||
return;
|
||||
|
||||
|
||||
if (reverse)
|
||||
first = p = h->current->prev;
|
||||
else
|
||||
|
@ -434,13 +434,13 @@ static void select_a_widget (Dlg_head *h, int down)
|
|||
|
||||
if (!down)
|
||||
direction = !direction;
|
||||
|
||||
|
||||
do {
|
||||
if (direction)
|
||||
h->current = h->current->next;
|
||||
else
|
||||
h->current = h->current->prev;
|
||||
|
||||
|
||||
(*h->callback) (h, h->current->dlg_id, DLG_ONE_DOWN);
|
||||
} while (!dlg_focus (h));
|
||||
}
|
||||
|
@ -466,7 +466,7 @@ Widget *find_widget_type (Dlg_head *h, callback_fn signature)
|
|||
|
||||
if (!h)
|
||||
return 0;
|
||||
|
||||
|
||||
w = 0;
|
||||
for (i = 0, item = h->current; i < h->count; i++, item = item->next){
|
||||
if (item->widget->callback == signature){
|
||||
|
@ -485,7 +485,7 @@ void dlg_one_up (Dlg_head *h)
|
|||
/* If it accepts unFOCUSion */
|
||||
if (!dlg_unfocus(h))
|
||||
return;
|
||||
|
||||
|
||||
select_a_widget (h, 0);
|
||||
if (dlg_overlap (old->widget, h->current->widget)){
|
||||
send_message (h, h->current->widget, WIDGET_DRAW, 0);
|
||||
|
@ -501,7 +501,7 @@ void dlg_one_down (Dlg_head *h)
|
|||
if (!dlg_unfocus (h))
|
||||
return;
|
||||
|
||||
select_a_widget (h, 1);
|
||||
select_a_widget (h, 1);
|
||||
if (dlg_overlap (old->widget, h->current->widget)){
|
||||
send_message (h, h->current->widget, WIDGET_DRAW, 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);
|
||||
else {
|
||||
Widget_Item *p = h->current;
|
||||
|
||||
|
||||
do {
|
||||
if (p->widget->options & W_WANT_CURSOR)
|
||||
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);
|
||||
|
||||
dlg_broadcast_msg (h, WIDGET_DRAW, 1);
|
||||
|
||||
|
||||
update_cursor (h);
|
||||
}
|
||||
|
||||
|
@ -579,7 +579,7 @@ void dlg_refresh (void *parameter)
|
|||
void dlg_stop (Dlg_head *h)
|
||||
{
|
||||
h->running = 0;
|
||||
x_dialog_stop (h);
|
||||
x_dialog_stop (h);
|
||||
}
|
||||
|
||||
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:
|
||||
dlg_one_up (h);
|
||||
break;
|
||||
|
||||
|
||||
case KEY_RIGHT:
|
||||
case KEY_DOWN:
|
||||
dlg_one_down (h);
|
||||
|
@ -607,7 +607,7 @@ static INLINE void dialog_handle_key (Dlg_head *h, int d_key)
|
|||
case XCTRL('z'):
|
||||
suspend_cmd ();
|
||||
/* Fall through */
|
||||
|
||||
|
||||
case XCTRL('l'):
|
||||
#ifndef HAVE_SLANG
|
||||
/* Use this if the refreshes fail */
|
||||
|
@ -619,7 +619,7 @@ static INLINE void dialog_handle_key (Dlg_head *h, int d_key)
|
|||
mc_refresh ();
|
||||
doupdate ();
|
||||
break;
|
||||
|
||||
|
||||
case '\n':
|
||||
case KEY_ENTER:
|
||||
h->ret_value = B_ENTER;
|
||||
|
@ -643,7 +643,7 @@ static int dlg_try_hotkey (Dlg_head *h, int d_key)
|
|||
Widget_Item *previous;
|
||||
int handled, c;
|
||||
extern input_event ();
|
||||
|
||||
|
||||
/*
|
||||
* Explanation: we don't send letter hotkeys to other widgets if
|
||||
* 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))
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* If it's an alt key, send the message */
|
||||
c = d_key & ~ALT(0);
|
||||
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 */
|
||||
if (d_key == 0) return 0;
|
||||
#endif
|
||||
|
||||
|
||||
handled = 0;
|
||||
if (h->current->widget->options & W_WANT_HOTKEY)
|
||||
handled = callback (h) (h, h->current->widget, WIDGET_HOTKEY, d_key);
|
||||
|
||||
|
||||
/* If not used, send hotkey to other widgets */
|
||||
if (handled)
|
||||
return handled;
|
||||
|
||||
|
||||
hot_cur = h->current;
|
||||
|
||||
|
||||
/* send it to all widgets */
|
||||
do {
|
||||
if (hot_cur->widget->options & W_WANT_HOTKEY)
|
||||
handled |= (*hot_cur->widget->callback)
|
||||
(h, hot_cur->widget, WIDGET_HOTKEY, d_key);
|
||||
|
||||
|
||||
if (!handled)
|
||||
hot_cur = hot_cur->next;
|
||||
} while (h->current != hot_cur && !handled);
|
||||
|
||||
|
||||
if (!handled)
|
||||
return 0;
|
||||
|
||||
|
@ -691,7 +691,7 @@ static int dlg_try_hotkey (Dlg_head *h, int d_key)
|
|||
previous = h->current;
|
||||
if (!dlg_unfocus (h))
|
||||
return handled;
|
||||
|
||||
|
||||
h->current = hot_cur;
|
||||
if (!dlg_focus (h)){
|
||||
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)
|
||||
{
|
||||
int handled;
|
||||
|
||||
|
||||
/* TAB used to cycle */
|
||||
if (!h->raw && (d_key == '\t' || d_key == KEY_BTAB))
|
||||
if (d_key == '\t')
|
||||
|
@ -711,22 +711,22 @@ void dlg_key_event (Dlg_head *h, int d_key)
|
|||
else
|
||||
dlg_one_up (h);
|
||||
else {
|
||||
|
||||
|
||||
/* first can dlg_callback handle the key */
|
||||
handled = (*h->callback) (h, d_key, DLG_KEY);
|
||||
|
||||
/* next try the hotkey */
|
||||
if (!handled)
|
||||
handled = dlg_try_hotkey (h, d_key);
|
||||
|
||||
|
||||
/* not used - then try widget_callback */
|
||||
if (!handled)
|
||||
handled |= callback (h)(h, h->current->widget, WIDGET_KEY, d_key);
|
||||
|
||||
|
||||
/* not used- try to use the unhandled case */
|
||||
if (!handled)
|
||||
handled |= (*h->callback) (h, d_key, DLG_UNHANDLED_KEY);
|
||||
|
||||
|
||||
if (!handled)
|
||||
dialog_handle_key (h, d_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;
|
||||
|
||||
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)))
|
||||
continue;
|
||||
|
||||
|
@ -777,7 +777,7 @@ void init_dlg (Dlg_head *h)
|
|||
int refresh_mode;
|
||||
|
||||
tk_end_frame ();
|
||||
|
||||
|
||||
/* Initialize dialog manager and widgets */
|
||||
(*h->callback) (h, 0, DLG_INIT);
|
||||
dlg_broadcast_msg (h, WIDGET_INIT, 0);
|
||||
|
@ -788,23 +788,23 @@ void init_dlg (Dlg_head *h)
|
|||
refresh_mode = REFRESH_COVERS_PART;
|
||||
push_refresh (dlg_refresh, h, refresh_mode);
|
||||
h->refresh_pushed = 1;
|
||||
|
||||
|
||||
/* Initialize direction */
|
||||
if (!h->direction)
|
||||
h->current = h->first;
|
||||
|
||||
|
||||
if (h->initfocus != NULL)
|
||||
h->current = h->initfocus;
|
||||
|
||||
h->previous_dialog = current_dlg;
|
||||
current_dlg = h;
|
||||
|
||||
|
||||
/* Initialize the mouse status */
|
||||
h->mouse_status = 0;
|
||||
|
||||
/* Redraw the screen */
|
||||
dlg_redraw (h);
|
||||
|
||||
|
||||
while (!dlg_focus (h))
|
||||
h->current = h->current->next;
|
||||
|
||||
|
@ -830,7 +830,7 @@ void dlg_process_event (Dlg_head *h, int key, Gpm_Event *event)
|
|||
else
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (key == EV_MOUSE)
|
||||
h->mouse_status = dlg_mouse_event (h, event);
|
||||
else
|
||||
|
@ -854,7 +854,7 @@ frontend_run_dlg (Dlg_head *h)
|
|||
if (is_idle ()){
|
||||
if (idle_hook)
|
||||
execute_hooks (idle_hook);
|
||||
|
||||
|
||||
while (h->send_idle_msg && is_idle ()){
|
||||
(*h->callback) (h, 0, DLG_IDLE);
|
||||
}
|
||||
|
@ -891,7 +891,7 @@ destroy_dlg (Dlg_head *h)
|
|||
Widget_Item *c;
|
||||
|
||||
if (h->refresh_pushed)
|
||||
pop_refresh ();
|
||||
pop_refresh ();
|
||||
|
||||
x_destroy_dlg_start (h);
|
||||
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;
|
||||
int should_focus = 0;
|
||||
|
||||
|
||||
do {
|
||||
if (p->widget == old){
|
||||
|
||||
if (old == h->current->widget)
|
||||
should_focus = 1;
|
||||
|
||||
|
||||
/* We found the widget */
|
||||
/* First kill the widget */
|
||||
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)
|
||||
{
|
||||
char *s = strdup (frame);
|
||||
|
||||
|
||||
if (frame [strlen (frame)-1] != '.'){
|
||||
fprintf (stderr, "Invalid frame name\n");
|
||||
exit (1);
|
||||
}
|
||||
s [strlen (frame)-1] = 0;
|
||||
the_frame = frame;
|
||||
|
||||
|
||||
if (new_frame)
|
||||
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
Loading…
Reference in a new issue