зеркало из https://github.com/mozilla/pjs.git
Родитель
5de101c265
Коммит
f0f156d3f3
|
@ -77,7 +77,7 @@ LtermGlobal ltermGlobal;
|
|||
|
||||
|
||||
int ltermClose(struct lterms *lts);
|
||||
static int ltermShellInit(struct lterms *lts);
|
||||
static int ltermShellInit(struct lterms *lts, int all);
|
||||
static int ltermCreatePipe(FILEDESC *writePIPE, FILEDESC *readPIPE);
|
||||
static int ltermCreateProcess(struct LtermProcess *ltp,
|
||||
char *const argv[], int nostderr, int noexport);
|
||||
|
@ -535,44 +535,58 @@ int lterm_open(int lterm, char *const argv[],
|
|||
|
||||
LTERM_LOG(lterm_open,11,("cookie='%s'\n",lts->cookie));
|
||||
|
||||
/* Shell initialization string */
|
||||
if (lts->processType == LTERM_UNKNOWN_PROCESS) {
|
||||
lts->shellInitStr[0] = '\0';
|
||||
/* Shell initialization commands have not been sent yet */
|
||||
lts->shellInitCommands = 0;
|
||||
|
||||
} else {
|
||||
/* NOTE: Shell init commands are stored in reverse order of execution */
|
||||
|
||||
if (init_command != NULL) {
|
||||
/* User supplied shell init command */
|
||||
|
||||
if (strlen(init_command) <= MAXSHELLINITSTR-1) {
|
||||
int cmd = lts->shellInitCommands++;
|
||||
assert(cmd < MAXSHELLCMD);
|
||||
|
||||
(void) strncpy(lts->shellInitStr[cmd], init_command, MAXSHELLINITSTR-1);
|
||||
lts->shellInitStr[cmd][MAXSHELLINITSTR-1] = '\0';
|
||||
|
||||
} else {
|
||||
LTERM_WARNING("lterm_open: Warning - user init command too long\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (lts->processType != LTERM_UNKNOWN_PROCESS) {
|
||||
/* Process dependent shell init command */
|
||||
int result;
|
||||
char* shellInitFormat;
|
||||
char* initStr = "";
|
||||
|
||||
if (init_command != NULL)
|
||||
initStr = (char *) init_command;
|
||||
|
||||
if ((lts->processType == LTERM_CSH_PROCESS) ||
|
||||
(lts->processType == LTERM_TCSH_PROCESS)) {
|
||||
/* C-shell family */
|
||||
shellInitFormat = "setenv LTERM_COOKIE '%s'; if (-f $HOME/.xmltermrc) source $HOME/.xmltermrc\n%s";
|
||||
shellInitFormat = "setenv LTERM_COOKIE '%s'; if (-f $HOME/.xmltermrc) source $HOME/.xmltermrc\n";
|
||||
|
||||
} else {
|
||||
/* Bourne-shell family */
|
||||
shellInitFormat = "LTERM_COOKIE='%s'; export LTERM_COOKIE; if [ -f $HOME/.xmltermrc ]; then source $HOME/.xmltermrc; fi\n%s";
|
||||
shellInitFormat = "LTERM_COOKIE='%s'; export LTERM_COOKIE; if [ -f $HOME/.xmltermrc ]; then source $HOME/.xmltermrc; fi\n";
|
||||
}
|
||||
|
||||
/* **** WATCH OUT FOR BUFFER OVERFLOW!!! *** */
|
||||
if (strlen(shellInitFormat)-4+strlen(lts->cookie)+strlen(initStr) <=
|
||||
MAXSHELLINITSTR-1) {
|
||||
sprintf(lts->shellInitStr, shellInitFormat, lts->cookie, initStr);
|
||||
if (strlen(shellInitFormat)-4+strlen(lts->cookie) <= MAXSHELLINITSTR-1) {
|
||||
|
||||
int cmd = lts->shellInitCommands++;
|
||||
assert(cmd < MAXSHELLCMD);
|
||||
|
||||
sprintf(lts->shellInitStr[cmd], shellInitFormat, lts->cookie);
|
||||
lts->shellInitStr[cmd][MAXSHELLINITSTR-1] = '\0';
|
||||
|
||||
} else {
|
||||
LTERM_WARNING("lterm_open: Warning - shell initialization string too long\n");
|
||||
lts->shellInitStr[0] = '\0';
|
||||
LTERM_WARNING("lterm_open: Warning - process init command too long\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LTERM_LOG(lterm_open,11,("shellInitStr='%s'\n",lts->shellInitStr));
|
||||
|
||||
/* Shell initialization commands have not been sent yet */
|
||||
lts->shellInitFlag = 0;
|
||||
for (j=lts->shellInitCommands-1; j>0; j--) {
|
||||
LTERM_LOG(lterm_open,11,("shellInitStr%d='%s'\n",j,lts->shellInitStr[j]));
|
||||
}
|
||||
|
||||
/* Initialize regular expression string matching command prompt */
|
||||
if ((ucslen(prompt_regexp) == 0) ||
|
||||
|
@ -863,9 +877,9 @@ int lterm_setecho(int lterm, int echo_flag)
|
|||
return -2;
|
||||
}
|
||||
|
||||
if (!lts->shellInitFlag) {
|
||||
if (lts->shellInitCommands > 0) {
|
||||
/* send shell initialization string */
|
||||
if (ltermShellInit(lts) != 0) {
|
||||
if (ltermShellInit(lts,1) != 0) {
|
||||
GLOBAL_UNLOCK;
|
||||
return -1;
|
||||
}
|
||||
|
@ -1028,9 +1042,9 @@ int lterm_write(int lterm, const UNICHAR *buf, int count, int dataType)
|
|||
lts->disabledInputEcho = 0;
|
||||
}
|
||||
|
||||
if (!lts->shellInitFlag) {
|
||||
if (lts->shellInitCommands > 0) {
|
||||
/* send shell initialization string */
|
||||
if (ltermShellInit(lts) != 0) {
|
||||
if (ltermShellInit(lts,1) != 0) {
|
||||
GLOBAL_UNLOCK;
|
||||
return -1;
|
||||
}
|
||||
|
@ -1172,9 +1186,9 @@ int lterm_read(int lterm, int timeout, UNICHAR *buf, int count,
|
|||
RELEASE_UNILOCK(outputMutex,outputMutexLocked)
|
||||
|
||||
GLOBAL_LOCK;
|
||||
if ((*opcodes != 0) && !lts->shellInitFlag) {
|
||||
if ((*opcodes != 0) && (lts->shellInitCommands > 0)) {
|
||||
/* send shell initialization string */
|
||||
if (ltermShellInit(lts) != 0) {
|
||||
if (ltermShellInit(lts,0) != 0) {
|
||||
GLOBAL_UNLOCK;
|
||||
return -1;
|
||||
}
|
||||
|
@ -1188,38 +1202,56 @@ int lterm_read(int lterm, int timeout, UNICHAR *buf, int count,
|
|||
}
|
||||
|
||||
|
||||
/** Sends shell initialization string
|
||||
/** Sends shell initialization commands, if any
|
||||
* (WORKS UNDER GLOBAL_LOCK)
|
||||
* @param all if true, send all init commands, else send just one command
|
||||
* @return 0 on success and -1 on error.
|
||||
*/
|
||||
static int ltermShellInit(struct lterms *lts)
|
||||
static int ltermShellInit(struct lterms *lts, int all)
|
||||
{
|
||||
int shellInitLen = strlen(lts->shellInitStr);
|
||||
int shellInitLen, lowCommand, j;
|
||||
|
||||
if (lts->shellInitCommands <= 0)
|
||||
return 0;
|
||||
|
||||
LTERM_LOG(ltermShellInit,20,("sending shell initialization string\n"));
|
||||
|
||||
lts->shellInitFlag = 1;
|
||||
if (all) {
|
||||
/* Send all commands */
|
||||
lowCommand = 0;
|
||||
} else {
|
||||
/* Send single command */
|
||||
lowCommand = lts->shellInitCommands - 1;
|
||||
}
|
||||
|
||||
if (shellInitLen > 0) {
|
||||
/* Send shell initialization string */
|
||||
UNICHAR temLine[PIPEHEADER+MAXCOL];
|
||||
int remaining, encoded, byteCount;
|
||||
for (j=lts->shellInitCommands-1; j>=lowCommand; j--) {
|
||||
/* Send shell init command and decrement count */
|
||||
lts->shellInitCommands--;
|
||||
|
||||
utf8toucs(lts->shellInitStr, shellInitLen,
|
||||
temLine+PIPEHEADER, MAXCOL,
|
||||
1, &remaining, &encoded);
|
||||
if (remaining > 0) {
|
||||
LTERM_ERROR("ltermShellInit: Shell initialization string too long\n");
|
||||
return -1;
|
||||
}
|
||||
shellInitLen = strlen(lts->shellInitStr[j]);
|
||||
|
||||
temLine[0] = (UNICHAR) encoded;
|
||||
temLine[PHDR_TYPE] = (UNICHAR) LTERM_WRITE_PLAIN_INPUT;
|
||||
byteCount = (PIPEHEADER+encoded)*sizeof(UNICHAR);
|
||||
if (shellInitLen > 0) {
|
||||
/* Send shell initialization string */
|
||||
UNICHAR temLine[PIPEHEADER+MAXCOL];
|
||||
int remaining, encoded, byteCount;
|
||||
|
||||
if (WRITE(lts->writeBUFFER, temLine, (SIZE_T)byteCount) != byteCount) {
|
||||
LTERM_ERROR("ltermShellInit: Error in writing to input pipe buffer\n");
|
||||
return -1;
|
||||
utf8toucs(lts->shellInitStr[j], shellInitLen,
|
||||
temLine+PIPEHEADER, MAXCOL,
|
||||
1, &remaining, &encoded);
|
||||
if (remaining > 0) {
|
||||
LTERM_ERROR(
|
||||
"ltermShellInit: Shell init command %d string too long\n", j+1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
temLine[0] = (UNICHAR) encoded;
|
||||
temLine[PHDR_TYPE] = (UNICHAR) LTERM_WRITE_PLAIN_INPUT;
|
||||
byteCount = (PIPEHEADER+encoded)*sizeof(UNICHAR);
|
||||
|
||||
if (WRITE(lts->writeBUFFER, temLine, (SIZE_T)byteCount) != byteCount) {
|
||||
LTERM_ERROR("ltermShellInit: Error in writing to input pipe buffer\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,571 +0,0 @@
|
|||
/*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "MPL"); you may not use this file
|
||||
* except in compliance with the MPL. You may obtain a copy of
|
||||
* the MPL at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the MPL is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the MPL for the specific language governing
|
||||
* rights and limitations under the MPL.
|
||||
*
|
||||
* The Original Code is lineterm.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Ramalingam Saravanan.
|
||||
* Portions created by Ramalingam Saravanan <svn@xmlterm.org> are
|
||||
* Copyright (C) 1999 Ramalingam Saravanan. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the
|
||||
* terms of the GNU General Public License (the "GPL"), in which case
|
||||
* the provisions of the GPL are applicable instead of
|
||||
* those above. If you wish to allow use of your version of this
|
||||
* file only under the terms of the GPL and not to allow
|
||||
* others to use your version of this file under the MPL, indicate
|
||||
* your decision by deleting the provisions above and replace them
|
||||
* with the notice and other provisions required by the GPL.
|
||||
* If you do not delete the provisions above, a recipient
|
||||
* may use your version of this file under either the MPL or the
|
||||
* GPL.
|
||||
*/
|
||||
|
||||
/* ltermPrivate.h: Line terminal (LTERM) private header file
|
||||
* LTERM provides a "stream" interface to an XTERM-like terminal,
|
||||
* using line input/output.
|
||||
* CPP options:
|
||||
* LINUX: for Linux2.0/glibc
|
||||
* SOLARIS: for Solaris2.6
|
||||
* BSDFAMILY: for FreeBSD, ...
|
||||
* DEBUG: to enable some debugging output
|
||||
* NO_PTY: force use of pipes rather than PTY for process
|
||||
* communication
|
||||
* MOZILLA_CLIENT: set if embedded in Mozilla
|
||||
* USE_NSPR_BASE: use basic NSPR API (excluding I/O and process creation)
|
||||
* USE_NSPR_LOCK: use NSPR lock API instead of Unix mutex API
|
||||
* USE_NSPR_IO: use NSPR I/O and process API instead of Unix API
|
||||
* (current implementation of pseudo-TTY is incompatible with
|
||||
* the NSPR I/O API; set the USE_NSPR_IO option only on platforms
|
||||
* where PTYSTREAM is not implemented)
|
||||
*/
|
||||
|
||||
#ifndef _LTERMPRIVATE_H
|
||||
|
||||
#define _LTERMPRIVATE_H 1
|
||||
|
||||
/* Standard C header files */
|
||||
#include <string.h>
|
||||
|
||||
/* public declarations */
|
||||
#include "lineterm.h"
|
||||
#include "tracelog.h"
|
||||
|
||||
/* private declarations */
|
||||
|
||||
/* Force use of basic NSPR API if MOZILLA_CLIENT or USE_NSPR_IO are defined */
|
||||
#if defined(MOZILLA_CLIENT) || defined(USE_NSPR_IO)
|
||||
#define USE_NSPR_BASE 1
|
||||
#endif
|
||||
|
||||
/* pseudo-TTY stream interface */
|
||||
#include "ptystream.h"
|
||||
|
||||
#define LTERM_ERROR TLOG_ERROR
|
||||
#define LTERM_WARNING TLOG_WARNING
|
||||
#define LTERM_LOG(procname,level,args) TLOG_PRINT(LTERM_TLOG_MODULE,procname,level,args)
|
||||
#define LTERM_LOGUNICODE(procname,level,args) TLOG_UNICHAR(LTERM_TLOG_MODULE,procname,level,args)
|
||||
|
||||
#ifdef USE_NSPR_BASE /* Use basic NSPR API (excluding I/O) */
|
||||
|
||||
#include "nspr.h"
|
||||
|
||||
#define assert PR_ASSERT
|
||||
|
||||
#define int32 PRInt32
|
||||
|
||||
#define getenv PR_GetEnv
|
||||
|
||||
#define MALLOC(x) PR_Malloc(x)
|
||||
#define REALLOC(x,y) PR_Realloc((x),(y))
|
||||
#define CALLOC(x,y) PR_Calloc((x),(y))
|
||||
#define FREE(x) PR_Free(x)
|
||||
|
||||
#else /* not USE_NSPR_BASE */
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#define int32 long
|
||||
|
||||
#define MALLOC(x) malloc(x)
|
||||
#define REALLOC(x,y) realloc((x),(y))
|
||||
#define CALLOC(x,y) calloc((x),(y))
|
||||
#define FREE(x) free(x)
|
||||
|
||||
#endif /* not USE_NSPR_BASE */
|
||||
|
||||
|
||||
#ifdef USE_NSPR_IO /* Use NSPR I/O API (no PTY implementation) */
|
||||
|
||||
typedef PRFileDesc *FILEDESC;
|
||||
#define NULL_FILEDESC 0
|
||||
#define VALID_FILEDESC(x) (x != 0)
|
||||
|
||||
typedef PRFileDesc FILESTREAM;
|
||||
|
||||
#define SIZE_T PRInt32
|
||||
#define WRITE PR_Write
|
||||
#define READ PR_Read
|
||||
#define CLOSE(x) (PR_Close(x) != PR_SUCCESS)
|
||||
#define PIPE(x) (PR_CreatePipe((x),(x)+1) != PR_SUCCESS)
|
||||
|
||||
#define POLL(x,y,z) PR_Poll((x),(y),(z))
|
||||
#define POLLFD PRPollDesc
|
||||
#define POLL_EVENTS in_flags
|
||||
#define POLL_REVENTS out_flags
|
||||
#define POLL_READ PR_POLL_READ
|
||||
|
||||
#define PROCESS PRProcess *
|
||||
#define NULL_PROCESS 0
|
||||
#define VALID_PROCESS(x) (x != 0)
|
||||
|
||||
#else /* not USE_NSPR_IO */
|
||||
|
||||
/* system header files */
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
|
||||
/* Diagnostic/debugging files */
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#if defined(SOLARIS)
|
||||
#include <poll.h>
|
||||
#else
|
||||
#include <sys/poll.h>
|
||||
#endif
|
||||
|
||||
typedef int FILEDESC;
|
||||
#define NULL_FILEDESC -1
|
||||
#define VALID_FILEDESC(x) (x >= 0)
|
||||
|
||||
typedef FILE FILESTREAM;
|
||||
|
||||
#define SIZE_T size_t
|
||||
#define WRITE write
|
||||
#define READ read
|
||||
#define CLOSE(x) close(x)
|
||||
#define PIPE(x) pipe(x)
|
||||
|
||||
#define POLL(x,y,z) poll((x),(y),(z))
|
||||
#define POLLFD pollfd
|
||||
#define POLL_EVENTS events
|
||||
#define POLL_REVENTS revents
|
||||
#define POLL_READ POLLIN
|
||||
|
||||
#define PROCESS long
|
||||
#define NULL_PROCESS 0
|
||||
#define VALID_PROCESS(x) (x > 0)
|
||||
|
||||
#endif /* not USE_NSPR_IO */
|
||||
|
||||
|
||||
#ifdef USE_NSPR_LOCK /* Use NSPR lock API */
|
||||
|
||||
#define MUTEX_DECLARE(x) PRLock *x
|
||||
#define MUTEX_INITIALIZE(x) ((x=PR_NewLock()) == NULL)
|
||||
#define MUTEX_LOCK(x) PR_Lock(x)
|
||||
#define MUTEX_UNLOCK(x) PR_Unlock(x)
|
||||
#define MUTEX_DESTROY(x) PR_DestroyLock(x)
|
||||
|
||||
#define THREAD_DECLARE(x) PRThread *x
|
||||
#define THREAD_CREATE ((x=PR_CreateThread(PR_USER_THREAD, (y), (z), \
|
||||
PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, \
|
||||
PR_JOINABLE_THREAD, 0)) == NULL)
|
||||
#define THREAD_SELF PR_GetCurrentThread
|
||||
#define THREAD_EQUAL(x,y) ((x) == (y))
|
||||
#define THREAD_JOIN(x) (PR_JoinThread(x) != PR_SUCCESS)
|
||||
|
||||
#else /* not USE_NSPR_LOCK */
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#define MUTEX_DECLARE(x) pthread_mutex_t x
|
||||
#define MUTEX_INITIALIZE(x) pthread_mutex_init(&(x), NULL)
|
||||
#define MUTEX_LOCK(x) pthread_mutex_lock(&(x))
|
||||
#define MUTEX_UNLOCK(x) pthread_mutex_unlock(&(x))
|
||||
#define MUTEX_DESTROY(x) pthread_mutex_destroy(&(x))
|
||||
|
||||
#define THREAD_DECLARE(x) pthread_t x
|
||||
#define THREAD_CREATE(x,y,z) pthread_create(&(x),NULL,(y),(z))
|
||||
#define THREAD_SELF pthread_self
|
||||
#define THREAD_EQUAL(x,y) pthread_equal(x,y)
|
||||
#define THREAD_JOIN(x) pthread_join((x),NULL)
|
||||
|
||||
#endif /* not USE_NSPR_LOCK */
|
||||
|
||||
|
||||
#define MAXTERM 256 /* Maximum number of LTERMs;
|
||||
* affects static memory "footprint"
|
||||
*/
|
||||
|
||||
#define MAXCOL 4096 /* Maximum columns in line buffer;
|
||||
* affects static memory "footprint";
|
||||
* the only limitation on this value is that
|
||||
* it must fit into a UNICHAR, because of the
|
||||
* way lterm_write and ltermWrite implement
|
||||
* the input buffer pipe.
|
||||
*/
|
||||
|
||||
#define MAXROW 1024 /* Maximum rows in screen;
|
||||
* primarily affects dynamically allocated
|
||||
* memory
|
||||
*/
|
||||
|
||||
/* The only obvious limitation on the following is that they should be
|
||||
* significantly less than MAXCOL
|
||||
*/
|
||||
#define MAXPROMPT 256 /* Maximum length of prompt regexp+1 */
|
||||
#define MAXRAWINCOMPLETE 5 /* Maximum incomplete raw buffer size */
|
||||
#define MAXSTREAMTERM 11 /* Maximum stream terminator buffer size */
|
||||
#define MAXSHELLINITSTR 256 /* Maximum length of shell init string+1 */
|
||||
#define MAXCOOKIESTR 64 /* Maximum length of cookie string+1 */
|
||||
#define MAXESCAPEPARAMS 16 /* Maximum no. of numeric ESCAPE parameters */
|
||||
#define MAXSTRINGPARAM 512 /* Maximum length of string ESCAPE parameters */
|
||||
|
||||
#define MAXPTYIN 128 /* 1/2 POSIX minimum MAX_INPUT for PTY */
|
||||
|
||||
#define MAXCOLM1 (MAXCOL-1) /* Maximum columns in line buffer - 1 */
|
||||
|
||||
#define MAXTTYCONTROL 8 /* Maximum TTY control character list */
|
||||
#define TTYINTERRUPT 0
|
||||
#define TTYERASE 1
|
||||
#define TTYKILL 2
|
||||
#define TTYEOF 3
|
||||
#define TTYSUSPEND 4
|
||||
#define TTYREPRINT 5
|
||||
#define TTYDISCARD 6
|
||||
#define TTYWERASE 7
|
||||
|
||||
/* input modes */
|
||||
#define LTERM0_RAW_MODE 0
|
||||
#define LTERM1_CANONICAL_MODE 1
|
||||
#define LTERM2_EDIT_MODE 2
|
||||
#define LTERM3_COMPLETION_MODE 3
|
||||
|
||||
/* completion request codes */
|
||||
#define LTERM_NO_COMPLETION 0
|
||||
#define LTERM_TAB_COMPLETION 1
|
||||
#define LTERM_HISTORY_COMPLETION 2
|
||||
|
||||
/* output modes */
|
||||
#define LTERM0_STREAM_MODE 0
|
||||
#define LTERM1_SCREEN_MODE 1
|
||||
#define LTERM2_LINE_MODE 2
|
||||
|
||||
/* character/line action codes */
|
||||
#define LTERM_INSERT_ACTION 0
|
||||
#define LTERM_DELETE_ACTION 1
|
||||
#define LTERM_ERASE_ACTION 2
|
||||
|
||||
/* List of characters escaped in XML */
|
||||
#define LTERM_AMP_ESCAPE 0
|
||||
#define LTERM_LT_ESCAPE 1
|
||||
#define LTERM_GT_ESCAPE 2
|
||||
#define LTERM_QUOT_ESCAPE 3
|
||||
#define LTERM_APOS_ESCAPE 4
|
||||
|
||||
#define LTERM_XML_ESCAPES 5
|
||||
#define LTERM_PLAIN_ESCAPES 3
|
||||
|
||||
/* Maximum no. of characters in an XML escape sequence (excluding NUL) */
|
||||
#define LTERM_MAXCHAR_ESCAPE 6
|
||||
|
||||
/* input buffer pipe header "character" count */
|
||||
#define PIPEHEADER 2
|
||||
|
||||
/* input buffer pipe header components */
|
||||
#define PHDR_CHARS 0
|
||||
#define PHDR_TYPE 1
|
||||
|
||||
/* LTERM read in/out parameter structure */
|
||||
struct LtermRead {
|
||||
UNICHAR *buf; /* Pointer to Unicode character buffer (IN param) */
|
||||
UNISTYLE *style; /* Pointer to character style buffer (IN param) */
|
||||
int max_count; /* max. number of characters in buffers (IN param) */
|
||||
int read_count; /* actual number of characters in buffers */
|
||||
int opcodes; /* Returned opcodes */
|
||||
int opvals; /* Returned opvalues */
|
||||
int buf_row; /* row at which to display buffer data */
|
||||
int buf_col; /* starting column at which to display buffer data */
|
||||
int cursor_row; /* final cursor row position */
|
||||
int cursor_col; /* final cursor column position */
|
||||
};
|
||||
|
||||
/* LTERM input structure: managed by lterm_write */
|
||||
struct LtermInput {
|
||||
|
||||
UNICHAR inputBuf[PIPEHEADER+MAXCOL]; /* holds data read from input buffer
|
||||
* pipe
|
||||
*/
|
||||
int inputBufBytes; /* Count of bytes already read in */
|
||||
|
||||
int inputMode; /* input mode:
|
||||
* 0 = raw mode
|
||||
* 1 = canonical mode
|
||||
* 2 = edit + canonical mode
|
||||
* 3 = completion + edit + canonical mode
|
||||
*/
|
||||
|
||||
int escapeFlag; /* processing ESCAPE in line mode */
|
||||
int escapeCSIFlag; /* processing ESCAPE Code Sequence Introducer */
|
||||
int escapeCSIArg; /* ESCAPE Code Sequence Argument value */
|
||||
|
||||
int inputOpcodes; /* input opcodes */
|
||||
|
||||
int clearInputLine; /* true if input line buffer needs to be
|
||||
* cleared (after echoing) */
|
||||
|
||||
UNICHAR inputLine[MAXCOL]; /* input line buffer:
|
||||
only MAXCOL-1 characters should actually
|
||||
be inserted in the buffer, to allow
|
||||
one character padding if necessary */
|
||||
|
||||
int inputChars; /* length of input line (characters);
|
||||
* should never exceed MAXCOL-1,
|
||||
* to allow for null termination
|
||||
*/
|
||||
int inputCols; /* number of displayed columns in input line;
|
||||
* a column corresponds to a single
|
||||
* plain text character transmitted to the
|
||||
* subordinate process, although it may occupy
|
||||
* multiple character positions, e.g.,
|
||||
* e.g., < represents "<"
|
||||
*/
|
||||
int inputGlyphs; /* number of displayed glyphs in input line;
|
||||
* a glyph corresponds to a logical column
|
||||
* on the layout, i.e., a single Unicode
|
||||
* character or an XML element, such as an
|
||||
* iconic representiion of an URI.
|
||||
*/
|
||||
|
||||
unsigned short inputColCharIndex[MAXCOL]; /* starting character index of
|
||||
* each column, including the
|
||||
* cursor column at end of line.
|
||||
* (inputCols+1 values should be
|
||||
* defined)
|
||||
*/
|
||||
|
||||
unsigned short inputGlyphCharIndex[MAXCOL]; /* starting character index
|
||||
* of each glyph, including
|
||||
* empty glyph at the end of
|
||||
* the line.
|
||||
* (inputGlyphs+1 values
|
||||
* should be defined)
|
||||
*/
|
||||
unsigned short inputGlyphColIndex[MAXCOL]; /* starting column index of
|
||||
* each glyph
|
||||
* (inputGlyphs+1 values)
|
||||
*/
|
||||
|
||||
int inputCursorGlyph; /* current input cursor glyph number (>=0) */
|
||||
};
|
||||
|
||||
/* LtermOutput poll structure index count and values */
|
||||
#define POLL_COUNT 3
|
||||
#define POLL_INPUTBUF 0
|
||||
#define POLL_STDOUT 1
|
||||
#define POLL_STDERR 2
|
||||
|
||||
/* LTERM output structure: managed by lterm_read */
|
||||
struct LtermOutput {
|
||||
struct POLLFD pollFD[POLL_COUNT]; /* output polling structure */
|
||||
long callbackTag[POLL_COUNT]; /* GTK callback tag for each FD (0 if none) */
|
||||
int nfds; /* count of "files" to be polled */
|
||||
int outputMode; /* output mode:
|
||||
* 0 = full screen mode
|
||||
* 1 = line mode
|
||||
* 2 = command line mode
|
||||
*/
|
||||
|
||||
UNICHAR streamTerminator[MAXSTREAMTERM]; /* stream terminator buffer */
|
||||
int streamOpcodes; /* Stream opcodes */
|
||||
int savedOutputMode; /* saved output mode (prior to stream mode) */
|
||||
|
||||
int insertMode; /* character insert mode */
|
||||
int automaticNewline; /* automatic newline mode */
|
||||
|
||||
UNISTYLE styleMask; /* current output style mask */
|
||||
|
||||
char rawOUTBuf[MAXRAWINCOMPLETE]; /* incomplete raw STDOUT buffer */
|
||||
int rawOUTBytes; /* incomplete raw STDOUT byte count */
|
||||
|
||||
char rawERRBuf[MAXRAWINCOMPLETE]; /* incomplete raw STDERR buffer */
|
||||
int rawERRBytes; /* incomplete raw STDERR byte count */
|
||||
|
||||
UNICHAR decodedOutput[MAXCOL]; /* decoded output buffer:
|
||||
only MAXCOL-1 characters should actually
|
||||
be inserted in the buffer, to allow
|
||||
one character padding if necessary */
|
||||
UNISTYLE decodedStyle[MAXCOL]; /* decoded output style buffer */
|
||||
int decodedChars; /* decoded character count;
|
||||
should never exceed MAXCOL-1 */
|
||||
int incompleteEscapeSequence; /* Incomplete ESCAPE sequence flag */
|
||||
|
||||
UNICHAR outputLine[MAXCOL]; /* output line buffer (processed);
|
||||
only MAXCOL-1 characters should actually
|
||||
be inserted in the buffer, to allow
|
||||
one character padding if necessary */
|
||||
UNISTYLE outputStyle[MAXCOL]; /* output style buffer for each character */
|
||||
|
||||
int outputChars; /* length of output line (characters)
|
||||
should never exceed MAXCOL-1 */
|
||||
int outputCursorChar; /* output cursor character position (>=0) */
|
||||
int promptChars; /* prompt character count */
|
||||
int outputModifiedChar; /* leftmost modified character in output line */
|
||||
|
||||
int cursorRow, cursorCol; /* screen cursor row and column */
|
||||
int returnedCursorRow, returnedCursorCol;
|
||||
/* returned screen cursor row and column */
|
||||
|
||||
int topScrollRow, botScrollRow; /* top and bottom scrolling rows */
|
||||
|
||||
int modifiedCol[MAXROW]; /* first modified column in each row;
|
||||
-1 if no column has been modified */
|
||||
|
||||
UNICHAR *screenChar; /* Screen character array (nRows*nCols long) */
|
||||
UNISTYLE *screenStyle; /* Screen style array (nRows*nCols long) */
|
||||
};
|
||||
|
||||
/* LTERM process structure: managed by lterm_create, lterm_close */
|
||||
struct LtermProcess {
|
||||
PROCESS processID; /* process ID */
|
||||
FILEDESC processIN; /* process input pipe */
|
||||
FILEDESC processOUT; /* process output pipe */
|
||||
FILEDESC processERR; /* process error pipe */
|
||||
};
|
||||
|
||||
/* line terminal (LTERM) structure: managed by lterm_open, lterm_close */
|
||||
struct lterms {
|
||||
int opened; /* LTERM opened status flag */
|
||||
int suspended; /* LTERM suspended flag:
|
||||
* an LTERM is suspended when an error
|
||||
* occurs, to prevent further I/O operations
|
||||
* which have unpredictable results.
|
||||
* The LTERM still needs to be closed to
|
||||
* release any resources used by it.
|
||||
* (a suspended LTERM is still open)
|
||||
*/
|
||||
|
||||
MUTEX_DECLARE(adminMutex); /* LTERM administrative mutex */
|
||||
MUTEX_DECLARE(outputMutex); /* LTERM output thread mutex */
|
||||
|
||||
int adminMutexLocked; /* administrative mutex lock status */
|
||||
int outputMutexLocked; /* output mutex lock status */
|
||||
|
||||
FILEDESC writeBUFFER, readBUFFER; /* input character BUFFER pipe */
|
||||
|
||||
int options; /* TTY options */
|
||||
int ptyMode; /* pseudo-TTY mode flag */
|
||||
int noTTYEcho; /* no TTY echo flag */
|
||||
int disabledInputEcho; /* disabled input echo flag */
|
||||
int restoreInputEcho; /* restore input echo flag */
|
||||
|
||||
int processType; /* Process type code */
|
||||
int maxInputMode; /* maximum allowed input mode value */
|
||||
int readERRfirst; /* Read STDERR before STDOUT */
|
||||
int interleave; /* interleave STDERR/STDOUT flag */
|
||||
UNICHAR control[MAXTTYCONTROL]; /* TTY control characters */
|
||||
|
||||
|
||||
int commandNumber; /* output command number
|
||||
* (0 if not command line)
|
||||
*/
|
||||
unsigned short lastCommandNum; /* last command number */
|
||||
int completionRequest; /* command completion request code:
|
||||
* LTERM_NO_COMPLETION, or
|
||||
* LTERM_TAB_COMPLETION, or
|
||||
* LTERM_HISTORY_COMPLETION
|
||||
*/
|
||||
int completionChars; /* command completion insert count */
|
||||
|
||||
int inputBufRecord; /* True if input buffer contains record */
|
||||
|
||||
int inputLineBreak; /* True if input line was transmitted
|
||||
* and plain text copy saved in echo buffer
|
||||
*/
|
||||
UNICHAR echoLine[MAXCOL]; /* Plain text of echo line */
|
||||
int echoChars; /* Count of echo characters */
|
||||
|
||||
int nRows; /* Number of rows */
|
||||
int nCols; /* Number of columns */
|
||||
int xPixels; /* Number of X pixels in screen */
|
||||
int yPixels; /* Number of Y pixels in screen */
|
||||
|
||||
UNICHAR promptRegexp[MAXPROMPT]; /* prompt regular expression
|
||||
JUST A LIST OF DELIMITERS AT PRESENT */
|
||||
|
||||
char cookie[MAXCOOKIESTR]; /* cookie string */
|
||||
char shellInitStr[MAXSHELLINITSTR];
|
||||
/* shell initialization string */
|
||||
int shellInitFlag; /* shell initialization flag */
|
||||
|
||||
struct ptys pty; /* pseudo-tty (PTY) stream info for LTERM */
|
||||
struct LtermProcess ltermProcess; /* LTERM process structure */
|
||||
struct LtermInput ltermInput; /* LTERM input structure */
|
||||
struct LtermOutput ltermOutput; /* LTERM output structure */
|
||||
};
|
||||
|
||||
/* LTERM global variables */
|
||||
typedef struct {
|
||||
int initialized; /* Initialization flag */
|
||||
struct lterms *termList[MAXTERM]; /* List of LTERMS */
|
||||
MUTEX_DECLARE(listMutex); /* Thread lock to access to LTERM list */
|
||||
UNICHAR metaDelimiter; /* Meta command delimiter (usually :) */
|
||||
char escapeChars[LTERM_XML_ESCAPES+1]; /* String of chars escaped in XML */
|
||||
UNICHAR escapeSeq[LTERM_XML_ESCAPES][LTERM_MAXCHAR_ESCAPE+1];
|
||||
/* XML character escape sequences */
|
||||
int escapeLen[LTERM_XML_ESCAPES]; /* XML char. escape sequence lengths */
|
||||
} LtermGlobal;
|
||||
|
||||
extern LtermGlobal ltermGlobal;
|
||||
|
||||
|
||||
/* Visible prototypes */
|
||||
|
||||
/* ltermIO.c */
|
||||
int ltermInterruptOutput(struct lterms *lts);
|
||||
int ltermSendLine(struct lterms *lts, UNICHAR uch,
|
||||
int echoControl, int completionCode);
|
||||
int ltermRead(struct lterms *lts, struct LtermRead *ltr, int timeout);
|
||||
|
||||
/* ltermInput.c */
|
||||
int ltermPlainTextInput(struct lterms *lts,
|
||||
const UNICHAR *buf, int count, int *opcodes);
|
||||
int ltermCancelCompletion(struct lterms *lts);
|
||||
int ltermInsertChar(struct LtermInput *lti, UNICHAR uch);
|
||||
void ltermSwitchToRawMode(struct lterms *lts);
|
||||
void ltermClearInputLine(struct lterms *lts);
|
||||
int ltermDeleteGlyphs(struct LtermInput *lti, int count);
|
||||
int ltermSendData(struct lterms *lts, const UNICHAR *buf, int count);
|
||||
int ltermSendChar(struct lterms *lts, const char *buf, int count);
|
||||
|
||||
/* ltermOutput.c */
|
||||
int ltermProcessOutput(struct lterms *lts, int *opcodes, int *opvals,
|
||||
int *oprow);
|
||||
int ltermReceiveData(struct lterms *lts, int readERR);
|
||||
void ltermClearOutputLine(struct lterms *lts);
|
||||
int ltermClearOutputScreen(struct lterms *lts);
|
||||
int ltermSwitchToStreamMode(struct lterms *lts, int streamOpcodes,
|
||||
const UNICHAR *streamTerminator);
|
||||
int ltermSwitchToScreenMode(struct lterms *lts);
|
||||
int ltermSwitchToLineMode(struct lterms *lts);
|
||||
|
||||
/* ltermEscape.c */
|
||||
int ltermProcessEscape(struct lterms *lts, const UNICHAR *buf,
|
||||
int count, const UNISTYLE *style, int *consumed,
|
||||
int *opcodes, int *opvals, int *oprow);
|
||||
int ltermInsDelEraseChar(struct lterms *lts, int count, int action);
|
||||
int ltermInsDelEraseLine(struct lterms *lts, int count, int row, int action);
|
||||
|
||||
#endif /* _LTERMPRIVATE_H */
|
|
@ -1,38 +0,0 @@
|
|||
// XMLTerm Chrome Commands
|
||||
|
||||
function StartupXMLTerm() {
|
||||
dump("StartupXMLTerm:\n");
|
||||
dump("StartupXMLTerm:"+window.frames.length+"\n");
|
||||
dump("StartupXMLTerm:"+window.frames[0].name+"\n");
|
||||
|
||||
if (window.frames.length == 2) {
|
||||
xmltwin = window.frames[1];
|
||||
xmltwin.xmltbrowser = window.frames[0];
|
||||
} else {
|
||||
xmltwin = window.frames[0];
|
||||
}
|
||||
|
||||
dump("StartupXMLterm: WINDOW.ARGUMENTS="+window.arguments+"\n");
|
||||
|
||||
dump("Trying to make an XMLTerm Shell through the component manager...\n");
|
||||
|
||||
var xmltshell = Components.classes["component://mozilla/xmlterm/xmltermshell"].createInstance();
|
||||
|
||||
dump("Interface xmltshell1 = " + xmltshell + "\n");
|
||||
|
||||
xmltshell = xmltshell.QueryInterface(Components.interfaces.mozIXMLTermShell);
|
||||
dump("Interface xmltshell2 = " + xmltshell + "\n");
|
||||
|
||||
if (!xmltshell) {
|
||||
dump("Failed to create XMLTerm shell\n");
|
||||
window.close();
|
||||
return;
|
||||
}
|
||||
|
||||
// Store the XMLTerm shell in current window and in the XMLTerm frame
|
||||
window.xmlterm = xmltshell;
|
||||
xmltwin.xmlterm = xmltshell;
|
||||
|
||||
// Initialize XMLTerm shell in content window with argvals
|
||||
window.xmlterm.Init(xmltwin, "", window.arguments);
|
||||
}
|
|
@ -1,732 +0,0 @@
|
|||
// XMLTerm Page Commands
|
||||
|
||||
// CONVENTION: All pre-defined XMLTerm Javascript functions and global
|
||||
// variables should begin with an upper-case letter.
|
||||
// This would allow them to be easily distinguished from
|
||||
// user defined functions, which should begin with a lower case
|
||||
// letter.
|
||||
|
||||
// Global variables
|
||||
var AltWin; // Alternate (browser) window
|
||||
|
||||
var Tips = new Array(); // Usage tip strings
|
||||
var TipNames = new Array(); // Usage tip names
|
||||
var TipCount = 0; // No. of tips
|
||||
var SelectedTip = 0; // Selected random tip
|
||||
|
||||
// Set prompt using form entry
|
||||
function DefineTip(tip, name) {
|
||||
Tips[TipCount] = tip;
|
||||
TipNames[TipCount] = name;
|
||||
TipCount++;
|
||||
return;
|
||||
}
|
||||
|
||||
DefineTip('Click the new tip link to the left to get a new tip!',
|
||||
'tips');
|
||||
|
||||
DefineTip('User level setting (at the top) controls amount of help information',
|
||||
'level');
|
||||
|
||||
DefineTip('Beginner level setting displays keyboard shortcuts at the top of the page',
|
||||
'level');
|
||||
|
||||
DefineTip('Icons setting controls whether directory listings use icons',
|
||||
'icons');
|
||||
|
||||
DefineTip('Single click an explicit (underlined) hyperlink; double click implicit (usually blue) hyperlinks',
|
||||
'clicking');
|
||||
|
||||
DefineTip('Clicking on command prompt expands/collapses command output display.',
|
||||
'prompt');
|
||||
|
||||
DefineTip('Press F1 (or control-Home) key to collapse output of all commands.',
|
||||
'prompt');
|
||||
|
||||
DefineTip('"js:SetPrompt(HTMLstring);" sets prompt to any HTML string.',
|
||||
'prompt');
|
||||
|
||||
DefineTip('Beginners may click the SetPrompt button for a cool Mozilla prompt from dmoz.org!',
|
||||
'prompt');
|
||||
|
||||
DefineTip('Double-clicking on a previous command line re-executes the command.',
|
||||
'command');
|
||||
|
||||
DefineTip('Type "js:func(arg);" to execute inline Javascript function func.',
|
||||
'js');
|
||||
|
||||
DefineTip('Inline Javascript ("js:...") can be used to produce HTML output.',
|
||||
'js');
|
||||
|
||||
DefineTip('XMLterm supports full screen commands like "less", "vi", and "emacs -nw"".',
|
||||
'full-screen');
|
||||
|
||||
DefineTip('"xls" produces a clickable listing of directory contents.',
|
||||
'xls');
|
||||
|
||||
DefineTip('"xls -t" prevents display of icons even if Icons setting is "on".',
|
||||
'xls');
|
||||
|
||||
DefineTip('"xcat text-file" displays a text file with clickable URLs.',
|
||||
'xcat');
|
||||
|
||||
DefineTip('"xcat image.gif" displays an image file inline!',
|
||||
'xcat');
|
||||
|
||||
DefineTip('"xcat http://mozilla.org" displays a web page inline using IFRAMEs.',
|
||||
'xcat');
|
||||
|
||||
DefineTip('"xcat -h 1000 http://mozilla.org" displays using an IFRAME 1000 pixels high.',
|
||||
'xcat');
|
||||
|
||||
DefineTip('"xcat doc.html" display an HTML document inline using IFRAMEs.',
|
||||
'xcat');
|
||||
|
||||
// Display random usage tip
|
||||
// (should cease to operate after a few cycles;
|
||||
// need to use Prefs to keep track of that)
|
||||
function NewTip() {
|
||||
var ranval = Math.random();
|
||||
SelectedTip = Math.floor(ranval * TipCount);
|
||||
if (SelectedTip >= TipCount) SelectedTip = 0;
|
||||
|
||||
dump("xmlterm: NewTip "+SelectedTip+","+ranval+"\n");
|
||||
|
||||
var tipdata = document.getElementById('tipdata');
|
||||
tipdata.firstChild.data = Tips[SelectedTip];
|
||||
|
||||
ShowHelp("",0);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Explain tip
|
||||
function ExplainTip(tipName) {
|
||||
dump("xmlterm: ExplainTip("+tipName+")\n");
|
||||
|
||||
if (tipName) {
|
||||
var tipdata = document.getElementById('tipdata');
|
||||
tipdata.firstChild.data = "";
|
||||
} else {
|
||||
tipName = TipNames[SelectedTip];
|
||||
}
|
||||
|
||||
ShowHelp('xmltermTips.html#'+tipName,0,120);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// F1 key - Hide all output
|
||||
function F1Key(isShift, isControl) {
|
||||
return DisplayAllOutput(false);
|
||||
}
|
||||
|
||||
// F2 key - Show all output
|
||||
function F2Key(isShift, isControl) {
|
||||
return DisplayAllOutput(true);
|
||||
}
|
||||
|
||||
// F7 - Explain tip
|
||||
function F7Key(isShift, isControl) {
|
||||
return ExplainTip();
|
||||
}
|
||||
|
||||
// F8 - New tip
|
||||
function F8Key(isShift, isControl) {
|
||||
return NewTip();
|
||||
}
|
||||
|
||||
// F9 key
|
||||
function F9Key(isShift, isControl) {
|
||||
return NewXMLTerm('');
|
||||
}
|
||||
|
||||
// Scroll Home key
|
||||
function ScrollHomeKey(isShift, isControl) {
|
||||
dump("ScrollHomeKey("+isShift+","+isControl+")\n");
|
||||
|
||||
if (isControl) {
|
||||
return F1Key(isShift, 0);
|
||||
} else {
|
||||
ScrollWin(isShift,isControl).scroll(0,0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Scroll End key
|
||||
function ScrollEndKey(isShift, isControl) {
|
||||
dump("ScrollEndKey("+isShift+","+isControl+")\n");
|
||||
|
||||
if (isControl) {
|
||||
return F2Key(isShift, 0);
|
||||
} else {
|
||||
ScrollWin(isShift,isControl).scroll(0,99999);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Scroll PageUp key
|
||||
function ScrollPageUpKey(isShift, isControl) {
|
||||
dump("ScrollPageUpKey("+isShift+","+isControl+")\n");
|
||||
|
||||
ScrollWin(isShift,isControl).scrollBy(0,-120);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Scroll PageDown key
|
||||
function ScrollPageDownKey(isShift, isControl) {
|
||||
dump("ScrollPageDownKey("+isShift+","+isControl+")\n");
|
||||
|
||||
ScrollWin(isShift,isControl).scrollBy(0,120);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Scroll Window
|
||||
function ScrollWin(isShift, isControl) {
|
||||
if (isShift && (window.frames.length > 0)) {
|
||||
return window.frames[window.frames.length-1];
|
||||
} else {
|
||||
return window;
|
||||
}
|
||||
}
|
||||
|
||||
// Set history buffer size
|
||||
function SetHistory(value) {
|
||||
dump("SetHistory("+value+")\n");
|
||||
window.xmlterm.SetHistory(value, document.cookie);
|
||||
return (false);
|
||||
}
|
||||
|
||||
// Set prompt
|
||||
function SetPrompt(value) {
|
||||
dump("SetPrompt("+value+")\n");
|
||||
window.xmlterm.SetPrompt(value, document.cookie);
|
||||
return (false);
|
||||
}
|
||||
|
||||
// Create new XMLTerm window
|
||||
function NewXMLTerm(firstcommand) {
|
||||
newwin = window.openDialog( "chrome://xmlterm/content/xmlterm.xul",
|
||||
"xmlterm", "chrome,dialog=no,resizable",
|
||||
firstcommand);
|
||||
//newwin = window.xmlterm.NewXMLTermWindow(firstcommand);
|
||||
dump("NewXMLTerm: "+newwin+"\n")
|
||||
return (false);
|
||||
}
|
||||
|
||||
// Handle resize events
|
||||
function Resize(event) {
|
||||
dump("Resize()\n");
|
||||
window.xmlterm.Resize();
|
||||
return (false);
|
||||
}
|
||||
|
||||
// Form Focus (workaround for form input being transmitted to xmlterm)
|
||||
function FormFocus() {
|
||||
dump("FormFocus()\n");
|
||||
window.xmlterm.IgnoreKeyPress(true, document.cookie);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Form Blur (workaround for form input being transmitted to xmlterm)
|
||||
function FormBlur() {
|
||||
dump("FormBlur()\n");
|
||||
window.xmlterm.IgnoreKeyPress(false, document.cookie);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set user level
|
||||
function UpdateSettings() {
|
||||
|
||||
var oldUserLevel = window.userLevel;
|
||||
window.userLevel = document.xmltform1.level.options[document.xmltform1.level.selectedIndex].value;
|
||||
|
||||
var oldShowIcons = window.showIcons;
|
||||
window.showIcons = document.xmltform1.icons.options[document.xmltform1.icons.selectedIndex].value;
|
||||
|
||||
//window.windowsMode = document.xmltform1.windows.options[document.xmltform1.windows.selectedIndex].value;
|
||||
|
||||
dump("UpdateSettings: userLevel="+window.userLevel+"\n");
|
||||
dump("UpdateSettings: windowsMode="+window.windowsMode+"\n");
|
||||
dump("UpdateSettings: showIcons="+window.showIcons+"\n");
|
||||
|
||||
if (window.userLevel != oldUserLevel) {
|
||||
// Change icon display style in the style sheet
|
||||
|
||||
if (window.userLevel == "advanced") {
|
||||
AlterStyle("DIV.beginner", "display", "none");
|
||||
AlterStyle("DIV.intermediate", "display", "none");
|
||||
|
||||
} else if (window.userLevel == "intermediate") {
|
||||
AlterStyle("DIV.intermediate", "display", "block");
|
||||
AlterStyle("DIV.beginner", "display", "none");
|
||||
|
||||
} else {
|
||||
AlterStyle("DIV.beginner", "display", "block");
|
||||
AlterStyle("DIV.intermediate", "display", "block");
|
||||
}
|
||||
}
|
||||
|
||||
if (window.showIcons != oldShowIcons) {
|
||||
// Change icon display style in the style sheet
|
||||
|
||||
if (window.showIcons == "on") {
|
||||
AlterStyle("SPAN.noicons", "display", "none");
|
||||
AlterStyle("SPAN.icons", "display", "inline");
|
||||
AlterStyle("IMG.icons", "display", "inline");
|
||||
AlterStyle("TR.icons", "display", "table-row");
|
||||
|
||||
} else {
|
||||
AlterStyle("SPAN.noicons", "display", "inline");
|
||||
AlterStyle("SPAN.icons", "display", "none");
|
||||
AlterStyle("IMG.icons", "display", "none");
|
||||
AlterStyle("TR.icons", "display", "none");
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Alter style in stylesheet of specified document doc, or current document
|
||||
// if doc is omitted.
|
||||
function AlterStyle(ruleName, propertyName, propertyValue, doc) {
|
||||
|
||||
dump("AlterStyle("+ruleName+"{"+propertyName+":"+propertyValue+"})\n");
|
||||
|
||||
if (!doc) doc = window.document;
|
||||
|
||||
var sheet = doc.styleSheets[0];
|
||||
var r;
|
||||
for (r = 0; r < sheet.cssRules.length; r++) {
|
||||
//dump(sheet.cssRules[r].selectorText+"\n");
|
||||
|
||||
if (sheet.cssRules[r].selectorText == ruleName) {
|
||||
var style = sheet.cssRules[r].style;
|
||||
//dump("style="+style.getPropertyValue(propertyName)+"\n");
|
||||
|
||||
style.setProperty(propertyName,propertyValue,"");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Handle default meta command
|
||||
function MetaDefault(arg1) {
|
||||
return Load("http://"+arg1);
|
||||
}
|
||||
|
||||
// Load URL in XMLTermBrowser window
|
||||
function Load(url) {
|
||||
var succeeded = false;
|
||||
if (window.xmltbrowser) {
|
||||
dump("Load:xmltbrowser.location.href="+window.xmltbrowser.location.href+"\n");
|
||||
if (window.xmltbrowser.location.href.length) {
|
||||
window.xmltbrowser.location = url;
|
||||
succeeded = true;
|
||||
}
|
||||
}
|
||||
if (!succeeded) {
|
||||
window.xmltbrowser = window.open(url, "xmltbrowser");
|
||||
}
|
||||
|
||||
// Save browser window object in global variable
|
||||
AltWin = window.xmltbrowser;
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
// Control display of all output elements
|
||||
function DisplayAllOutput(flag) {
|
||||
var outputElements = document.getElementsByName("output");
|
||||
for (i=0; i<outputElements.length-1; i++) {
|
||||
var outputElement = outputElements[i];
|
||||
outputElement.style.display = (flag) ? "block" : "none";
|
||||
}
|
||||
|
||||
var promptElements = document.getElementsByName("prompt");
|
||||
for (i=0; i<promptElements.length-1; i++) {
|
||||
promptElement = promptElements[i];
|
||||
promptElement.style.setProperty("text-decoration",
|
||||
(flag) ? "none" : "underline", "")
|
||||
}
|
||||
|
||||
if (!flag) {
|
||||
ScrollHomeKey(0,0);
|
||||
ScrollEndKey(0,0);
|
||||
}
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
// Centralized event handler
|
||||
// eventType values:
|
||||
// click
|
||||
//
|
||||
// targetType:
|
||||
// textlink - hyperlink
|
||||
// prompt - command prompt
|
||||
// command - command line
|
||||
//
|
||||
// (Following are inline or in new window depending upon window.windowsMode)
|
||||
// cdxls - change directory and list contents (doubleclick)
|
||||
// xcat - display file (doubleclick)
|
||||
// exec - execute file (doubleclick)
|
||||
//
|
||||
// send - transmit arg to LineTerm
|
||||
// sendln - transmit arg+newline to LineTerm
|
||||
// createln - transmit arg+newline as first command to new XMLTerm
|
||||
//
|
||||
// entryNumber: >=0 means process only if current entry
|
||||
// <0 means process anytime
|
||||
//
|
||||
// arg1: relative pathname of file/directory
|
||||
// arg2: absolute pathname prefix (for use outside current entry;
|
||||
// use relative pathname in current working directory)
|
||||
//
|
||||
function HandleEvent(eventObj, eventType, targetType, entryNumber,
|
||||
arg1, arg2) {
|
||||
dump("HandleEvent("+eventObj+","+eventType+","+targetType+","+
|
||||
entryNumber+","+arg1+","+arg2+")\n");
|
||||
|
||||
// Entry independent targets
|
||||
if (action === "textlink") {
|
||||
// Single click opens hyperlink
|
||||
// Browser-style
|
||||
dump("textlink = "+arg1+"\n");
|
||||
Load(arg1);
|
||||
|
||||
} else if (targetType === "prompt") {
|
||||
// Single click on prompt expands/collapses command output
|
||||
var outputElement = document.getElementById("output"+entryNumber);
|
||||
var helpElement = document.getElementById("help"+entryNumber);
|
||||
var promptElement = document.getElementById("prompt"+entryNumber);
|
||||
//dump(promptElement.style.getPropertyValue("text-decoration"));
|
||||
|
||||
if (outputElement.style.display == "none") {
|
||||
outputElement.style.display = "block";
|
||||
promptElement.style.setProperty("text-decoration","none","");
|
||||
|
||||
} else {
|
||||
outputElement.style.display = "none";
|
||||
promptElement.style.setProperty("text-decoration","underline","");
|
||||
if (helpElement) {
|
||||
ShowHelp("",entryNumber);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (eventType === "click") {
|
||||
|
||||
dump("clickCount="+eventObj.clickCount+"\n");
|
||||
|
||||
var shiftClick = eventObj.shiftKey;
|
||||
var dblClick = (eventObj.clickCount == 2);
|
||||
|
||||
// Execute shell commands only on double-click for safety
|
||||
// Use single click for "selection" and prompt expansion only
|
||||
// Windows-style
|
||||
|
||||
var currentEntryNumber = window.xmlterm.currentEntryNumber;
|
||||
|
||||
var currentCmdElement = document.getElementById("command"+currentEntryNumber);
|
||||
var currentCommandEmpty = true;
|
||||
if (currentCmdElement && currentCmdElement.hasChildNodes()) {
|
||||
|
||||
if (currentCmdElement.firstChild.nodeType == Node.TEXT_NODE) {
|
||||
//dump("textLength = "+currentCmdElement.firstChild.data.length+"\n");
|
||||
currentCommandEmpty = (currentCmdElement.firstChild.data.length == 0);
|
||||
|
||||
} else {
|
||||
currentCommandEmpty = false;
|
||||
}
|
||||
}
|
||||
//dump("empty = "+currentCommandEmpty+"\n");
|
||||
|
||||
if (targetType === "command") {
|
||||
if (!dblClick)
|
||||
return false;
|
||||
var commandElement = document.getElementById(targetType+entryNumber);
|
||||
var command = commandElement.firstChild.data;
|
||||
if (currentCommandEmpty) {
|
||||
window.xmlterm.SendText("\025"+command+"\n", document.cookie);
|
||||
} else {
|
||||
window.xmlterm.SendText(command, document.cookie);
|
||||
}
|
||||
|
||||
} else {
|
||||
// Targets which may be qualified only for current entry
|
||||
|
||||
if ((entryNumber >= 0) &&
|
||||
(window.xmlterm.currentEntryNumber != entryNumber)) {
|
||||
dump("NOT CURRENT COMMAND\n");
|
||||
return (false);
|
||||
}
|
||||
|
||||
var action, sendStr;
|
||||
|
||||
if ( (targetType === "cdxls") ||
|
||||
(targetType === "xcat") ||
|
||||
(targetType === "exec") ) {
|
||||
// Complex commands
|
||||
|
||||
if (!dblClick)
|
||||
return false;
|
||||
|
||||
var filename;
|
||||
var isCurrentCommand = (Math.abs(entryNumber)+1 ==
|
||||
window.xmlterm.currentEntryNumber);
|
||||
|
||||
if (!isCurrentCommand && (arg2 != null)) {
|
||||
filename = arg2+arg1;
|
||||
} else {
|
||||
filename = arg1;
|
||||
if (targetType === "exec")
|
||||
filename = "./"+filename;
|
||||
}
|
||||
|
||||
var prefix, suffix;
|
||||
if (targetType === "cdxls") {
|
||||
// Change directory and list contents
|
||||
prefix = "cd ";
|
||||
suffix = "; xls";
|
||||
} else if (targetType === "xcat") {
|
||||
// Display file
|
||||
prefix = "xcat ";
|
||||
suffix = "";
|
||||
} else if (targetType === "exec") {
|
||||
// Execute file
|
||||
prefix = "";
|
||||
suffix = "";
|
||||
}
|
||||
|
||||
if (shiftClick || (window.windowsMode === "on")) {
|
||||
action = "createln";
|
||||
sendStr = prefix + filename + suffix;
|
||||
|
||||
} else if (currentCommandEmpty) {
|
||||
action = "sendln";
|
||||
sendStr = prefix + filename + suffix;
|
||||
|
||||
} else {
|
||||
action = "send";
|
||||
sendStr = filename + " ";
|
||||
}
|
||||
|
||||
} else {
|
||||
// Primitive action
|
||||
action = targetType;
|
||||
sendStr = arg1;
|
||||
}
|
||||
|
||||
// Primitive actions
|
||||
if (action === "send") {
|
||||
dump("send = "+sendStr+"\n");
|
||||
window.xmlterm.SendText(sendStr, document.cookie);
|
||||
|
||||
} else if (action === "sendln") {
|
||||
dump("sendln = "+sendStr+"\n\n");
|
||||
window.xmlterm.SendText("\025"+sendStr+"\n", document.cookie);
|
||||
|
||||
} else if (action === "createln") {
|
||||
dump("createln = "+sendStr+"\n\n");
|
||||
newwin = NewXMLTerm(sendStr+"\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
// Set history buffer count using form entry
|
||||
function SetHistoryValue() {
|
||||
var field = document.getElementById('inputvalue');
|
||||
return SetHistory(field.value);
|
||||
}
|
||||
|
||||
// Set prompt using form entry
|
||||
function SetPromptValue() {
|
||||
var field = document.getElementById('inputvalue');
|
||||
return SetPrompt(field.value);
|
||||
}
|
||||
|
||||
// Insert help element displaying URL in an IFRAME before output element
|
||||
// of entryNumber, or before the SESSION element if entryNumber is zero.
|
||||
// Height is the height of the IFRAME in pixels.
|
||||
// If URL is the null string, simply delete the help element
|
||||
|
||||
function ShowHelp(url, entryNumber, height) {
|
||||
|
||||
if (!height) height = 120;
|
||||
|
||||
dump("xmlterm: ShowHelp("+url+","+entryNumber+","+height+")\n");
|
||||
|
||||
if (entryNumber) {
|
||||
beforeID = "output"+entryNumber;
|
||||
helpID = "help"+entryNumber;
|
||||
} else {
|
||||
beforeID = "session";
|
||||
helpID = "help";
|
||||
}
|
||||
|
||||
var beforeElement = document.getElementById(beforeID);
|
||||
|
||||
if (!beforeElement) {
|
||||
dump("InsertIFrame: beforeElement ID="+beforeID+"not found\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
var parentNode = beforeElement.parentNode;
|
||||
|
||||
var helpElement = document.getElementById(helpID);
|
||||
if (helpElement) {
|
||||
// Delete help element
|
||||
parentNode.removeChild(helpElement);
|
||||
helpElement = null;
|
||||
// *NOTE* Need to flush display here to avoid black flash?
|
||||
}
|
||||
|
||||
if (url.length > 0) {
|
||||
// Create new help element
|
||||
helpElement = document.createElement("div");
|
||||
helpElement.setAttribute('id', helpID);
|
||||
helpElement.setAttribute('class', 'help');
|
||||
|
||||
var closeElement = document.createElement("span");
|
||||
closeElement.setAttribute('class', 'helplink');
|
||||
closeElement.appendChild(document.createTextNode("Close help frame"));
|
||||
//closeElement.appendChild(document.createElement("p"));
|
||||
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.setAttribute('id', helpID+'frame');
|
||||
iframe.setAttribute('class', 'helpframe');
|
||||
iframe.setAttribute('width', '100%');
|
||||
iframe.setAttribute('height', height);
|
||||
iframe.setAttribute('frameborder', '0');
|
||||
iframe.setAttribute('src', url);
|
||||
|
||||
helpElement.appendChild(iframe);
|
||||
helpElement.appendChild(closeElement);
|
||||
|
||||
dump(helpElement);
|
||||
|
||||
// Insert help element
|
||||
parentNode.insertBefore(helpElement, beforeElement);
|
||||
|
||||
// NOTE: Need to do this *after* node is inserted into document
|
||||
closeElement.setAttribute('onClick', 'return ShowHelp("",'+entryNumber
|
||||
+');');
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// About XMLTerm
|
||||
function AboutXMLTerm() {
|
||||
dump("xmlterm: AboutXMLTerm\n");
|
||||
|
||||
var tipdata = document.getElementById('tipdata');
|
||||
tipdata.firstChild.data = "";
|
||||
|
||||
ShowHelp('xmltermAbout.html',0,120);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// onLoad event handler
|
||||
function LoadHandler() {
|
||||
dump("xmlterm: LoadHandler ... "+window.xmlterm+"\n");
|
||||
|
||||
// Update settings
|
||||
UpdateSettings();
|
||||
|
||||
NewTip();
|
||||
|
||||
if (window.xmlterm) {
|
||||
// XMLTerm already initialized
|
||||
return (false);
|
||||
}
|
||||
|
||||
dump("LoadHandler: WINDOW.ARGUMENTS="+window.arguments+"\n");
|
||||
|
||||
dump("Trying to make an XMLTerm Shell through the component manager...\n");
|
||||
|
||||
var xmltshell = Components.classes["component://mozilla/xmlterm/xmltermshell"].createInstance();
|
||||
|
||||
dump("Interface xmltshell1 = " + xmltshell + "\n");
|
||||
|
||||
xmltshell = xmltshell.QueryInterface(Components.interfaces.mozIXMLTermShell);
|
||||
dump("Interface xmltshell2 = " + xmltshell + "\n");
|
||||
|
||||
if (!xmltshell) {
|
||||
dump("Failed to create XMLTerm shell\n");
|
||||
window.close();
|
||||
return;
|
||||
}
|
||||
|
||||
// Store the XMLTerm shell in the window
|
||||
window.xmlterm = xmltshell;
|
||||
|
||||
// Content window same as current window
|
||||
var contentWindow = window;
|
||||
|
||||
// Initialize XMLTerm shell in content window with argvals
|
||||
window.xmlterm.Init(contentWindow, "", "");
|
||||
|
||||
//dump("LoadHandler:"+document.cookie+"\n");
|
||||
|
||||
dump("contentWindow="+contentWindow+"\n");
|
||||
dump("document="+document+"\n");
|
||||
dump("documentElement="+document.documentElement+"\n");
|
||||
|
||||
// Handle resize events
|
||||
//contentWindow.addEventListener("onresize", Resize);
|
||||
contentWindow.onresize = Resize;
|
||||
|
||||
// Set focus to appropriate frame
|
||||
contentWindow.focus();
|
||||
|
||||
//contentWindow.xmlterm = xmlterm;
|
||||
|
||||
//dump(contentWindow.xmlterm);
|
||||
|
||||
// The following code is for testing IFRAMEs only
|
||||
dump("[Main] "+window+"\n");
|
||||
dump(window.screenX+", "+window.screenY+"\n");
|
||||
dump(window.scrollX+", "+window.scrollY+"\n");
|
||||
dump(window.pageXOffset+", "+window.pageYOffset+"\n");
|
||||
|
||||
dump("IFRAME checks\n");
|
||||
var iframe = document.getElementById('iframe1');
|
||||
|
||||
dump("iframe="+iframe+"\n");
|
||||
|
||||
frames=document.frames;
|
||||
dump("frames="+frames+"\n");
|
||||
dump("frames.length="+frames.length+"\n");
|
||||
|
||||
framewin = frames[0];
|
||||
|
||||
dump("framewin="+framewin+"\n");
|
||||
dump("framewin.document="+framewin.document+"\n");
|
||||
|
||||
dump(framewin.screenX+", "+framewin.screenY+"\n");
|
||||
dump(framewin.scrollX+", "+framewin.scrollY+"\n");
|
||||
dump(framewin.pageXOffset+", "+framewin.pageYOffset+"\n");
|
||||
|
||||
var body = framewin.document.getElementsByTagName("BODY")[0];
|
||||
dump("body="+body+"\n");
|
||||
|
||||
var height= body.scrollHeight;
|
||||
dump("height="+height+"\n");
|
||||
|
||||
// iframe.height = 800;
|
||||
// iframe.width = 700;
|
||||
|
||||
// framewin.sizeToContent();
|
||||
|
||||
framewin.xmltshell = xmltshell;
|
||||
dump(framewin.xmltshell+"\n");
|
||||
|
||||
dump("xmlterm: LoadHandler completed\n");
|
||||
return (false);
|
||||
}
|
||||
|
|
@ -1,126 +0,0 @@
|
|||
<!-- xmlterm.html: xmlterm page -->
|
||||
<html>
|
||||
<head>
|
||||
<title>xmlterm page</title>
|
||||
|
||||
<link title="defaultstyle" rel="stylesheet" type="text/css"
|
||||
href="chrome://xmlterm/skin/xmltpage.css">
|
||||
|
||||
<script language="JavaScript" src="XMLTermCommands.js">
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body onload="return LoadHandler();">
|
||||
|
||||
<form name="xmltform1">
|
||||
|
||||
<input type="button" value="New XMLTerm"
|
||||
onClick="return NewXMLTerm('');">
|
||||
|
||||
<span class="helplink" onclick="return ExplainTip('level-setting');">
|
||||
Level:</span>
|
||||
<select name="level" size=1 onchange="return UpdateSettings();">
|
||||
<option value="beginner">beginner</option>
|
||||
<option value="intermediate" selected>intermediate</option>
|
||||
<option value="advanced">advanced</option>
|
||||
</select>
|
||||
|
||||
|
||||
<span class="helplink" onclick="return ExplainTip('icons-setting');">
|
||||
Icons:</span>
|
||||
<select name="icons" size=1 onchange="return UpdateSettings();">
|
||||
<option value="off" selected>off</option>
|
||||
<option value="on">on</option>
|
||||
</select>
|
||||
|
||||
<!--
|
||||
|
||||
<span class="helplink" onclick="return ExplainTip('windows-setting');">
|
||||
Windows:</span>
|
||||
<select name="windows" size=1 onchange="return UpdateSettings();">
|
||||
<option value="off" selected>off</option>
|
||||
<option value="on">on</option>
|
||||
</select>
|
||||
-->
|
||||
|
||||
<!--
|
||||
<input type="button" value="Save Settings"
|
||||
onClick="return SaveSettings();">
|
||||
-->
|
||||
|
||||
<span class="helplink" id="aboutxmlterm" onclick="return AboutXMLTerm();">
|
||||
About XMLTerm
|
||||
</span>
|
||||
<hr>
|
||||
</form>
|
||||
|
||||
<div class="intermediate">
|
||||
|
||||
<div class="beginner">
|
||||
<form name="xmltform2">
|
||||
<center> <span class="formhead">Keyboard shortcuts</span> </center>
|
||||
<table align=center>
|
||||
<tr>
|
||||
<td align=center> <span class="formhead">F1</span>
|
||||
<td align=center> <span class="formhead">F2</span>
|
||||
<td align=center> <span class="formhead">F7</span>
|
||||
<td align=center> <span class="formhead">F8</span>
|
||||
<td align=center> <span class="formhead">F9</span>
|
||||
<tr>
|
||||
<td align=center> <span class="formhead">ctl-Home</span>
|
||||
<td align=center> <span class="formhead">ctl-End</span>
|
||||
<tr>
|
||||
<td><input type="button" value="Hide all output"
|
||||
onClick="return F1Key();">
|
||||
<td><input type="button" value="Show all output"
|
||||
onClick="return F2Key();">
|
||||
<td><input type="button" value="Explain tip"
|
||||
onClick="return F7Key();">
|
||||
<td><input type="button" value="New tip"
|
||||
onClick="return F8Key();">
|
||||
<td><input type="button" value="New XMLTerm"
|
||||
onClick="return F9Key();">
|
||||
</table>
|
||||
<br>
|
||||
<input type="button" value="Set History"
|
||||
onClick="return SetHistoryValue();">
|
||||
<input type="button" value="Set Prompt"
|
||||
onClick="return SetPromptValue();">
|
||||
<span class="formhead">Value:</span>
|
||||
<input size=45 type="text" id="inputvalue"
|
||||
value="<img src='http:/dmoz.org/img/lizard2a.gif'>"
|
||||
onFocus="return FormFocus();" onBlur="return FormBlur();">
|
||||
</form>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<table id="xmlttip" width=100%>
|
||||
<tr><td align=left valign=top nowrap>
|
||||
<span class="helplink" id="tiphead" onclick="return NewTip();">
|
||||
New Tip:
|
||||
</span>
|
||||
<td align=left valign=top>
|
||||
<span class="tipdata" id="tipdata">
|
||||
|
||||
</span>
|
||||
<td align=right valign=top nowrap>
|
||||
<span class="helplink" id="explaintip" onclick="return ExplainTip();">
|
||||
Explain Tip
|
||||
</span>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<!--
|
||||
<iframe name="iframet" src="chrome://xmlterm/content/xmltblank.html"
|
||||
frameborder=0>
|
||||
</iframe>
|
||||
-->
|
||||
|
||||
<div class="session" id="session">
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,184 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>xmlterm page</title>
|
||||
|
||||
<link title="defaultstyle" rel="stylesheet" type="text/css"
|
||||
href="chrome://xmlterm/skin/xmltpage.css">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<a name='tips'></a>
|
||||
<table class="tiptable" width='100%' height=120 frame=none border=0
|
||||
cellpadding=0 cellspacing=0>
|
||||
<tr><td>
|
||||
<div class="tipelement">
|
||||
The tips feature provides a random usage tip every time you start-up xmlterm.
|
||||
<br>
|
||||
Click on the <span class="helphighlight">New Tip</span> link to the left,
|
||||
if you would like a new tip.<br>
|
||||
Click on the <span class="helphighlight">Explain Tip</span> link to the
|
||||
right, for more information on the tip.<br>
|
||||
Set user <span class="helphighlight">Level</span> to <b>advanced</b> to turn
|
||||
off
|
||||
tips.
|
||||
</div>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
|
||||
<a name='level'></a>
|
||||
<table class="tiptable" width='100%' height=120 frame=none border=0
|
||||
cellpadding=0 cellspacing=0>
|
||||
<tr><td>
|
||||
<div class="tipelement">
|
||||
The <b>level</b> setting is a measure of the user's familiarity with
|
||||
XMLterm features. The <em>beginner</em> setting can produce a lot of help
|
||||
information. The <em>intermediate</em> setting produces less information,
|
||||
and <em>advanced</em> setting produces virtually none.<br>
|
||||
</div>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
|
||||
|
||||
<a name='icons'></a>
|
||||
<table class="tiptable" width='100%' height=120 frame=none border=0
|
||||
cellpadding=0 cellspacing=0>
|
||||
<tr><td>
|
||||
<div class="tipelement">
|
||||
The <b>icons</b> preference setting determines whether icons should be used
|
||||
in XMLterm. If enabled, the prompt becomes an icon and directory listings
|
||||
become a GUI-style table of icons. This can use up a lot of screen space
|
||||
and slow things down on older computers.
|
||||
</div>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
|
||||
|
||||
<a name='clicking'></a>
|
||||
<table class="tiptable" width='100%' height=120 frame=none border=0
|
||||
cellpadding=0 cellspacing=0>
|
||||
<tr><td>
|
||||
<div class="tipelement">
|
||||
The browser interface uses one-click activation of commands whereas many
|
||||
GUIs use one-click selection and double-click activation. Since XMLterm
|
||||
has browser and GUI features, it can get a bit confusing. The rules are:
|
||||
Single click any explicit underlined <a href="#">hyperlink</a>,
|
||||
browser-style. Any highlighted implicit
|
||||
<span class="highlight">hyperlink</span> needs to be double clicked
|
||||
for activation, with the exception of the command prompt!
|
||||
</div>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
|
||||
|
||||
<a name='prompt'></a>
|
||||
<table class="tiptable" width='100%' height=120 frame=none border=0
|
||||
cellpadding=0 cellspacing=0>
|
||||
<tr><td>
|
||||
<div class="tipelement">
|
||||
Clicking on the command prompt expands/collapses the output associated with
|
||||
a command. An underlined prompt denotes the collapsed state.
|
||||
You can even click the prompt before you type the command, which would
|
||||
hide the output of the command! To hide the output of all commands,
|
||||
use the F1 (or ctl-Home) shortcut key.<br>
|
||||
Any string, plain text or HTML, may be used as the command prompt, by typing
|
||||
<b>js:SetPrompt('string')</b> in the command line. This means that you can
|
||||
use any image as a prompt, through the IMG element. The prompt can even be
|
||||
an animated GIF!
|
||||
</div>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
|
||||
<a name='command'></a>
|
||||
<table class="tiptable" width='100%' height=120 frame=none border=0
|
||||
cellpadding=0 cellspacing=0>
|
||||
<tr><td>
|
||||
<div class="tipelement">
|
||||
Double-clicking on any prior command line re-executes the command. This
|
||||
is similar to the facility provided by many shells for repeating commands.
|
||||
</div>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
|
||||
|
||||
<a name='js'></a>
|
||||
<table class="tiptable" width='100%' height=120 frame=none border=0
|
||||
cellpadding=0 cellspacing=0>
|
||||
<tr><td>
|
||||
<div class="tipelement">
|
||||
Typing <b>js:</b><em>statement</em> in the command line executes any valid
|
||||
Javascript <em>statement</em> in the context of the XMLterm window and
|
||||
displays its output. The Javascript code may produce a HTML fragment as its
|
||||
output, which is then appended to the XMLterm page.
|
||||
</div>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
|
||||
|
||||
<a name='full-screen'></a>
|
||||
<table class="tiptable" width='100%' height=120 frame=none border=0
|
||||
cellpadding=0 cellspacing=0>
|
||||
<tr><td>
|
||||
<div class="tipelement">
|
||||
The following full-screen commands appear to work with XMLTerm:<br>
|
||||
<b>less</b>, <b>vi</b>, <b>emacs -nw</b>, <b>man</b>, and <b>pine</b>.<br>
|
||||
<b>more</b> does not work at the moment; settle for <b>less</b>
|
||||
instead!<br>
|
||||
The XMLterm full screen implementation actually uses a bunch of PRE elements,
|
||||
one for each row.
|
||||
</div>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
|
||||
|
||||
<a name='xls'></a>
|
||||
<table class="tiptable" width='100%' height=120 frame=none border=0
|
||||
cellpadding=0 cellspacing=0>
|
||||
<tr><td>
|
||||
<div class="tipelement">
|
||||
<b>xls</b> <em>directory1 file2 ...</em> lists directory contents,
|
||||
analogous to the Unix <em>ls</em> command.<br>
|
||||
Double-clicking on a directory name makes it the current working directory
|
||||
and displays its contents.<br>
|
||||
Double-clicking on an executable file or script executes it in the current
|
||||
directory.<br>
|
||||
Double-clicking on other files runs the <a href='#xls'>xcat</a>
|
||||
command on the file.
|
||||
Set <a href='#icons'>Icons</a> setting to <em>on</em> to enable iconic
|
||||
directory listing.
|
||||
<br>
|
||||
</div>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
|
||||
|
||||
<a name='xcat'></a>
|
||||
<table class="tiptable" width='100%' height=120 frame=none border=0
|
||||
cellpadding=0 cellspacing=0>
|
||||
<tr><td>
|
||||
<div class="tipelement">
|
||||
<b>xcat</b> <em>file1 file2 ...</em> displays files, analogous to the Unix
|
||||
cat command. With xcat, you can use URLs instead of filenames!<br>
|
||||
Image files or URLs (GIF/PNG/JPEG) are rendered inline, providing a cool
|
||||
way to browse images<br>
|
||||
HTML files or URLs are displayed in an inline frame. The frame height,
|
||||
in pixels, may be specified using the <em>-h</em> option.<br>
|
||||
Text files are displayed with any embedded URLs highlighted (and clickable).
|
||||
</div>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче