home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD1.bin
/
useful
/
util
/
moni
/
snoopdos
/
source
/
settings.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-09-17
|
52KB
|
1,907 lines
/*
* SETTINGS.C vi:ts=4
*
* Copyright (c) Eddy Carroll, September 1994.
*
* This module handles all the command parsing for tooltypes, command
* line options, config files, AREXX, etc.
*/
#include "system.h"
#include "snoopdos.h"
extern char Version[]; /* From Snoopdos.c */
extern char CommodityTitle[]; /* From Snoopdos.c */
char ConfigID[] = "<SnoopDos Settings>";
ULONG UpdateFlags; /* Shows what settings were changed */
struct MsgPort *RemoteReplyPort; /* Used when talking to b/g SnoopDos */
/*
* Now the result codes returned by our simple command interpreter
*/
typedef enum {
EXEC_FAIL, /* The command failed for some reason */
EXEC_OKAY, /* The command succeeded */
EXEC_UNKNOWN, /* The command wasn't recognised */
EXEC_NOPARAM /* The command was missing a parameter */
} ExecEnum;
/*
* Now let's define the commands we understand.
*/
#define CMD_UNKNOWN -1
#define CMD_NOPARAM -2
typedef enum {
CMD_END,
/*
* Options within function requester. Note that these MUST correspond
* exactly with the first set of enums in SNOOPDOS.H for GID_???!
*/
CMD_FINDPORT,
CMD_FINDRESIDENT,
CMD_FINDSEMAPHORE,
CMD_FINDTASK,
CMD_LOCKSCREEN,
CMD_OPENDEVICE,
CMD_OPENFONT,
CMD_OPENLIBRARY,
CMD_OPENRESOURCE,
CMD_READTOOLTYPES,
CMD_SENDREXX,
CMD_CHANGEDIR,
CMD_DELETE,
CMD_EXECUTE,
CMD_GETVAR,
CMD_LOADSEG,
CMD_LOCK,
CMD_MAKEDIR,
CMD_MAKELINK,
CMD_OPEN,
CMD_RENAME,
CMD_RUNCOMMAND,
CMD_SETVAR,
CMD_DOSSYSTEM, /* CMD_SYSTEM is defined in dos/dosextens.h */
CMD_DUMMY1,
CMD_DUMMY2,
CMD_DUMMY3,
CMD_DUMMY4,
CMD_DUMMY5,
CMD_ONLYSHOWFAILS,
CMD_SHOWCLI,
CMD_SHOWFULLPATH,
CMD_USEDEVICENAME,
CMD_MONITORPACKETS,
CMD_MONALLPACKETS,
CMD_MONROMCALLS,
CMD_IGNORESHELL,
#define MAX_BOOL_CMD CMD_IGNORESHELL
CMD_MATCHNAME,
/*
* General commands
*/
CMD_LOADSETTINGS,
CMD_SAVESETTINGS,
CMD_LOADDEFSETTINGS,
CMD_SAVEDEFSETTINGS,
CMD_SETTINGS,
CMD_FUNCTIONS,
CMD_LANGUAGE,
CMD_CLEARBUFFER,
CMD_WINDOWWIDTH,
CMD_HELP,
CMD_COPYWINDOW,
CMD_COPYBUFFER,
CMD_SAVEWINDOW,
CMD_SAVEBUFFER,
CMD_SHOW,
CMD_HIDE,
CMD_OPENFORMAT,
CMD_OPENFUNCTION,
CMD_OPENSETUP,
CMD_CLOSEFORMAT,
CMD_CLOSEFUNCTION,
CMD_CLOSESETUP,
CMD_QUIT,
CMD_PAUSE,
CMD_UNPAUSE,
CMD_DISABLE,
CMD_ENABLE,
CMD_SINGLESTEP,
CMD_OPENLOG,
CMD_APPENDLOG,
CMD_OPENSERIALLOG,
CMD_CLOSELOG,
CMD_ADDLOG,
CMD_FLUSHLOG,
CMD_SCROLLUP,
CMD_SCROLLDOWN,
CMD_GOTO,
/*
* General settings
*/
CMD_PATCHRAMLIB,
CMD_STACKLIMIT,
CMD_ICONPOS,
CMD_SHOWGADGETS,
CMD_HIDEGADGETS,
CMD_AUTOOPEN,
CMD_DISABLEWHENHIDDEN,
CMD_SHOWSTATUS,
CMD_HIDESTATUS,
CMD_CREATEICONS,
CMD_TEXTSPACING,
CMD_SIMPLEREFRESH,
CMD_SMARTREFRESH,
CMD_LEFTALIGNED,
CMD_RIGHTALIGNED,
CMD_ROWQUALIFIER,
CMD_MAINPOS,
CMD_MAINSIZE,
CMD_FUNCPOS,
CMD_FORMPOS,
CMD_SETPOS,
CMD_TASKPRI,
CMD_CXPRI,
/*
* Options within setup requester
*/
CMD_HIDEMETHOD,
CMD_SCREENTYPE,
CMD_BUFFERSIZE,
CMD_LOGMODE,
CMD_FILEIOTYPE,
CMD_FORMAT,
CMD_LOGFORMAT,
CMD_HOTKEY,
CMD_SCREENNAME,
CMD_LOGNAME,
CMD_WINDOWFONT,
CMD_BUFFERFONT,
NUMCOMMANDS
} COMMAND_ID;
/*
* Now associate a command string with each of these identifiers
*/
struct Command {
short cmdid; /* Command ID */
short changemask; /* Which group of settings will change */
short numparms; /* Min number of parameters (0 or more) */
char *name; /* Command name */
} CommandTable[] = {
/*
* In alphabetical order, for quick reference
*/
CMD_ADDLOG, SET_NONE, 1, "AddLog",
CMD_APPENDLOG, SET_NONE, 1, "AppendLog",
CMD_AUTOOPEN, SET_MAIN, 0, "AutoOpen",
CMD_BUFFERFONT, SET_SETUP, 1, "BufferFont",
CMD_BUFFERSIZE, SET_SETUP, 1, "BufferSize",
CMD_CHANGEDIR, SET_FUNC, 0, "ChangeDir",
CMD_CLEARBUFFER, SET_FUNC, 0, "ClearBuffer",
CMD_CLOSEFORMAT, SET_NONE, 0, "CloseFormat",
CMD_CLOSEFUNCTION, SET_NONE, 0, "CloseFunction",
CMD_CLOSELOG, SET_NONE, 0, "CloseLog",
CMD_CLOSESETUP, SET_NONE, 0, "CloseSetup",
CMD_COPYBUFFER, SET_NONE, 0, "CopyBuffer",
CMD_COPYWINDOW, SET_NONE, 0, "CopyWindow",
CMD_CREATEICONS, SET_MAIN, 0, "CreateIcons",
CMD_HOTKEY, SET_SETUP, 1, "CX_PopKey",
CMD_SHOW, SET_NONE, 0, "CX_Popup",
CMD_CXPRI, SET_NONE, 1, "CX_Priority",
CMD_DELETE, SET_FUNC, 0, "Delete",
CMD_DISABLE, SET_NONE, 0, "Disable",
CMD_DISABLEWHENHIDDEN, SET_MAIN, 0, "DisableWhenHidden",
CMD_ENABLE, SET_NONE, 0, "Enable",
CMD_EXECUTE, SET_FUNC, 0, "Execute",
CMD_FILEIOTYPE, SET_SETUP, 1, "FileIOType",
CMD_FINDPORT, SET_FUNC, 0, "FindPort",
CMD_FINDRESIDENT, SET_FUNC, 0, "FindResident",
CMD_FINDSEMAPHORE, SET_FUNC, 0, "FindSemaphore",
CMD_FINDTASK, SET_FUNC, 0, "FindTask",
CMD_FLUSHLOG, SET_NONE, 0, "FlushLog",
CMD_FORMAT, SET_SETUP, 1, "Format",
CMD_FORMPOS, SET_MAIN, 1, "FormatWindowPos",
CMD_FUNCTIONS, SET_FUNC, 1, "Functions",
CMD_FUNCPOS, SET_MAIN, 1, "FunctionWindowPos",
CMD_GETVAR, SET_FUNC, 0, "GetVar",
CMD_GOTO, SET_NONE, 1, "GotoLine",
CMD_HELP, SET_NONE, 0, "Help",
CMD_HIDE, SET_NONE, 0, "Hide",
CMD_HIDEGADGETS, SET_MAIN, 0, "HideGadgets",
CMD_HIDEMETHOD, SET_SETUP, 1, "HideMethod",
CMD_HIDESTATUS, SET_MAIN, 0, "HideStatus",
CMD_HOTKEY, SET_SETUP, 1, "HotKey",
CMD_ICONPOS, SET_MAIN, 1, "IconPos",
CMD_IGNORESHELL, SET_FUNC, 0, "IgnoreShell",
CMD_LANGUAGE, SET_NONE, 1, "Language",
CMD_LEFTALIGNED, SET_MAIN, 0, "LeftAligned",
CMD_LOADDEFSETTINGS, SET_NONE, 0, "LoadDefSettings",
CMD_LOADSEG, SET_FUNC, 0, "LoadSeg",
CMD_LOADSETTINGS, SET_NONE, 1, "LoadSettings",
CMD_LOCK, SET_FUNC, 0, "Lock",
CMD_LOCKSCREEN, SET_FUNC, 0, "LockScreen",
CMD_LOGFORMAT, SET_SETUP, 1, "LogFormat",
CMD_LOGMODE, SET_SETUP, 1, "LogMode",
CMD_LOGNAME, SET_SETUP, 1, "LogName",
CMD_MAINPOS, SET_MAIN, 1, "MainWindowPos",
CMD_MAINSIZE, SET_MAIN, 1, "MainWindowSize",
CMD_MAKEDIR, SET_FUNC, 0, "MakeDir",
CMD_MAKELINK, SET_FUNC, 0, "MakeLink",
CMD_MATCHNAME, SET_FUNC, 1, "MatchName",
CMD_MONITORPACKETS, SET_FUNC, 0, "MonitorPackets",
CMD_MONROMCALLS, SET_FUNC, 0, "MonitorROMCalls",
CMD_ONLYSHOWFAILS, SET_FUNC, 0, "OnlyShowFails",
CMD_OPEN, SET_FUNC, 0, "Open",
CMD_OPENDEVICE, SET_FUNC, 0, "OpenDevice",
CMD_OPENFONT, SET_FUNC, 0, "OpenFont",
CMD_OPENFORMAT, SET_NONE, 0, "OpenFormat",
CMD_OPENFUNCTION, SET_NONE, 0, "OpenFunction",
CMD_OPENLIBRARY, SET_FUNC, 0, "OpenLibrary",
CMD_OPENLOG, SET_NONE, 1, "OpenLog",
CMD_OPENRESOURCE, SET_FUNC, 0, "OpenResource",
CMD_OPENSERIALLOG, SET_NONE, 0, "OpenSerialLog",
CMD_OPENSETUP, SET_NONE, 0, "OpenSetup",
CMD_MONALLPACKETS, SET_FUNC, 0, "PacketDebugger",
CMD_PATCHRAMLIB, SET_NONE, 0, "PatchRamLib",
CMD_PAUSE, SET_NONE, 0, "Pause",
CMD_QUIT, SET_NONE, 0, "Quit",
CMD_READTOOLTYPES, SET_FUNC, 0, "ReadToolTypes",
CMD_RENAME, SET_FUNC, 0, "Rename",
CMD_RIGHTALIGNED, SET_MAIN, 0, "RightAligned",
CMD_ROWQUALIFIER, SET_MAIN, 1, "RowQualifier",
CMD_RUNCOMMAND, SET_FUNC, 0, "RunCommand",
CMD_SAVEBUFFER, SET_NONE, 1, "SaveBuffer",
CMD_SAVEDEFSETTINGS, SET_NONE, 0, "SaveDefSettings",
CMD_SAVESETTINGS, SET_NONE, 1, "SaveSettings",
CMD_SAVEWINDOW, SET_NONE, 1, "SaveWindow",
CMD_SCREENNAME, SET_SETUP, 1, "ScreenName",
CMD_SCREENTYPE, SET_SETUP, 1, "ScreenType",
CMD_SCROLLDOWN, SET_NONE, 1, "ScrollDown",
CMD_SCROLLUP, SET_NONE, 1, "ScrollUp",
CMD_SENDREXX, SET_FUNC, 0, "SendRexx",
CMD_SETTINGS, SET_NONE, 1, "Settings",
CMD_SETPOS, SET_MAIN, 1, "SetupWindowPos",
CMD_SETVAR, SET_FUNC, 0, "SetVar",
CMD_SHOW, SET_NONE, 0, "Show",
CMD_SHOWCLI, SET_FUNC, 0, "ShowCLI",
CMD_SHOWFULLPATH, SET_FUNC, 0, "ShowFullPath",
CMD_SHOWGADGETS, SET_MAIN, 0, "ShowGadgets",
CMD_SHOWSTATUS, SET_MAIN, 0, "ShowStatus",
CMD_SIMPLEREFRESH, SET_MAIN, 0, "SimpleRefresh",
CMD_SINGLESTEP, SET_NONE, 0, "SingleStep",
CMD_SMARTREFRESH, SET_MAIN, 0, "SmartRefresh",
CMD_STACKLIMIT, SET_MAIN, 1, "StackLimit",
CMD_DOSSYSTEM, SET_FUNC, 0, "System",
CMD_TASKPRI, SET_NONE, 1, "TaskPri",
CMD_TEXTSPACING, SET_MAIN, 1, "TextSpacing",
CMD_UNPAUSE, SET_NONE, 0, "Unpause",
CMD_USEDEVICENAME, SET_FUNC, 0, "UseDevice