#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]"),
_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
TCHAR buffer[10240];
int len;
TCHAR* ptr = buffer;
-
+
*ptr = '\0';
if (QueryDosDevice(NULL, buffer, NUM_ELEMENTS(buffer))) {
while (*ptr != '\0') {
return 0;
}
-static
+static
BOOL SerialPortQuery(int nPortNum, LPDCB pDCB, LPCOMMTIMEOUTS pCommTimeouts, BOOL bWrite)
{
BOOL result;
return 0;
}
-static
+static
int ExtractModeSerialParams(const TCHAR* param)
{
if ( _tcsstr(param, _T("OFF"))) {
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();
-/*
+/*
* 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.
*/
-/*
+/*
* TEE.C - external command.
*
* clone from 4nt tee command
*
* 01 Sep 1999 - Paolo Pantaleo <paolopan@freemail.it>
- * started
+ * started
*
*
*/
/*handle for file and console*/
HANDLE hConsoleIn,hConsoleOut;
-
+
/*bytes written by WriteFile and ReadFile*/
DWORD dwRead,dwWritten;
INT i;
BOOL bQuote;
- /*file list implementation*/
+ /*file list implementation*/
LPTSTR *files;
INT iFileCounter=0;
HANDLE *hFile;
/*
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;
}
*/
/*open file(s)*/
for(i=0;i<iFileCounter;i++)
- {
+ {
//l=0;
hFile[i] = CreateFile(files[i],GENERIC_WRITE,
0,NULL,
{
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. */
*p++ = '\0';
t->tm_sec = ATOI2(p);
}
-
+
yearset = 0;
switch(strlen(arg)) {
case 12: /* CCYYMMDDhhmm */
for (i = 1; i < argc; i++)
{
hFind=FindFirstFile(argv[i],&FindData);
-
+
if (hFind==INVALID_HANDLE_VALUE)
{
ConErrPrintf("File not found - %s\n",argv[i]);
if (dwRead>0 && bRet)
WriteFile(hConsoleOut,buff,dwRead,&dwWritten,NULL);
-
+
} while(dwRead>0 && bRet);
CloseHandle(hFile);
* 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.
*****************************************************************************/
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;
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;
start_y = j;
start_dir = wall;
sqnum = 0;
-
+
/* set end square */
wall = (wall + 2)%4;
switch (wall) {
{
register int i, newdoor = 0;
HDC hDC;
-
+
hDC = GetDC(hWnd);
do {
move_list[sqnum].x = cur_sq_x;
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;
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;
save_path[i].dir = move_list[i].dir;
}
}
-
+
} while (1);
-
+
}
{
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;
goto rightwall;
}
candidates[num_candidates++] = 0;
-
+
rightwall:
/* right wall */
if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_RIGHT )
goto bottomwall;
}
candidates[num_candidates++] = 1;
-
+
bottomwall:
/* bottom wall */
if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_BOTTOM )
goto leftwall;
}
candidates[num_candidates++] = 2;
-
+
leftwall:
/* left wall */
if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_LEFT )
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) ] );
-
+
}
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;
{
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);
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:
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;
}
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);
/* 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++;
} 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;
//
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <tchar.h>
-
+
#include "main.h"
#include "framewnd.h"
#include <tchar.h>
#include <stdlib.h>
#include <stdio.h>
-
+
#include "main.h"
#include "framewnd.h"
// 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;
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);
}
DfInFocus = p1 ? wnd : NULL;
if (DfIsVisible(wnd))
DfSendMessage(wnd, DFM_BORDER, 0, 0);
- else
+ else
DfSendMessage(wnd, DFM_SHOW_WINDOW, 0, 0);
}
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);
{
if (DfGetClass(wnd) == DF_DIALOG)
return ((DF_DBOX *)(wnd->extension))->HelpName;
- else
+ else
return "Untitled";
}
else
* 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 )
cp = strrchr(path, '\\');
if (cp == NULL)
cp = path;
- else
+ else
cp++;
strcpy(cp, DFlatApplication);
strcat(cp, ext);
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);
{
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];
}
}
DfGetItemText(wnd, DF_ID_PATH, FileSpec, 65);
strcat(FileSpec, FileName);
}
- else
+ else
strcpy(FileSpec, FileName);
}
break;
}
static int ExtendSelections(DFWINDOW wnd, int sel, int shift)
-{
+{
if (shift & (DF_LEFTSHIFT | DF_RIGHTSHIFT) &&
wnd->AnchorPoint != -1) {
int i = sel;
case DF_ID_PRINT:
PrintPad(DfInFocus);
return TRUE;
- case DF_ID_EXIT:
+ case DF_ID_EXIT:
if (!DfYesNoBox("Exit Memopad?"))
return FALSE;
break;
FixTabMenu();
return TRUE;
case DF_ID_TAB6:
- DfCfg.Tabs = 6;
+ DfCfg.Tabs = 6;
FixTabMenu();
return TRUE;
case DF_ID_TAB8:
}
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 --- */
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:
#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;
if (mwnd != NULL)
DfSendMessage(wnd, DFM_MB_SELECTION,
DfActiveMenuBar->ActiveSelection, 0);
- else
+ else
DfSendMessage(wnd, DFM_PAINT, 0, 0);
break;
case DF_BS:
if (mwnd != NULL)
DfSendMessage(wnd, DFM_MB_SELECTION,
DfActiveMenuBar->ActiveSelection, 0);
- else
+ else
DfSendMessage(wnd, DFM_PAINT, 0, 0);
break;
default:
while (EventQueueCtr > 0)
{
struct events ev;
-
+
ev = EventQueue[EventQueueOffCtr];
if (++EventQueueOffCtr == DF_MAXMESSAGES)
EventQueueOffCtr = 0;
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);
coll = 0;
else if (rc.lf+x == rcc.rt)
coll = 2;
- else
+ else
coll = 1;
}
}
coll = 0;
else if (rc.tp+y == rcc.bt)
coll = 2;
- else
+ else
coll = 1;
}
}
case DF_F1:
if (ActivePopDown == NULL)
DfSendMessage(DfGetParent(wnd), DFM_KEYBOARD, p1, p2);
- else
+ else
DfDisplayHelp(wnd,
(ActivePopDown+wnd->selection)->help);
return TRUE;
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);
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;
if (*(lp+i) && i < wnd->wleft+3) {
if (wnd->wleft+4 > lnlen)
trunc = TRUE;
- else
+ else
lp += 4;
}
else {
#define IDM_HELP_ABOUT 40006
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 105
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);
}
inFocus = p1 ? wnd : NULL;
if (isVisible(wnd))
DfSendMessage(wnd, BORDER, 0, 0);
- else
+ else
DfSendMessage(wnd, SHOW_WINDOW, 0, 0);
}
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);
{
if (GetClass(wnd) == DIALOG)
return ((DBOX *)(wnd->extension))->HelpName;
- else
+ else
return "Untitled";
}
else
cp = strrchr(path, '\\');
if (cp == NULL)
cp = path;
- else
+ else
cp++;
strcpy(cp, DFlatApplication);
strcat(cp, ext);
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);
{
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];
}
}
-/*
+/*
* ReactOS DFLAT32.DLL
*/
}
static int ExtendSelections(DFWINDOW wnd, int sel, int shift)
-{
+{
if (shift & (LEFTSHIFT | RIGHTSHIFT) &&
wnd->AnchorPoint != -1) {
int i = sel;
if (mwnd != NULL)
DfSendMessage(wnd, MB_SELECTION,
ActiveMenuBar->ActiveSelection, 0);
- else
+ else
DfSendMessage(wnd, PAINT, 0, 0);
break;
case BS:
if (mwnd != NULL)
DfSendMessage(wnd, MB_SELECTION,
ActiveMenuBar->ActiveSelection, 0);
- else
+ else
DfSendMessage(wnd, PAINT, 0, 0);
break;
default:
while (EventQueueCtr > 0)
{
struct events ev;
-
+
ev = EventQueue[EventQueueOffCtr];
if (++EventQueueOffCtr == MAXMESSAGES)
EventQueueOffCtr = 0;
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);
coll = 0;
else if (rc.lf+x == rcc.rt)
coll = 2;
- else
+ else
coll = 1;
}
}
coll = 0;
else if (rc.tp+y == rcc.bt)
coll = 2;
- else
+ else
coll = 1;
}
}
case F1:
if (ActivePopDown == NULL)
DfSendMessage(GetParent(wnd), KEYBOARD, p1, p2);
- else
+ else
DisplayHelp(wnd,
(ActivePopDown+wnd->selection)->help);
return TRUE;
if ((int)p1 == CTRL_F4)
return TRUE;
break;
- case PAINT:
+ case PAINT:
if (!isVisible(wnd))
break;
statusbar = DFcalloc(1, WindowWidth(wnd)+1);
/* 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
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;
/* 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
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>
#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
#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
/* 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
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>
#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 */
#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
/* 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
/*
*
* 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
* ______________________________________|______________________________________
* file end|||file beginning
* |
* |
- *
+ *
* _
* This_is_some_file
* fin.
/* 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;
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\96linefeed (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\96linefeed (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){
dir = strdup (edit->dir);
else
dir = 0;
-
+
edit_clean (edit);
if (!edit_init (edit, lines, columns, 0, "", dir, 0))
return 0;
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)
{
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++)
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
# 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>
# 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>
# include <time.h>
# endif
# endif
-
+
# include "regex.h"
#endif
# include "../src/menu.h"
# include "../src/regex.h"
# define WANT_WIDGETS
-
+
# define WIDGET_COMMAND (WIDGET_USER + 10)
# define N_menus 5
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 */
# 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)
# 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
# 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)
KEY_F (17), CK_Find_Again,
ALT ('<'), CK_Beginning_Of_Text,
ALT ('>'), CK_End_Of_Text,
-
+
0, 0};
static long key_pad_map[10] =
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)) */
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;
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;
}
/* 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)
{
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
edit->modified = 0;
#ifdef MIDNIGHT
edit->delete_file = 0;
-#endif
+#endif
return 1;
}
}
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);
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},
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)
}
} 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');
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;
case -1:
return;
}
- }
+ }
#ifdef MIDNIGHT
else if (edit->delete_file)
unlink (catstrs (edit->dir, edit->filename, 0));
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: "), "");
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));
}
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;
}
} 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;
extern int fixed_font;
void rerender_text (CWidget * wdt);
-
+
void edit_status (WEdit * edit)
{
if ((edit->widget->options & EDITOR_NO_TEXT)) {
#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;
#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)
{
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) {
}
}
-/*
+/*
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>
#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"
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>
#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
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;
WCheck *check;
} check_perm[PERMISSIONS] = {
- {
+ {
FILE_ARCHIVED, N_("Archive"), 0, 0,
},
{
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, \
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:
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;
apply_mask (sf_stat);
break;
-
+
case B_SETMRK:
and_mask = or_mask = 0;
and_mask = ~and_mask;
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:
/* 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
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.
unsigned char end_line)
{
COORD c0 = { 0, 0 };
- COORD csize;
+ COORD csize;
SMALL_RECT rect;
CHAR_INFO *pchar;
/* FIXME: this should've work,
but refresh() is called after this write :-( */
win32APICALL(WriteConsoleOutput (hNew, pchar, csize, c0, &rect));
-
+
free (pchar);
}
/* 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
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>
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;
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();
dd_dir->d_size = wfd.nFileSizeLow;
strcpy (dd_dir->d_name, wfd.cFileName);
dd_dir->d_first = 1;
-
+
free (c_dir);
return 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) {
dd_dir->d_size = wfd.nFileSizeLow;
strcpy (dd_dir->d_name, wfd.cFileName);
return dd_dir;
-}
+}
int closedir (DIR *dd_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,
case ERROR_BUFFER_OVERFLOW:
errno = ENOMEM;
break;
- default:
+ default:
errno = EINVAL;
break;
}
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;
}
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);
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)
{
/* 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
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>
#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;
/* 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;
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);
#else
rtn = DosSetDefaultDisk(nNewDrive + 1);
#endif
- if (rtn == -1)
+ if (rtn == -1)
errocc = 1;
else {
getcwd (this_panel->cwd, sizeof (this_panel->cwd)-2);
}
void drive_cmd_b()
-{
+{
this_panel = right_panel;
drive_cmd();
}
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
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)
{ 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 },
{ 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
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;
}
{
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;
}
if (!dw)
return 0;
}
-
+
do {
win32APICALL(ReadConsoleInput(hConsoleInput, &ir, 1, &dw));
switch (ir.EventType) {
evSaved_Event.type = GPM_DOWN | GPM_DOUBLE;
break;
};
- return 0;
+ return 0;
}
} while (!no_delay);
return 0;
dirty++;
vfs_timeout_handler ();
-
+
c = block ? getch_with_delay () : get_key_code (1);
if (!c) {
{
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)
{
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
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.
*/
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
{ KEY_F(11), 0x85 },
{ KEY_F(12), 0x86 },
{ 0, 0}
-};
+};
struct {
{ ALT(KEY_F(11)), 0x8B },
{ ALT(KEY_F(12)), 0x8C },
{ 0, 0}
-};
+};
struct {
{ KEY_HOME, 0x47 },
{ KEY_END, 0x4F },
{ 0, 0}
-};
+};
/* init_key -- to make linker happy */
{
if (!seq_append)
seq_append = seq_buffer;
-
+
if (seq_append == &(seq_buffer [sizeof (seq_buffer)-2]))
return 0;
*(seq_append++) = c;
if (inp_ch == 0) {
return 0;
}
- }
+ }
if (no_delay) {
return (VKtoCurses(inp_ch));
{
int ctrlState = 0;
int altState = 0;
-
+
int fsState;
char scanCode;
char asciiCode;
scanCode = (char) ((a_vkc & 0x0000FFFF) >> 8);
asciiCode = (char) (a_vkc & 0x000000FF);
-
+
ctrlState = (fsState & CTRL_PRESSED);
altState = (fsState & ALT_PRESSED);
/* 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);
}
}
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 */
{
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)
{
/* 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
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 ();
}
last_x = SLsmg_get_column ();
last_y = SLsmg_get_row ();
-
+
if (ch == 0)
ch = ACS_HLINE;
/* 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 */
SLsmg_set_color (color);
return;
}
-
+
if (color & A_BOLD){
if (color == A_BOLD)
SLsmg_set_color (A_BOLD);
else
SLsmg_set_color (color);
}
-
+
void load_terminfo_keys ()
{
}
/* 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
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
#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;
/*
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()
_win32_tracing_started = 0;
if (__win32_trace_f)
fclose (__win32_trace_f);
- }
+ }
}
#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.
*/
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
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.
*/
/* ------------------------------------------------------------------------------------------ *
/************************/
/* 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__)
#define TraceOff _win32TraceOff
/* Global variables */
-extern int __win32_tracing_enabled;
+extern int __win32_tracing_enabled;
#else
/************************/
/************************/
/* 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;
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
/* .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);
#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:
*/
char* get_default_shell()
{
- if (win32_GetPlatform() == OS_WinNT)
+ if (win32_GetPlatform() == OS_WinNT)
return "cmd.exe";
else
return "command.com";
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])) {
}
#ifndef USE_VFS
-/*
+/*
int mc_rmdir (char *path);
Fix for Win95 UGLY BUG in rmdir: it will return ENOACCESS instead
of ENOTEMPTY.
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
}
}
if (rc == TRUE) return 0;
- else
+ else
return -1;
}
#endif /*USE_VFS*/
/* 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;
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();
/* FAKE functions */
-int
+int
look_for_exe(const char* pathname)
{
int j;
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;
}
return 0;
}
-int
+int
lstat (const char* pathname, struct stat *buffer)
{
int rc = stat (pathname, buffer);
return rc;
}
-int getuid ()
+int getuid ()
{
/* SID sid;
LookupAccountName (NULL, &sid...
return 0;
}
-int getgid ()
+int getgid ()
{
return 0;
}
// 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) {
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 */
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
/* 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];
}
-static int
+static int
StartWindowsProg (char *name, SHORT type)
{
#if 0 /* FIXME: PM DDL's should be loaded (or not loaded) at run time */
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! */
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;
if (command[i] == ' ') {
temp[i] = (char) 0;
length--;
- } else
+ } else
break;
}
if (i==-1) {
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;
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;
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";
sizeof(searchResult));
}
free (line);
- } else {
+ } else {
/* Just search */
rc = DosSearchPath((SEARCH_IGNORENETERRS | SEARCH_ENVIRONMENT | SEARCH_CUR_DIRECTORY),
(PSZ) pathValue,
} 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) ;
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])) {
}
-void
+void
my_statfs (struct my_statfs *myfs_stats, char *path)
{
PFSALLOCATE pBuf;
/* 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 */
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;
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);
/* FAKE functions */
-int
+int
look_for_exe(const char* pathname)
{
int j;
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;
}
return 0;
}
-int
+int
lstat (const char* pathname, struct stat *buffer)
{
int rc = stat (pathname, 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;
return NULL;
}
-int
+int
vfs_current_is_extfs (void)
{
return 0;
}
-int
+int
vfs_file_is_ftp (char *filename)
{
return 0;
/* 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! */
}
return ret;
}
-
+
int
mc_chmod(char *pathName, int unxmode)
{
case ERROR_INVALID_PARAMETER:
errCode = EINVAL;
break;
- default:
+ default:
errCode = EINVAL;
break;
}
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);
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,
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
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>
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 ()
{
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;
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
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 */
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
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>
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.
}
-int geteuid ()
+int geteuid ()
{
if (winnt_IsAdministrator())
return 0;
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.
*/
/* 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.
*/
{
unsigned char main_type;
unsigned char sub_type;
- union
+ union
{
struct SLBlock_Type *blk;
int i_blk;
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
*/
#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.
*/
#ifdef HAVE_MEMORY_H
# include <memory.h>
-#endif
+#endif
#ifndef SLMEMSET
# ifdef HAVE_MEMSET
/* -*- 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.
*/
# 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))
# 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);
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);
#ifdef float64
# undef float64
#endif
-
+
#ifndef FLOAT64_TYPEDEFED
# define FLOAT64_TYPEDEFED
typedef double float64;
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.
*/
{
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.. */
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;
# define NO_PROTOTYPES
# endif
#endif
-
-#ifndef NO_PROTOTYPES
+
+#ifndef NO_PROTOTYPES
# define _PROTO(x) x
#else
# define _PROTO(x) ()
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;
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.. */
}
SLuser_Object_Type;
-
+
/*}}}*/
/*{{{ Interpreter Function Prototypes */
/* 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;
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. */
/* 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 */
/* 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 *);
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.
/* 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 *);
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. */
extern void SLang_push_string(char *);
/* Push string p1 onto stack */
-
+
extern void SLang_push_integer(int);
/* push integer p1 on stack */
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 *);
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:
* 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 *);
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.
*/
/*}}}*/
/*{{{ 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;
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.
*/
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.
*/
/* 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 */
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 */
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 */
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.
*/
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;
/*}}}*/
#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;
#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);
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 *);
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;
/* 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 */
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;
/* 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);
}
SLscroll_Type;
-typedef struct
+typedef struct
{
unsigned int flags;
SLscroll_Type *top_window_line; /* list element at top of window */
/* 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
#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
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);
} 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.
*/
/* 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.
*/
* characters) can not be written directly to the terminal, when the
* alt-char-set is activated, because writing these characters doesn't cause
* an implicit/temporary switching-back to the standard char-set!
- *
+ *
* The original code in SLang assumes that space, NL, CR, etc. can be
* printed when alt-char-set is activated. If SLTT_TRANSP_ACS_PATCH is
* defined, the modified code will not use this assumption.
- * [Remark: the patch-code is not the most exact solution, but works...]
+ * [Remark: the patch-code is not the most exact solution, but works...]
*/
/*#define SLTT_TRANSP_ACS_PATCH 1*/
#include <signal.h>
-/* Colors: These definitions are used for the display. However, the
+/* Colors: These definitions are used for the display. However, the
* application only uses object handles which get mapped to this
* internal representation. The mapping is performed by the Color_Map
* structure below. */
static int Worthless_Highlight;
#define HP_GLITCH_CODE
#ifdef HP_GLITCH_CODE
-/* This glitch is exclusive to HP term. Basically it means that to clear
+/* This glitch is exclusive to HP term. Basically it means that to clear
* attributes, one has to erase to the end of the line.
*/
static int Has_HP_Glitch;
/* It is crucial that JMAX_COLORS must be less than 128 since the high bit
* is used to indicate a character from the ACS (alt char set). The exception
- * to this rule is if SLtt_Use_Blink_For_ACS is true. This means that of
- * the highbit is set, we interpret that as a blink character. This is
+ * to this rule is if SLtt_Use_Blink_For_ACS is true. This means that of
+ * the highbit is set, we interpret that as a blink character. This is
* exploited by DOSemu.
*/
#define JMAX_COLORS 256
#define JNORMAL_COLOR 0
-typedef struct
+typedef struct
{
SLtt_Char_Type fgbg;
SLtt_Char_Type mono;
#define RGB1(r, g, b) ((r) | ((g) << 1) | ((b) << 2))
#define RGB(r, g, b, br, bg, bb) ((RGB1(r, g, b) << 8) | (RGB1(br, bg, bb) << 16))
-static Ansi_Color_Type Ansi_Color_Map[JMAX_COLORS] =
+static Ansi_Color_Type Ansi_Color_Map[JMAX_COLORS] =
{
{RGB(1, 1, 1, 0, 0, 0), 0x00000000, NULL}, /* white/black */
{RGB(0, 1, 0, 0, 0, 0), SLTT_REV_MASK, NULL}, /* green/black */
static char *Color_Escape_Sequence = "\033[3%dm\033[4%dm";
#else
/* Believe it or not, this is what is in the linux terminfo database. It
- * produces the same escape sequence but it is much more CPU intensive.
+ * produces the same escape sequence but it is much more CPU intensive.
* Why not just encode it as "\033[3%p1%dm\033[4%p2%dm" ???
*/
/* static char *Color_Escape_Sequence = "\033[%p1%{30}%+%dm\033[%p2%{40}%+%dm"; */
char *SLtt_Graphics_Char_Pairs; /* ac termcap string -- def is vt100 */
-
+
/* 1 if terminal lacks the ability to do into insert mode or into delete
mode. Currently controlled by S-Lang but later perhaps termcap. */
int nwrite = 0;
unsigned int total;
int n = (int) (Output_Bufferp - Output_Buffer);
-
+
SLtt_Num_Chars_Output += n;
-
+
total = 0;
while (n > 0)
{
{
nwrite = 0;
#ifdef EAGAIN
- if (errno == EAGAIN)
+ if (errno == EAGAIN)
{
sl_usleep (100000); /* 1/10 sec */
continue;
static int total;
unsigned long now;
unsigned int ndiff;
-
+
if ((str == NULL) || (n == 0)) return;
total += n;
-
+
while (1)
{
ndiff = MAX_OUTPUT_BUFFER_SIZE - (int) (Output_Bufferp - Output_Buffer);
n -= ndiff;
str += ndiff;
}
- else
+ else
{
SLMEMCPY ((char *) Output_Bufferp, str, n);
Output_Bufferp += n;
break;
}
}
-
+
if (((SLtt_Baud_Rate > 150) && (SLtt_Baud_Rate <= 9600))
&& (10 * total > SLtt_Baud_Rate))
{
#ifdef SLTT_TRANSP_ACS_PATCH
int restore_acs = 0;
#endif
-
+
SLtt_normal_video ();
if (Cursor_Set == 1)
{
if (ch >= ' ') Cursor_c++;
#ifndef SLTT_TRANSP_ACS_PATCH
else if (ch == '\b') Cursor_c--;
-#else
+#else
if (ch <= ' ' && SLtt_ACS_Active)
{
SLtt_set_alt_char_set (0);
#endif
else if (ch == '\r') Cursor_c = 0;
else Cursor_Set = 0;
-
- if ((Cursor_c + 1 == SLtt_Screen_Cols)
+
+ if ((Cursor_c + 1 == SLtt_Screen_Cols)
&& Automatic_Margins) Cursor_Set = 0;
}
-
+
if (Output_Bufferp < Output_Buffer + MAX_OUTPUT_BUFFER_SIZE)
{
*Output_Bufferp++ = (unsigned char) ch;
}
else tt_write (&ch, 1);
-
+
#ifdef SLTT_TRANSP_ACS_PATCH
if (restore_acs)
{
#endif
}
-/* this is supposed to be fast--- also handles
+/* this is supposed to be fast--- also handles
termcap: %d, &i, %., %+, %r strings as well as terminfo stuff */
static unsigned int tt_sprintf(char *buf, char *fmt, int x, int y)
{
int stack[10];
int i = 0, z;
stack[0] = y; stack[1] = x; i = 2;
-
+
b = (unsigned char *) buf;
if (fmt != NULL) while ((ch = *f++) != 0)
{
if (ch != '%') *b++ = ch;
- else
+ else
{
ch = *f++;
if (tinfo)
/* map it to termcap. Since this is terminfo,
* it must be one of:
* %2d, %3d, %02d, %03d
- *
+ *
* I am assuming that a terminal that understands
* %2d form will also understand the %02d form. These
* only differ by a space padding the field.
*/
-
+
/* skip the 'd'-- hope it is there */
- if (ch == '0')
+ if (ch == '0')
{
ch = *f;
f += 2;
else f++;
}
}
-
+
switch (ch)
{
case 'p':
ch = *f++;
if (ch == '1') stack[i++] = x; else stack[i++] = y;
break;
-
+
case '\'': /* 'x' */
stack[i++] = *f++;
f++;
break;
-
+
case '{': /* literal constant, e.g. {30} */
z = 0;
while (((ch = *f) <= '9') && (ch >= '0'))
stack[i++] = z;
if (ch == '}') f++;
break;
-
+
case 'd':
case '2':
case '3':
z = z % 100;
goto ten;
}
- else if (ch == 3)
+ else if (ch == 3)
{
*b++ = '0';
ch = '2';
}
-
+
if (z >= 10)
{
ten:
z = z % 10;
}
else if (ch == 2) *b++ = '0';
-
+
*b++ = z + '0';
break;
-
+
case 'i':
offset = 1;
break;
-
+
case '+':
- if (tinfo)
+ if (tinfo)
{
z = stack[--i];
stack[i-1] += z;
*b++ = ch;
}
break;
-
+
case 'r':
stack[0] = x;
stack[1] = y;
break;
-
+
case '.':
case 'c':
ch = (unsigned char) stack[--i];
if (ch == '\n') ch++;
*b++ = ch;
break;
-
+
default:
*b++ = ch;
}
{
if ((Cursor_Visible_Str == NULL) || (Cursor_Invisible_Str == NULL))
return -1;
-
+
SLtt_write_string (show ? Cursor_Visible_Str : Cursor_Invisible_Str);
return 0;
}
-
+
/* the goto_rc function moves to row relative to scrolling region */
void SLtt_goto_rc(int r, int c)
{
#ifdef SLTT_TRANSP_ACS_PATCH
int check_alt_acs = 0;
#endif
-
+
if (c < 0)
{
c = -c - 1;
Cursor_Set = 0;
}
-
+
/* if (No_Move_In_Standout && Current_Fgbg) SLtt_normal_video (); */
r += Scroll_r1;
-
+
if ((Cursor_Set > 0) || ((Cursor_Set < 0) && !Automatic_Margins))
{
n = r - Cursor_r;
- if ((n == -1) && (Cursor_Set > 0) && (Cursor_c == c)
+ if ((n == -1) && (Cursor_Set > 0) && (Cursor_c == c)
&& (Curs_Up_Str != NULL))
{
s = Curs_Up_Str;
}
else if ((n >= 0) && (n <= 4))
{
- if ((n == 0) && (Cursor_Set == 1)
+ if ((n == 0) && (Cursor_Set == 1)
&& ((c > 1) || (c == Cursor_c)))
{
if (Cursor_c == c) return;
- if (Cursor_c == c + 1)
+ if (Cursor_c == c + 1)
{
s = buf;
*s++ = '\b'; *s = 0;
}
/* Will fail on VMS */
#ifndef VMS
- else if (SLtt_Newline_Ok && (Cursor_Set == 1) &&
+ else if (SLtt_Newline_Ok && (Cursor_Set == 1) &&
(Cursor_c >= c) && (c + 3 > Cursor_c))
{
s = buf;
#ifdef SLTT_TRANSP_ACS_PATCH
int restore_acs = 0;
#endif
-
+
if (n <= 0) return;
SLtt_normal_video ();
if (Del_N_Lines_Str != NULL) tt_printf(Del_N_Lines_Str,n, 0);
void SLtt_reverse_index (int n)
{
if (!n) return;
-
+
SLtt_normal_video();
if (Add_N_Lines_Str != NULL) tt_printf(Add_N_Lines_Str,n, 0);
else
void SLtt_beep (void)
{
if (SLtt_Ignore_Beep & 0x1) SLtt_putchar('\007');
-
+
if (SLtt_Ignore_Beep & 0x2)
{
if (Visible_Bell_Str != NULL) SLtt_write_string (Visible_Bell_Str);
if ((obj < 0) || (obj >= JMAX_COLORS))
{
return;
- }
+ }
Ansi_Color_Map[obj].mono = mask & ATTR_MASK;
}
{
unsigned int i, ich;
char *s = color;
-
+
i = 0;
while ((ich = (int) *s) != 0)
{
if ((ich < '0') || (ich > '9'))
return color;
-
+
i = i * 10 + (ich - '0');
s++;
}
-
+
if (i < MAX_COLOR_NAMES)
color = Color_Defs[i].name;
-
+
return color;
}
static char fg_buf[16], bg_buf[16], *bg, *fg;
static int already_parsed;
char *p, *pmax;
-
+
if (already_parsed == -1)
return -1;
*bgp = bg;
return 0;
}
-
+
already_parsed = -1;
-
+
bg = getenv ("COLORFGBG");
if (bg == NULL)
if (bg == NULL)
return -1;
}
-
+
p = fg_buf;
pmax = p + (sizeof (fg_buf) - 1);
-
+
while ((*bg != 0) && (*bg != ';'))
{
if (p < pmax) *p++ = *bg;
bg++;
}
*p = 0;
-
+
if (*bg) bg++;
-
+
p = bg_buf;
pmax = p + (sizeof (bg_buf) - 1);
-
+
/* Mark suggested allowing for extra spplication specific stuff following
* the background color. That is what the check for the semi-colon is for.
*/
void SLtt_set_color_object (int obj, SLtt_Char_Type attr)
{
char *cust_esc;
-
+
if ((obj < 0) || (obj >= JMAX_COLORS)) return;
-
+
cust_esc = Ansi_Color_Map[obj].custom_esc;
- if (cust_esc != NULL)
+ if (cust_esc != NULL)
{
SLFREE (cust_esc);
FgBg_Stats[(Ansi_Color_Map[obj].fgbg >> 8) & 0x7F] -= 1;
Ansi_Color_Map[obj].custom_esc = NULL;
}
-
+
Ansi_Color_Map[obj].fgbg = attr;
if (obj == 0) Color_0_Modified = 1;
}
void SLtt_add_color_attribute (int obj, SLtt_Char_Type attr)
{
if ((obj < 0) || (obj >= JMAX_COLORS)) return;
-
+
Ansi_Color_Map[obj].fgbg |= (attr & ATTR_MASK);
if (obj == 0) Color_0_Modified = 1;
}
static SLtt_Char_Type fb_to_fgbg (SLtt_Char_Type f, SLtt_Char_Type b)
-{
+{
SLtt_Char_Type attr = 0;
if ((f & 0xF0) == 0)
f &= 0x7;
}
else f = 9;
-
+
if ((b & 0xF0) == 0)
{
if (b & 0x8) attr |= SLTT_BLINK_MASK;
b &= 0x7;
}
else b = 9;
-
+
return ((f << 8) | (b << 16) | attr);
}
SLtt_Char_Type f = 0xFFFFFFFFU, b = 0xFFFFFFFFU;
char *dfg, *dbg;
unsigned int i;
-
+
if ((fg != NULL) && (*fg == 0)) fg = NULL;
if ((bg != NULL) && (*bg == 0)) bg = NULL;
-
+
if ((fg == NULL) || (bg == NULL))
{
if (-1 == get_default_colors (&dfg, &dbg))
return -1;
-
+
if (fg == NULL) fg = dfg;
if (bg == NULL) bg = dbg;
}
-
+
for (i = 0; i < MAX_COLOR_NAMES; i++)
{
if (strcmp(fg, Color_Defs[i].name)) continue;
b = Color_Defs[i].color;
break;
}
-
+
if ((f == 0xFFFFFFFFU) || (b == 0xFFFFFFFFU))
return -1;
-
+
*fgbg = fb_to_fgbg (f, b);
return 0;
}
char *cust_esc;
SLtt_Char_Type fgbg = 0;
int i;
-
+
if ((obj < 0) || (obj >= JMAX_COLORS))
{
return;
}
-
+
cust_esc = Ansi_Color_Map[obj].custom_esc;
- if (cust_esc != NULL)
+ if (cust_esc != NULL)
{
SLFREE (cust_esc);
FgBg_Stats[(Ansi_Color_Map[obj].fgbg >> 8) & 0x7F] -= 1;
}
-
+
cust_esc = (char *) SLMALLOC (strlen(esc) + 1);
if (cust_esc != NULL) strcpy (cust_esc, esc);
-
+
Ansi_Color_Map[obj].custom_esc = cust_esc;
if (cust_esc == NULL) fgbg = 0;
else
for (i = 0; i < JMAX_COLORS; i++)
{
if (FgBg_Stats[i] == 0) fgbg = i;
-
+
if (obj == i) continue;
if ((Ansi_Color_Map[i].custom_esc) == NULL) continue;
if (!strcmp (Ansi_Color_Map[i].custom_esc, cust_esc))
}
FgBg_Stats[fgbg] += 1;
}
-
+
fgbg |= 0x80;
Ansi_Color_Map[obj].fgbg = (fgbg | (fgbg << 8)) << 8;
if (obj == 0) Color_0_Modified = 1;
if (SLtt_Has_Alt_Charset == 0) return;
if (i == last_i) return;
SLtt_write_string (i ? Start_Alt_Chars_Str : End_Alt_Chars_Str );
- /* if (i) Current_Fgbg |= SLTT_ALTC_MASK;
+ /* if (i) Current_Fgbg |= SLTT_ALTC_MASK;
else Current_Fgbg &= ~SLTT_ALTC_MASK; */
last_i = i;
#ifdef SLTT_TRANSP_ACS_PATCH
if (Worthless_Highlight) return;
if (fgbg == Current_Fgbg) return;
-
+
/* Before spitting out colors, fix attributes */
if ((fgbg & ATTR_MASK) != (Current_Fgbg & ATTR_MASK))
{
{
SLtt_write_string(Norm_Vid_Str);
/* In case normal video turns off ALL attributes: */
- if (fgbg & SLTT_ALTC_MASK)
+ if (fgbg & SLTT_ALTC_MASK)
Current_Fgbg &= ~SLTT_ALTC_MASK;
SLtt_set_alt_char_set (0);
}
-
- if ((fgbg & SLTT_ALTC_MASK)
+
+ if ((fgbg & SLTT_ALTC_MASK)
!= (Current_Fgbg & SLTT_ALTC_MASK))
{
SLtt_set_alt_char_set ((int) (fgbg & SLTT_ALTC_MASK));
}
-
+
if (fgbg & SLTT_ULINE_MASK) SLtt_write_string (UnderLine_Vid_Str);
if (fgbg & SLTT_BOLD_MASK) SLtt_bold_video ();
if (fgbg & SLTT_REV_MASK) SLtt_write_string (Rev_Vid_Str);
if (SLtt_Blink_Mode) SLtt_write_string (Blink_Vid_Str);
}
}
-
+
if (SLtt_Use_Ansi_Colors)
{
fg0 = (int) GET_FG(fgbg);
{
SLtt_Char_Type fgbg;
char *esc;
-
+
if (Worthless_Highlight) return;
if ((color < 0) || (color >= JMAX_COLORS)) return;
-
+
if (Video_Initialized == 0)
{
if (color == JNORMAL_COLOR)
Current_Fgbg = 0xFFFFFFFFU;
return;
}
-
- if (SLtt_Use_Ansi_Colors)
+
+ if (SLtt_Use_Ansi_Colors)
{
fgbg = Ansi_Color_Map[color].fgbg;
if ((esc = Ansi_Color_Map[color].custom_esc) != NULL)
static void write_string_with_care (char *str)
{
unsigned int len;
-
+
if (str == NULL) return;
-
+
len = strlen (str);
if (Automatic_Margins && (Cursor_r + 1 == SLtt_Screen_Rows))
{
register SLtt_Char_Type attr;
register unsigned short sh;
int color, last_color = -1;
-
+
p = out;
while (0 != (sh = *s++))
{
{
if (SLtt_Use_Ansi_Colors) attr = Ansi_Color_Map[color & 0x7F].fgbg;
else attr = Ansi_Color_Map[color & 0x7F].mono;
-
+
/* sh => color */
if (color & 0x80) /* alternate char set */
{
{
if (SLtt_Blink_Mode) attr |= SLTT_BLINK_MASK;
}
- else attr |= SLTT_ALTC_MASK;
+ else attr |= SLTT_ALTC_MASK;
}
-
-
+
+
if (attr != Current_Fgbg)
{
#ifndef SLTT_TRANSP_ACS_PATCH
Current_Fgbg = attr;
}
else write_attributes (attr);
-
+
last_color = color;
}
}
static void forward_cursor (unsigned int n, int row)
{
char buf[30];
-
-
- if (n <= 4)
+
+
+ if (n <= 4)
{
SLtt_normal_video ();
SLMEMSET (buf, ' ', n);
}
-#define SPACE_CHAR (0x20 | (JNORMAL_COLOR << 8))
+#define SPACE_CHAR (0x20 | (JNORMAL_COLOR << 8))
void SLtt_smart_puts(unsigned short *neww, unsigned short *oldd, int len, int row)
{
#ifdef HP_GLITCH_CODE
int handle_hp_glitch = 0;
#endif
-
+
q = oldd; p = neww;
qmax = oldd + len;
pmax = p + len;
-
+
/* Find out where to begin --- while they match, we are ok */
while (1)
{
if (q == qmax) return;
#if SLANG_HAS_KANJI_SUPPORT
- if (*p & 0x80)
+ if (*p & 0x80)
{ /* new is kanji */
if ((*q & 0x80) && ((q + 1) < qmax))
{ /* old is also kanji */
if (((0xFF & *q) != (0xFF & *p))
|| ((0xFF & q[1]) != (0xFF & p[1])))
break; /* both kanji, but not match */
-
- else
+
+ else
{ /* kanji match ! */
if (!COLOR_EQS(*q, *p)) break;
q++; p++;
}
else break; /* old is not kanji */
}
- else
+ else
{ /* new is not kanji */
if (*q & 0x80) break; /* old is kanji */
}
}
#endif
/* Find where the last non-blank character on old/new screen is */
-
+
while (qmax > q)
{
qmax--;
- if (!CHAR_EQS(*qmax, SPACE_CHAR))
+ if (!CHAR_EQS(*qmax, SPACE_CHAR))
{
qmax++;
break;
}
}
-
+
while (pmax > p)
{
pmax--;
break;
}
}
-
+
last_buffered_match = buf = buffer; /* buffer is empty */
#ifdef HP_GLITCH_CODE
{
if (CHAR_EQS(*q,SPACE_CHAR) && CHAR_EQS(*p, SPACE_CHAR))
{
- /* If *q is not a space, we would have to overwrite it.
- * However, if *q is a space, then while *p is also one,
+ /* If *q is not a space, we would have to overwrite it.
+ * However, if *q is a space, then while *p is also one,
* we only need to skip over the blank field.
*/
space_match = p;
p++; q++;
- while ((p < pmax)
- && CHAR_EQS(*q,SPACE_CHAR)
+ while ((p < pmax)
+ && CHAR_EQS(*q,SPACE_CHAR)
&& CHAR_EQS(*p, SPACE_CHAR))
{
p++;
#if SLANG_HAS_KANJI_SUPPORT
if ((*p & 0x80) && ((p + 1) < pmax))
{ /* new is kanji */
- if (*q & 0x80)
+ if (*q & 0x80)
{ /* old is also kanji */
- if (((0xFF & *q) != (0xFF & *p))
+ if (((0xFF & *q) != (0xFF & *p))
|| ((0xFF & q[1]) != (0xFF & p[1])))
{
/* both kanji, but not match */
q += 2;
continue;
}
- else
+ else
{ /* kanji match ? */
- if (!COLOR_EQS(*q, *p) || !COLOR_EQS(*(q+1), *(p+1)))
+ if (!COLOR_EQS(*q, *p) || !COLOR_EQS(*(q+1), *(p+1)))
{
/* code is match ,but color is diff */
*buf++ = *p++;
break;
}
}
- else
+ else
{ /* old is not kanji */
*buf++ = *p++;
*buf++ = *p++;
continue;
}
}
- else
+ else
{ /* new is not kanji */
- if (*q & 0x80)
+ if (*q & 0x80)
{ /* old is kanji */
*buf++ = *p++;
q++;
q++;
}
*buf = 0;
-
+
if (buf != buffer) send_attr_str (buffer);
buf = buffer;
-
- if (n_spaces && (p < pmax))
+
+ if (n_spaces && (p < pmax))
{
forward_cursor (n_spaces, row);
}
-
- /* Now we overwrote what we could and cursor is placed at position
- * of a possible match of new and old. If this is the case, skip
+
+ /* Now we overwrote what we could and cursor is placed at position
+ * of a possible match of new and old. If this is the case, skip
* some more.
*/
-#if !SLANG_HAS_KANJI_SUPPORT
+#if !SLANG_HAS_KANJI_SUPPORT
while ((p < pmax) && CHAR_EQS(*p, *q))
{
*buf++ = *p++;
}
#else
/* Kanji */
- while (p < pmax)
+ while (p < pmax)
{
if ((*p & 0x80) && ((p + 1) < pmax))
{ /* new is kanji */
- if (*q & 0x80)
+ if (*q & 0x80)
{ /* old is also kanji */
- if (((0xFF & *q) == (0xFF & *p))
+ if (((0xFF & *q) == (0xFF & *p))
&& ((0xFF & q[1]) == (0xFF & p[1])))
{
/* kanji match ? */
- if (!COLOR_EQS(*q, *p)
+ if (!COLOR_EQS(*q, *p)
|| !COLOR_EQS(q[1], p[1]))
break;
-
+
*buf++ = *p++;
q++;
- if (p >= pmax)
+ if (p >= pmax)
{
*buf++ = SPACE_CHAR;
p++;
break;
}
- else
+ else
{
*buf++ = *p++;
q++;
}
else break; /* old is not kanji */
}
- else
+ else
{ /* new is not kanji */
if (*q & 0x80) break; /* old is kanji */
if (!CHAR_EQS(*q, *p)) break;
#endif
last_buffered_match = buf;
if (p >= pmax) break;
-
+
/* jump to new position is it is greater than 5 otherwise
* let it sit in the buffer and output it later.
*/
- if ((int) (buf - buffer) >= 5)
+ if ((int) (buf - buffer) >= 5)
{
forward_cursor ((unsigned int) (buf - buffer), row);
last_buffered_match = buf = buffer;
{
if (q < qmax)
{
- if ((buf == last_buffered_match)
+ if ((buf == last_buffered_match)
&& ((int) (buf - buffer) >= 5))
{
forward_cursor ((unsigned int) (buf - buffer), row);
}
if (q < qmax) SLtt_del_eol ();
if (Automatic_Margins && (Cursor_c + 1 >= SLtt_Screen_Cols)) Cursor_Set = 0;
-}
+}
static void get_color_info (void)
{
char *fg, *bg;
-
+
SLtt_Use_Ansi_Colors = (NULL != getenv ("COLORTERM"));
-
+
if (-1 == get_default_colors (&fg, &bg))
return;
-
+
/* Check to see if application has already set them. */
if (Color_0_Modified)
return;
-
+
SLtt_set_color (0, NULL, fg, bg);
SLtt_set_color (1, NULL, bg, fg);
}
/* Check for AIX brain-damage */
if (*what == '@')
return NULL;
-
+
/* lose pad info --- with today's technology, term is a loser if
it is really needed */
- while ((*what == '.') ||
+ while ((*what == '.') ||
((*what >= '0') && (*what <= '9'))) what++;
- if (*what == '*') what++;
-
+ if (*what == '*') what++;
+
/* lose terminfo padding--- looks like $<...> */
w = what;
while (*w) if ((*w++ == '$') && (*w == '<'))
while ((*w1++ = *w++) != 0);
w = wsave;
}
- if (*what == 0) what = NULL;
+ if (*what == 0) what = NULL;
}
return(what);
}
char *term, *t, ch;
int is_xterm;
int almost_vtxxx;
-
+
get_color_info ();
-
+
if (NULL == (term = (char *) getenv("TERM")))
{
SLang_exit_error("TERM environment variable needs set.");
}
-
+
Linux_Console = (!strncmp (term, "linux", 5)
#ifdef linux
|| !strncmp(term, "con", 3)
#endif
);
-
+
t = term;
-
+
if (strcmp(t, "vt52") && (*t++ == 'v') && (*t++ == 't')
- && (ch = *t, (ch >= '1') && (ch <= '9'))) Vt100_Like = 1;
+ && (ch = *t, (ch >= '1') && (ch <= '9'))) Vt100_Like = 1;
is_xterm = !strncmp (term, "xterm", 5);
almost_vtxxx = (Vt100_Like
|| Linux_Console
|| is_xterm
|| !strcmp (term, "screen"));
-
+
#ifndef USE_TERMCAP
- if (NULL == (Tbuf = tgetent (term)))
+ if (NULL == (Tbuf = tgetent (term)))
{
char err_buf[512];
if (almost_vtxxx) /* Special cases. */
#else /* USE_TERMCAP */
if (1 != tgetent(Tbuf, term)) SLang_exit_error("Unknown terminal.");
#endif /* NOT USE_TERMCAP */
-
- if ((NULL == (Cls_Str = SLtt_tgetstr("cl")))
+
+ if ((NULL == (Cls_Str = SLtt_tgetstr("cl")))
|| (NULL == (Curs_Pos_Str = SLtt_tgetstr("cm"))))
{
SLang_exit_error("Terminal not powerful enough for SLang.");
}
-
+
if ((NULL == (Ins_Mode_Str = SLtt_tgetstr("im")))
|| ( NULL == (Eins_Mode_Str = SLtt_tgetstr("ei")))
|| ( NULL == (Del_Char_Str = SLtt_tgetstr("dc"))))
SLtt_Term_Cannot_Insert = 1;
-
+
Visible_Bell_Str = SLtt_tgetstr ("vb");
Curs_Up_Str = SLtt_tgetstr ("up");
Rev_Scroll_Str = SLtt_tgetstr("sr");
Del_N_Lines_Str = SLtt_tgetstr("DL");
Add_N_Lines_Str = SLtt_tgetstr("AL");
-
- /* Actually these are used to initialize terminals that use cursor
+
+ /* Actually these are used to initialize terminals that use cursor
* addressing. Hard to believe.
*/
Term_Init_Str = SLtt_tgetstr ("ti");
Term_Reset_Str = SLtt_tgetstr ("te");
- /* If I do this for vtxxx terminals, arrow keys start sending ESC O A,
+ /* If I do this for vtxxx terminals, arrow keys start sending ESC O A,
* which I do not want. This is mainly for HP terminals.
*/
if ((almost_vtxxx == 0) || SLtt_Force_Keypad_Init)
if (Del_N_Lines_Str == NULL) Del_N_Lines_Str = "\033[%dM";
if (Add_N_Lines_Str == NULL) Add_N_Lines_Str = "\033[%dL";
}
-
+
Scroll_R_Str = SLtt_tgetstr("cs");
-
+
SLtt_get_screen_size ();
- if ((Scroll_R_Str == NULL)
+ if ((Scroll_R_Str == NULL)
|| (((NULL == Del_N_Lines_Str) || (NULL == Add_N_Lines_Str))
&& (NULL == Rev_Scroll_Str)))
{
}
else SLtt_Term_Cannot_Scroll = 1;
}
-
+
Del_Eol_Str = SLtt_tgetstr("ce");
Rev_Vid_Str = SLtt_tgetstr("mr");
if (Rev_Vid_Str == NULL) Rev_Vid_Str = SLtt_tgetstr("so");
-
+
Bold_Vid_Str = SLtt_tgetstr("md");
/* Although xterm cannot blink, it does display the blinking characters
if ((NULL == (Blink_Vid_Str = SLtt_tgetstr("mb")))
&& is_xterm)
Blink_Vid_Str = "\033[5m";
-
+
UnderLine_Vid_Str = SLtt_tgetstr("us");
-
+
Start_Alt_Chars_Str = SLtt_tgetstr ("as"); /* smacs */
End_Alt_Chars_Str = SLtt_tgetstr ("ae"); /* rmacs */
Enable_Alt_Char_Set = SLtt_tgetstr ("eA"); /* enacs */
#ifndef NCURSES_BRAIN_DAMAGE_CONTROL
# define NCURSES_BRAIN_DAMAGE_CONTROL 0
#endif
-
+
#if NCURSES_BRAIN_DAMAGE_CONTROL
if (Linux_Console)
{
Enable_Alt_Char_Set = NULL;
# else
char *lgcp = "`\004a\261f\370g\361h\260j\331k\277l\332m\300n\305o\302q\304r\362s_t\303u\264v\301w\302x\263y\371z\372{\373|\374}\375~";
-
+
SLtt_Graphics_Char_Pairs = lgcp;
Start_Alt_Chars_Str = "\033[11m";
End_Alt_Chars_Str = "\033[10m";
# endif
}
#endif
-
+
if (NULL == SLtt_Graphics_Char_Pairs)
{
/* make up for defective termcap/terminfo */
Enable_Alt_Char_Set = "\033)0";
}
}
-
+
/* aixterm added by willi */
if (is_xterm || !strncmp (term, "aixterm", 7))
{
End_Alt_Chars_Str = "\017";
Enable_Alt_Char_Set = "\033(B\033)0";
}
-
- if ((SLtt_Graphics_Char_Pairs == NULL) &&
+
+ if ((SLtt_Graphics_Char_Pairs == NULL) &&
((Start_Alt_Chars_Str == NULL) || (End_Alt_Chars_Str == NULL)))
{
SLtt_Has_Alt_Charset = 0;
Enable_Alt_Char_Set = NULL;
}
else SLtt_Has_Alt_Charset = 1;
-
+
/* status line capabilities */
if ((SLtt_Has_Status_Line == -1)
Num_Status_Line_Columns = TGETNU