Initial terminal size is now explicitly passed through parameters, providing
better control. Session aborts now produce an error message on the screen.
This commit is contained in:
svn%xmlterm.org 2000-04-04 04:42:27 +00:00
Родитель 3cf220e510
Коммит b79e09ced7
17 изменённых файлов: 252 добавлений и 730 удалений

Просмотреть файл

@ -1,403 +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.
*/
/* lineterm.h: Line terminal (LTERM) public interface header file
* LINETERM provides a "stream" interface to an XTERM-like terminal,
* using line-oriented input/output.
*/
#ifndef _LINETERM_H
#define _LINETERM_H 1
#include "unistring.h"
/* Define LTERM read callback function type */
#ifdef USE_GTK_WIDGETS
#include <gtk/gtk.h>
typedef void (*lterm_callback_func_t)(gpointer, gint, GdkInputCondition);
#else
typedef void* lterm_callback_func_t;
#endif
/* Unicode character style information (same type as UNICHAR) */
typedef UNICHAR UNISTYLE;
#ifdef __cplusplus
extern "C" {
#endif
/* lineterm functions */
/* LTERM module number (used for trace/log operations) */
#define LTERM_TLOG_MODULE 1
/** Initializes all LTERM operations;
* needs to be called before any calls to lterm_new.
* @return 0 on success, or -1 on error.
*
* MESSAGELEVEL specifies the diagnostic message display level:
* 0 => (normal) only fatal errors cause diagnostic messages to be printed.
* -1 => (silent) no diagnostic messages are printed, even for fatal errors.
* 1 => (warning) print non-fatal warning messages as well as error messages.
* >9 and <= 99 (debugging)
* print debugging messages at selected procedure levels/sublevels
* (See tracelog.h for more information on messageLevel)
*
* Returns 0 on successful initialization, -1 otherwise.
*/
int lterm_init(int messageLevel);
/** Creates a new LTERM object and returns its descriptor index but
* does not open it for I/O
* (documented in the LTERM interface)
* @return lterm descriptor index (>= 0) on success, or
* -1 on error
*/
int lterm_new();
/** Opens line terminal indexed by LTERM for input/output and creates
* a process attached to it to execute the command line contained in string
* array ARGV.
* Called from the adminstrative/output thread of LTERM.
* @return 0 on success, or -1 on error.
*
* COOKIE contains a cookie string used for stream security. If it is null,
* or a null string, all streams are considered insecure.
* (only MAXCOOKIESTR-1 characters of the cookie string are used for checking)
*
* INIT_COMMAND contains an initialization command string, if any (not echoed)
*
* PROMPT_REGEXP contains a REGEXP string describing the command prompt.
* (**NOTE** For the moment, only a list of prompt delimiters is accepted;
* a typical list of prompt delimiters would be "#$%>?")
*
* OPTIONS is a bitmask controlling the following options:
* LTERM_NOCANONICAL_FLAG disable TTY canonical mode
* LTERM_NOEDIT_FLAG disable input line editing
* LTERM_NOCOMPLETION_FLAG disable command line completion
* LTERM_NOMETA_FLAG disable meta input
* LTERM_NOMARKUP_FLAG disable HTML/XML element processing in command line
* LTERM_NOECHO_FLAG disable TTY echo
* LTERM_NOPTY_FLAG do not use pseudo-TTY
* LTERM_NONUL_FLAG do not process any NUL characters (discard them)
* LTERM_NOLINEWRAP_FLAG disable line wrapping
* LTERM_NOEXPORT_FLAG disable export of current environment to new process
* LTERM_STDERR_FLAG enable use of separate STDERR
* LTERM_PARTLINE_FLAG enable returning of partial line output
*
* Notes:
* -LTERM_STDERR_FLAG, although implemented, does not work properly at all
* -LTERM_PARTLINE_FLAG is not yet implemented
*
* PROCESS_TYPE specifies the subordinate process type, if set to one
* of the following:
* LTERM_DETERMINE_PROCESS
* LTERM_UNKNOWN_PROCESS
* LTERM_SH_PROCESS
* LTERM_KSH_PROCESS
* LTERM_BASH_PROCESS
* LTERM_CSH_PROCESS
* LTERM_TCSH_PROCESS
* If it is set to LTERM_DETERMINE_PROCESS, the process type is determined
* from the path name.
*
* CALLBACK_FUNC is a pointer to a GTK-style callback function,
* or NULL for no callback.
* The function is called whenever there is data available for
* LTERM_READ to process, with CALLBACK_DATA as the data argument.
* The callback function should call LTERM_READ immediately;
* otherwise the callback function will be called repeatedly.
* (The type LTERM_CALLBACK_FUNC_T is defined at the top of this include file)
*
* In canonical mode, no input line editing is permitted.
* In editing mode, EMACS-style keyboard line editing commands are allowed.
* In completion mode, incomplete command/file names are transmitted to
* the subordinate process for complettion, as in TCSH.
* Meta input refers to input lines that begin with a colon,
* or with a "protocol" name followed by a colon, such as
* "http: ...".
* Meta input lines are not sent to the subordinate process, but simply
* echoed as LTERM output through LTERM_READ for further processing.
* If command line completion is not disabled, incomplete meta input may
* also be echoed for completion. In this case, the completed meta input
* should be supplied to the LTERM through a call to LTERM_WRITE as if the
* user had entered it.
*/
int lterm_open(int lterm, char *const argv[],
const char* cookie, const char* init_command,
const UNICHAR* prompt_regexp, int options, int process_type,
lterm_callback_func_t callback_func, void *callback_data);
/** Closes line terminal indexed by LTERM.
* The default action is to block until active calls to lterm_write
* and lterm_read to complete.
* Called from the administrative/output thread of LTERM.
* @return 0 on success, or -1 on error.
*/
int lterm_close(int lterm);
/** Deletes an LTERM object, closing it if necessary.
* @return 0 on success, or -1 on error.
*/
int lterm_delete(int lterm);
/** Closes all LTERMs, but does not delete them.
* This may be used to free any resources associated with LTERMs for clean up.
* The closed LTERMs should still be deleted, if possible.
*/
void lterm_close_all(void);
/** Set input echo flag for line terminal indexed by LTERM.
* Called from the output thread of LTERM.
* @return 0 on success, or -1 on error.
*/
int lterm_setecho(int lterm, int echo_flag);
/** Resizes the line terminal indexed by LTERM to new row/column count.
* Called from the output thread of LTERM.
* @return 0 on success, or -1 on error.
*/
int lterm_resize(int lterm, int rows, int cols);
/** Sets cursor position in line terminal indexed by LTERM.
* NOT YET IMPLEMENTED
* Row numbers increase upward, starting from 0.
* Column numbers increase rightward, starting from 0.
* Called from the output thread of LTERM.
* @return 0 on success, or -1 on error.
*/
int lterm_setcursor(int lterm, int row, int col);
/** Writes supplied to Unicode string in BUF of length COUNT to
* line terminal indexed by LTERM.
* (May be called from any thread, since it uses a pipe to communicate
* with the output thread.)
* DATATYPE may be set to one of the following values:
* LTERM_WRITE_PLAIN_INPUT Plain text user input
* LTERM_WRITE_XML_INPUT XML element user input
* LTERM_WRITE_PLAIN_OUTPUT Plain text server output
* LTERM_WRITE_CLOSE_MESSAGE End of file message
* NOTE: This is a non-blocking call
* Returns the number of characters written.
* Returns -1 on error, and
* -2 if pseudo-TTY has been closed.
* If the return value is less than COUNT, it usually indicates an error.
* If the return value is -1, any further operations on the LTERM,
* other than LTERM_CLOSE, will always fail with an error return value.
*/
int lterm_write(int lterm, const UNICHAR *buf, int count, int dataType);
/** Completes meta input in line terminal indexed by LTERM with the
* supplied to Unicode string in BUF of length COUNT.
* Called from the output thread of the LTERM.
* @return 0 on success, or -1 on error.
*/
int lterm_metacomplete(int lterm, const UNICHAR *buf, int count);
/** reads upto COUNT Unicode characters from a single line of output
* from line terminal indexed by LTERM into BUF.
* Called from the output thread of the LTERM.
* Returns the number of characters read (>=0) on a successful read.
* Returns -1 if an error occurred while reading,
* -2 if pseudo-TTY has been closed,
* -3 if more than COUNT characters are present in the line
* (in this case the first COUNT characters are returned in BUF,
* and the rest are discarded).
* If the return value is -1, any further operations on the LTERM,
* other than LTERM_CLOSE, will always fail with an error return value.
* (If return value is -2, it means that the subordinate process has closed
* the pseudo-TTY. In this case, the LTERM still needs to be explicitly
* closed by calling LTERM_CLOSE for proper clean-up.)
*
* TIMEOUT is the number of platform-dependent time units
* (usually milliseconds on Unix) to wait to read data.
* A zero value implies no waiting.
* A negative TIMEOUT value implies infinite timeout, i.e., a blocking read.
* Non-zero values of TIMEOUT should be used only when the output thread
* is allowed to block.
*
* STYLE should be an array of same length as BUF, and contains
* the style bits associated with each character on return (see below).
*
* OPCODES contains a bit mask describing the type of output (see below).
* Using Extended Backus-Naur Form notation:
*
* OPCODES ::= STREAMDATA NEWLINE? ERROR?
* COOKIESTR? DOCSTREAM? XMLSTREAM? JSSTREAM? WINSTREAM?
* if StreamMode data is being returned.
* (NEWLINE, if set, denotes that the stream has terminated;
* if ERROR is also set, it means that the stream has terminated abnormally.)
*
* OPCODES ::= SCREENDATA BELL? ( OUTPUT | CLEAR | INSERT | DELETE | SCROLL )?
* if ScreenMode data is being returned.
* If none of the flags OUTPUT ... SCROLL are set in screen mode,
* do nothing but position the cursor (and ring the bell, if need be).
*
* OPCODES ::= LINEDATA BELL? ( CLEAR
* | ( PROMPT | OUTPUT)? INPUT ( NEWLINE HIDE? )?
* | PROMPT? INPUT META ( COMPLETION | NEWLINE HIDE? )
* | PROMPT? OUTPUT NEWLINE? )
* if LineMode data is being returned.
*
* If OPCODES == 0, then it means that no data has been read.
*
* If the returned OPCODES has META and COMPLETION bits set, then the completed
* version of the meta input should be supplied through a call to
* LTERM_WRITE, with an input data type, as if the user had typed it.
*
* BUF_ROW and BUF_COL denote the row and starting column at which to
* display the data in BUF.
* (BUF_ROW and BUF_COL are not used for CLEAR option in screen/line mode)
* In ScreenMode or LineMode, CURSOR_ROW and CURSOR_COL denote the final
* cursor position after any data in BUF is displayed.
*
* The bottom left corner of the screen corresponds to row 0, column 0.
* BUF_COL, CURSOR_COL are always >= 0, with 0 denoting the leftmost column.
* (BUF_COL is always zero if NOPARTLINE flag is set for LTERM.)
* (CURRENT IMPLEMENTATION: BUF_COL is always zero.)
* BUF_ROW, CURSOR_ROW are always set to -1 when LTERM is in line mode,
* BUF_ROW, CURSOR_ROW are always >=0 when LTERM is in screen mode,
* with 0 denoting the bottom row.
*
* In ScreenMode:
* - OUTPUT denotes that a modifed row of data is being returned.
* - OPVALS contains the no. of lines to be inserted/deleted,
* for INSERT/DELETE/SCROLL operations
*
*/
int lterm_read(int lterm, int timeout, UNICHAR *buf, int count,
UNISTYLE *style, int *opcodes, int *opvals,
int *buf_row, int *buf_col, int *cursor_row, int *cursor_col);
/* opcodes describing terminal operations:
*/
#define LTERM_STREAMDATA_CODE 0x0001U /* Stream mode */
#define LTERM_SCREENDATA_CODE 0x0002U /* Screen mode */
#define LTERM_LINEDATA_CODE 0x0004U /* Line mode */
#define LTERM_BELL_CODE 0x0008U /* Ring bell */
#define LTERM_CLEAR_CODE 0x0010U /* Clear screen */
#define LTERM_INSERT_CODE 0x0020U /* Insert lines above current line */
#define LTERM_DELETE_CODE 0x0040U /* Delete lines below current line */
#define LTERM_SCROLL_CODE 0x0080U /* Define scrolling region */
#define LTERM_INPUT_CODE 0x0100U /* Contains STDIN at end of line */
#define LTERM_PROMPT_CODE 0x0200U /* Contains prompt at beginning */
#define LTERM_OUTPUT_CODE 0x0400U /* Contains STDOUT/STDERR/ALTOUT */
#define LTERM_META_CODE 0x0800U /* Meta input */
#define LTERM_COMPLETION_CODE 0x1000U /* Completion requested */
#define LTERM_NEWLINE_CODE 0x2000U /* Complete (new) line */
#define LTERM_HIDE_CODE 0x4000U /* Hide output */
#define LTERM_ERROR_CODE 0x8000U /* Error in output */
#define LTERM_COOKIESTR_CODE 0x10000U /* Stream prefixed with cookie */
#define LTERM_DOCSTREAM_CODE 0x20000U /* Stream contains complete document */
#define LTERM_XMLSTREAM_CODE 0x40000U /* Stream contains XML, not HTML */
#define LTERM_JSSTREAM_CODE 0x80000U /* Stream contains Javascript */
#define LTERM_WINSTREAM_CODE 0x100000U /* Display stream in entire window */
/* LTERM/XTERM 16-bit style mask:
* PROMPT, STDIN, STDOUT, STDERR, ALTOUT are mutually exclusive.
* The markup styles apply to STDIN/STDOUT/ALTOUT data.
* The highlighting styles only apply to STDOUT data.
* The VT100 foreground and background styles are not implemented.
*/
#define LTERM_PROMPT_STYLE 0x0001UL /* prompt string */
#define LTERM_STDIN_STYLE 0x0002UL /* standard input */
#define LTERM_STDOUT_STYLE 0x0004UL /* standard output */
#define LTERM_STDERR_STYLE 0x0008UL /* standard error */
#define LTERM_ALTOUT_STYLE 0x0010UL /* alternate output */
#define LTERM_URI_STYLE 0x0020UL /* URI markup */
#define LTERM_HTML_STYLE 0x0040UL /* HTML markup */
#define LTERM_XML_STYLE 0x0080UL /* XML markup */
#define LTERM_BOLD_STYLE 0x0100UL /* boldface */
#define LTERM_ULINE_STYLE 0x0200UL /* underline */
#define LTERM_BLINK_STYLE 0x0400UL /* blink */
#define LTERM_INVERSE_STYLE 0x0800UL /* inverse video */
/* LTERM option flags */
#define LTERM_NOCANONICAL_FLAG 0x0001U
#define LTERM_NOEDIT_FLAG 0x0002U
#define LTERM_NOCOMPLETION_FLAG 0x0004U
#define LTERM_NOMETA_FLAG 0x0008U
#define LTERM_NOECHO_FLAG 0x0010U
#define LTERM_NOMARKUP_FLAG 0x0020U
#define LTERM_NOPTY_FLAG 0x0040U
#define LTERM_NONUL_FLAG 0x0080U
#define LTERM_NOLINEWRAP_FLAG 0x0100U
#define LTERM_NOEXPORT_FLAG 0x0200U
#define LTERM_STDERR_FLAG 0x0400U
#define LTERM_PARTLINE_FLAG 0x0800U
/* Process type codes */
#define LTERM_DETERMINE_PROCESS -1 /* Determine process type from name */
#define LTERM_UNKNOWN_PROCESS 0 /* Unknown process type */
#define LTERM_SH_PROCESS 1 /* Bourne shell */
#define LTERM_KSH_PROCESS 2 /* Korn shell */
#define LTERM_BASH_PROCESS 3 /* Bourne Again shell */
#define LTERM_CSH_PROCESS 4 /* C shell */
#define LTERM_TCSH_PROCESS 5 /* TC shell */
/* lterm_write data type codes (XML server output not permitted) */
#define LTERM_WRITE_PLAIN_INPUT 0 /* Plain text user input */
#define LTERM_WRITE_XML_INPUT 1 /* XML element user input */
#define LTERM_WRITE_PLAIN_OUTPUT 2 /* Plain text server output */
#define LTERM_WRITE_CLOSE_MESSAGE 3 /* End of file message */
#ifdef __cplusplus
}
#endif
#endif /* _LINETERM_H */

Просмотреть файл

@ -235,6 +235,7 @@ int lterm_new()
int lterm_open(int lterm, char *const argv[],
const char* cookie, const char* init_command,
const UNICHAR* prompt_regexp, int options, int process_type,
int rows, int cols, int x_pixels, int y_pixels,
lterm_callback_func_t callback_func, void *callback_data)
{
int nostderr, noPTY, j;
@ -316,9 +317,11 @@ int lterm_open(int lterm, char *const argv[],
lto->decodedChars = 0;
lto->incompleteEscapeSequence = 0;
/* Set default screen size (VT100) */
lts->nRows = 24;
lts->nCols = 80;
/* Set initial screen size */
lts->nRows = rows;
lts->nCols = cols;
lts->xPixels = y_pixels;
lts->yPixels = x_pixels;
/* Clear screen buffer */
lto->screenChar = NULL;
@ -433,14 +436,12 @@ int lterm_open(int lterm, char *const argv[],
("errfd=%d, noecho=%d, noblock=%d, noexport=%d, debugPTY=%d\n",
errfd, lts->noTTYEcho, noblock, noexport, debugPTY));
#ifndef NO_PTY
if (pty_create(&ptyStruc, cargv, errfd,
noblock, lts->noTTYEcho, noexport, debugPTY) == -1) {
if (pty_create(&ptyStruc, cargv,
lts->nRows, lts->nCols, lts->xPixels, lts->yPixels,
errfd, noblock, lts->noTTYEcho, noexport, debugPTY) == -1) {
LTERM_OPEN_ERROR_RETURN(lterm,lts,
"lterm_open: Error - PTY creation failed\n")
}
/* Resize TTY (fails on BSD?) */
pty_resize(&ptyStruc, lts->nRows, lts->nCols, 0, 0);
#endif /* !NO_PTY */
/* Copy PTY structure */

Просмотреть файл

@ -499,6 +499,8 @@ struct lterms {
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 */

Просмотреть файл

@ -1,136 +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 XMLterm.
*
* 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):
*/
// mozILineTermAux.h: auxiliary interface for LineTerm (not XPCONNECTed)
// This adds some XPCOM-only methods to the XPCOM/XPCONNECT interface
// mozILineTerm (unregistered)
#ifndef mozILineTermAux_h___
#define mozILineTermAux_h___
#include "nsISupports.h"
#include "nscore.h"
#include "nsIObserver.h"
#include "mozILineTerm.h"
/* {0eb82b10-43a2-11d3-8e76-006008948af5} */
#define MOZILINETERMAUX_IID_STR "0eb82b10-43a2-11d3-8e76-006008948af5"
#define MOZILINETERMAUX_IID \
{0x0eb82b10, 0x43a2, 0x11d3, \
{ 0x8e, 0x76, 0x00, 0x60, 0x08, 0x94, 0x8a, 0xf5 }}
class mozILineTermAux : public mozILineTerm {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(MOZILINETERMAUX_IID)
// mozILineTerm interface
NS_IMETHOD Open(const PRUnichar *command,
const PRUnichar *initInput,
const PRUnichar *promptRegexp,
PRInt32 options, PRInt32 processType,
nsIDOMDocument *domDoc) = 0;
NS_IMETHOD Close(const PRUnichar* aCookie) = 0;
NS_IMETHOD Write(const PRUnichar *buf, const PRUnichar* aCookie) = 0;
NS_IMETHOD Read(PRInt32 *opcodes, PRInt32 *opvals,
PRInt32 *buf_row, PRInt32 *buf_col,
const PRUnichar* aCookie,
PRUnichar **_retval) = 0;
// mozILineTermAux interface add ons
// (not scriptable, no authentication cookie required)
/** Opens LineTerm, a line-oriented terminal interface (without graphics)
* @param command name of command to be executed; usually a shell,
* e.g., "/bin/sh"; if set to null string, the command name is
* determined from the environment variable SHELL
* @param promptRegexp command prompt regular expression (for future use);
* at the moment, any string terminated by one of the characters
* "#$%>?", followed by a space, is assumed to be a prompt
* @param options LineTerm option bits (usually 0; see lineterm.h)
* @param processType command shell type; if set to -1, type is determined
* from the command name
* @param domDoc DOM document object associated with the LineTerm
* (document.cookie will be defined for this document on return)
* @param aCookie (output) cookie associated with LineTerm
*/
NS_IMETHOD OpenAux(const PRUnichar *command,
const PRUnichar *initInput,
const PRUnichar *promptRegexp,
PRInt32 options, PRInt32 processType,
nsIDOMDocument *domDoc,
nsIObserver* anObserver,
nsString& aCookie) = 0;
/** Suspend/restores LineTerm operation
* @param aSuspend suspension state flag
*/
NS_IMETHOD SuspendAux(PRBool aSuspend) = 0;
/** Closes LineTerm
*/
NS_IMETHOD CloseAux(void) = 0;
/** Close all LineTerms, not just this one
*/
NS_IMETHOD CloseAllAux(void) = 0;
/** Resizes XMLterm to match a resized window.
* @param nRows number of rows
* @param nCols number of columns
*/
NS_IMETHOD ResizeAux(PRInt32 nRows, PRInt32 nCols) = 0;
/** Read output data and style strings and parameters from LineTerm
* @param opcodes (output) output data descriptor bits (see lineterm.h)
* @param opvals (output) output data value(s)
* @param buf_row (output) row number (>=-1)
* (-1 denotes line mode and 0 represents bottom row)
* @param buf_col (output) column number (>=0)
* @param _retval (output) success code
* @param retstyle (output) output style string
* @return output data string from LineTerm
*/
NS_IMETHOD ReadAux(PRInt32 *opcodes, PRInt32 *opvals,
PRInt32 *buf_row, PRInt32 *buf_col,
PRUnichar **_retval, PRUnichar **retstyle) = 0;
NS_IMETHOD GetCookie(nsString& aCookie) = 0;
NS_IMETHOD GetCursorRow(PRInt32 *aCursorRow) = 0;
NS_IMETHOD SetCursorRow(PRInt32 aCursorRow) = 0;
NS_IMETHOD GetCursorColumn(PRInt32 *aCursorColumn) = 0;
NS_IMETHOD SetCursorColumn(PRInt32 aCursorColumn) = 0;
NS_IMETHOD GetEchoFlag(PRBool *aEchoFlag) = 0;
NS_IMETHOD SetEchoFlag(PRBool aEchoFlag) = 0;
};
// Factory for mozILineTermAux
extern nsresult
NS_NewLineTermAux(mozILineTermAux** aLineTermAux);
#endif /* mozILineTermAux_h___ */

Просмотреть файл

@ -149,6 +149,15 @@ public:
/** Shows the caret and make it editable.
*/
NS_IMETHOD ShowCaret(void) = 0;
/** Returns current screen size in rows/cols and in pixels
* @param (output) rows
* @param (output) cols
* @param (output) xPixels
* @param (output) yPixels
*/
NS_IMETHOD ScreenSize(PRInt32& rows, PRInt32& cols,
PRInt32& xPixels, PRInt32& yPixels) = 0;
};
#define MOZXMLTERMINAL_CID \

Просмотреть файл

@ -297,8 +297,9 @@ NS_IMETHODIMP mozLineTerm::Open(const PRUnichar *command,
nsAutoString aCookie;
return OpenAux(command, initInput, promptRegexp,
options, processType, domDoc,
nsnull, aCookie);
options, processType,
24, 80, 0, 0,
domDoc, nsnull, aCookie);
}
@ -308,6 +309,8 @@ NS_IMETHODIMP mozLineTerm::OpenAux(const PRUnichar *command,
const PRUnichar *initInput,
const PRUnichar *promptRegexp,
PRInt32 options, PRInt32 processType,
PRInt32 nRows, PRInt32 nCols,
PRInt32 xPixels, PRInt32 yPixels,
nsIDOMDocument *domDoc,
nsIObserver* anObserver,
nsString& aCookie)
@ -389,12 +392,14 @@ NS_IMETHODIMP mozLineTerm::OpenAux(const PRUnichar *command,
if (anObserver != nsnull) {
result = lterm_open(mLTerm, NULL, cookieCStr, initCStr.GetBuffer(),
prompt_regexp, options,
processType, mozLineTerm::Callback, (void *) this);
prompt_regexp, options, processType,
nRows, nCols, xPixels, yPixels,
mozLineTerm::Callback, (void *) this);
} else {
result = lterm_open(mLTerm, NULL, cookieCStr, initCStr.GetBuffer(),
prompt_regexp, options,
processType, NULL, NULL);
prompt_regexp, options, processType,
nRows, nCols, xPixels, yPixels,
NULL, NULL);
}
// Free cookie CString

Просмотреть файл

@ -67,6 +67,8 @@ public:
const PRUnichar *initInput,
const PRUnichar *promptRegexp,
PRInt32 options, PRInt32 processType,
PRInt32 nRows, PRInt32 nCols,
PRInt32 xPixels, PRInt32 yPixels,
nsIDOMDocument *domDoc,
nsIObserver* anObserver,
nsString& aCookie);

Просмотреть файл

@ -50,9 +50,6 @@
#include "nsIHTMLContent.h"
#include "nsFont.h"
#include "nsIFontMetrics.h"
#include "mozXMLT.h"
#include "mozILineTermAux.h"
#include "mozIXMLTerminal.h"
@ -152,9 +149,9 @@ mozXMLTermSession::mozXMLTermSession() :
mPreTextDisplayed(""),
mScreenNode(nsnull),
mScreenRows(24),
mScreenCols(80),
mTopScrollRow(23),
mScreenRows(0),
mScreenCols(0),
mTopScrollRow(0),
mBotScrollRow(0),
mRestoreInputEcho(false),
@ -179,7 +176,8 @@ mozXMLTermSession::~mozXMLTermSession()
// Initialize XMLTermSession
NS_IMETHODIMP mozXMLTermSession::Init(mozIXMLTerminal* aXMLTerminal,
nsIPresShell* aPresShell,
nsIDOMDocument* aDOMDocument)
nsIDOMDocument* aDOMDocument,
PRInt32 nRows, PRInt32 nCols)
{
XMLT_LOG(mozXMLTermSession::Init,30,("\n"));
@ -193,6 +191,11 @@ NS_IMETHODIMP mozXMLTermSession::Init(mozIXMLTerminal* aXMLTerminal,
mPresShell = aPresShell; // presentation shell; no addref
mDOMDocument = aDOMDocument; // DOM document; no addref
mScreenRows = nRows;
mScreenCols = nCols;
mTopScrollRow = mScreenRows - 1;
mBotScrollRow = 0;
nsresult result = NS_OK;
nsCOMPtr<nsIDOMHTMLDocument> vDOMHTMLDocument
@ -300,64 +303,26 @@ NS_IMETHODIMP mozXMLTermSession::Resize(mozILineTermAux* lineTermAux)
{
nsresult result;
// Get presentation context
nsCOMPtr<nsIPresContext> presContext;
result = mPresShell->GetPresContext( getter_AddRefs(presContext) );
XMLT_LOG(mozXMLTermSession::Resize,70,("\n"));
// Determine current screen dimensions
PRInt32 nRows, nCols, xPixels, yPixels;
result = mXMLTerminal->ScreenSize(nRows, nCols, xPixels, yPixels);
if (NS_FAILED(result))
return result;
// Get the default fixed pitch font
nsFont defaultFixedFont("dummyfont", NS_FONT_STYLE_NORMAL,
NS_FONT_VARIANT_NORMAL,
NS_FONT_WEIGHT_NORMAL,
NS_FONT_DECORATION_NONE, 16);
// If dimensions haven't changed, do nothing
if ((nRows == mScreenRows) && (nCols == mScreenCols))
return NS_OK;
result = presContext->GetDefaultFixedFont(defaultFixedFont);
if (NS_FAILED(result))
return result;
// Get metrics for fixed font
nsCOMPtr<nsIFontMetrics> fontMetrics;
result = presContext->GetMetricsFor(defaultFixedFont,
getter_AddRefs(fontMetrics));
if (NS_FAILED(result) || !fontMetrics)
return result;
// Get font height (includes leading?)
nscoord fontHeight, fontWidth;
result = fontMetrics->GetHeight(fontHeight);
result = fontMetrics->GetMaxAdvance(fontWidth);
// Determine docshell size in twips
nsRect shellArea;
result = presContext->GetVisibleArea(shellArea);
if (NS_FAILED(result))
return result;
// Determine twips to pixels conversion factor
float pixelScale, frameHeight, frameWidth, xdel, ydel;
presContext->GetTwipsToPixels(&pixelScale);
// Convert dimensions to pixels
frameHeight = pixelScale * shellArea.height;
frameWidth = pixelScale * shellArea.width;
xdel = pixelScale * fontWidth;
ydel = pixelScale * fontHeight + 2;
// Determine number of rows/columns
mScreenRows = (int) ((frameHeight-44) / ydel);
mScreenCols = (int) ((frameWidth-20) / xdel);
if (mScreenRows < 1) mScreenRows = 1;
if (mScreenCols < 1) mScreenCols = 1;
mScreenRows = nRows;
mScreenCols = nCols;
mTopScrollRow = mScreenRows - 1;
mBotScrollRow = 0;
XMLT_LOG(mozXMLTermSession::Resize,0,
("Resizing XMLterm, xdel=%e, ydel=%e, rows=%d, cols=%d\n",
xdel, ydel, mScreenRows, mScreenCols));
("Resizing XMLterm, nRows=%d, nCols=%d\n", mScreenRows, mScreenCols));
if (lineTermAux) {
// Resize associated LineTerm
@ -378,6 +343,8 @@ NS_IMETHODIMP mozXMLTermSession::Preprocess(const nsString& aString,
PRBool& consumed)
{
XMLT_LOG(mozXMLTermSession::Preprocess,70,("\n"));
consumed = false;
if (mMetaCommandType == TREE_META_COMMAND) {
@ -451,6 +418,7 @@ NS_IMETHODIMP mozXMLTermSession::ReadAll(mozILineTermAux* lineTermAux,
PRUnichar *buf_str, *buf_style;
PRBool newline, errorFlag, streamData, screenData;
nsAutoString bufString, bufStyle;
nsAutoString abortCode = "";
XMLT_LOG(mozXMLTermSession::ReadAll,60,("\n"));
@ -464,13 +432,18 @@ NS_IMETHODIMP mozXMLTermSession::ReadAll(mozILineTermAux* lineTermAux,
PRBool metaNextCommand = false;
// NOTE: Do not execute return statements within this loop ;
// always break out of the loop after setting result to an error value,
// allowing cleanup processing on error
for (;;) {
// NOTE: Remember to de-allocate buf_str and buf_style
// using nsAllocator::Free, if opcodes != 0
result = lineTermAux->ReadAux(&opcodes, &opvals, &buf_row, &buf_col,
&buf_str, &buf_style);
if (NS_FAILED(result))
if (NS_FAILED(result)) {
abortCode = "lineTermReadAux";
break;
}
XMLT_LOG(mozXMLTermSession::ReadAll,62,
("opcodes=0x%x,mOutputType=%d,mEntryHasOutput=%d\n",
@ -1085,23 +1058,23 @@ NS_IMETHODIMP mozXMLTermSession::ReadAll(mozILineTermAux* lineTermAux,
}
if (NS_FAILED(result)) {
// Close LineTerm
// Error processing; close LineTerm
XMLT_LOG(mozXMLTermSession::ReadAll,62,
("Closing LineTerm, result=%d\n", result));
("Aborting on error, result=0x%x\n", result));
lineTermAux->CloseAux();
Abort(lineTermAux, abortCode);
return result;
}
if (flushOutput) {
// Flush output, splitting off incomplete line
result = FlushOutput(SPLIT_INCOMPLETE_FLUSH);
FlushOutput(SPLIT_INCOMPLETE_FLUSH);
if (mEntryHasOutput)
PositionOutputCursor(lineTermAux);
result = mPresShell->ScrollSelectionIntoView(SELECTION_NORMAL,
SELECTION_FOCUS_REGION);
mPresShell->ScrollSelectionIntoView(SELECTION_NORMAL,
SELECTION_FOCUS_REGION);
}
// Show caret
@ -1114,6 +1087,51 @@ NS_IMETHODIMP mozXMLTermSession::ReadAll(mozILineTermAux* lineTermAux,
}
/** Aborts session by closing LineTerm and displays an error message
* @param lineTermAux LineTermAux object to be closed
* @param abortCode abort code string to dbe displayed
*/
NS_IMETHODIMP mozXMLTermSession::Abort(mozILineTermAux* lineTermAux,
nsString& abortCode)
{
nsresult result;
XMLT_LOG(mozXMLTermSession::Abort,70,
("Aborting session; closing LineTerm\n"));
// Close LineTerm
lineTermAux->CloseAux();
// Display error message using DIV node
nsCOMPtr<nsIDOMNode> divNode, textNode;
nsAutoString tagName = "div";
nsAutoString elementName = "errmsg";
result = NewElementWithText(tagName, elementName, -1,
mSessionNode, divNode, textNode);
if (NS_SUCCEEDED(result) && divNode && textNode) {
nsAutoString errMsg = "Error in XMLterm (code ";
errMsg.Append(abortCode);
errMsg.Append("); session closed.");
SetDOMText(textNode, errMsg);
// Collapse selection and position cursor
nsCOMPtr<nsIDOMSelection> selection;
result = mPresShell->GetSelection(SELECTION_NORMAL,
getter_AddRefs(selection));
if (NS_SUCCEEDED(result) && selection) {
selection->Collapse(textNode, errMsg.Length());
if (NS_SUCCEEDED(result)) {
mPresShell->ScrollSelectionIntoView(SELECTION_NORMAL,
SELECTION_FOCUS_REGION);
}
}
}
return NS_OK;
}
/** Displays ("echoes") input text string with style and positions cursor
* @param aString string to be displayed
* @param aStyle style values for string (see lineterm.h)

Просмотреть файл

@ -52,10 +52,13 @@ class mozXMLTermSession
* @param aXMLTerminal containing XMLTerminal object
* @param aPresShell presentation shell associated with XMLterm
* @param aDOMDocument DOM document associated with XMLterm
* @param nRows initial number of rows
* @param nCols initial number of columns
*/
NS_IMETHOD Init(mozIXMLTerminal* aXMLTerminal,
nsIPresShell* aPresShell,
nsIDOMDocument* aDOMDocument);
nsIDOMDocument* aDOMDocument,
PRInt32 nRows, PRInt32 nCols);
/** Finalizes (closes) session
*/
@ -65,6 +68,11 @@ class mozXMLTermSession
*/
NS_IMETHOD NeedsResizing(void);
/** Resizes XMLterm to match a resized window.
* @param lineTermAux LineTermAux object to be resized (may be null)
*/
NS_IMETHOD Resize(mozILineTermAux* lineTermAux);
/** Preprocesses user input before it is transmitted to LineTerm
* @param aString (inout) input data to be preprocessed
* @param consumed (output) true if input data has been consumed
@ -78,6 +86,13 @@ class mozXMLTermSession
*/
NS_IMETHOD ReadAll(mozILineTermAux* lineTermAux, PRBool& processedData);
/** Aborts session by closing LineTerm and displays an error message
* @param lineTermAux LineTermAux object to be closed
* @param abortCode abort code string to be displayed
*/
NS_IMETHOD Abort(mozILineTermAux* lineTermAux,
nsString& abortCode);
/** Gets current entry (command) number
* @param aNumber (output) current entry number
*/
@ -212,11 +227,6 @@ protected:
TREE_ACTION_CODES = 7
};
/** Resizes XMLterm to match a resized window.
* @param lineTermAux LineTermAux object to be resized (may be null)
*/
NS_IMETHOD Resize(mozILineTermAux* lineTermAux);
/** Displays ("echoes") input text string with style and positions cursor
* @param aString string to be displayed
* @param aStyle style values for string (see lineterm.h)

Просмотреть файл

@ -50,6 +50,9 @@
#include "nsIClipboard.h"
#include "nsITransferable.h"
#include "nsFont.h"
#include "nsIFontMetrics.h"
#include "mozXMLT.h"
#include "mozXMLTermUtils.h"
#include "mozXMLTerminal.h"
@ -439,6 +442,23 @@ NS_IMETHODIMP mozXMLTerminal::Activate(void)
mPresShell = presShell; // no addref
mDOMDocument = domDocument; // no addref
// Show caret
ShowCaret();
// Determine current screen dimensions
PRInt32 nRows, nCols, xPixels, yPixels;
result = ScreenSize(nRows, nCols, xPixels, yPixels);
if (NS_FAILED(result))
return result;
// The above call does not return the correct screen dimensions.
// (because rendering is still in progress?)
// As a workaround, explicitly set screen dimensions
nRows = 24;
nCols = 80;
xPixels = 0;
yPixels = 0;
// Instantiate and initialize XMLTermSession object
mXMLTermSession = new mozXMLTermSession();
@ -446,17 +466,15 @@ NS_IMETHODIMP mozXMLTerminal::Activate(void)
return NS_ERROR_OUT_OF_MEMORY;
}
result = mXMLTermSession->Init(this, mPresShell, mDOMDocument);
result = mXMLTermSession->Init(this, mPresShell, mDOMDocument, nRows, nCols);
if (NS_FAILED(result)) {
XMLT_WARNING("mozXMLTerminal::Activate: Warning - Failed to initialize XMLTermSession\n");
return NS_ERROR_FAILURE;
}
// Show caret
ShowCaret();
// Instantiate LineTerm
XMLT_LOG(mozXMLTerminal::Activate,22,("instantiating lineterm\n"));
XMLT_LOG(mozXMLTerminal::Activate,22,
("instantiating lineterm, nRows=%d, nCols=%d\n", nRows, nCols));
result = NS_NewLineTermAux(getter_AddRefs(mLineTermAux));
if (NS_FAILED(result)) {
XMLT_WARNING("mozXMLTerminal::Activate: Warning - Failed to instantiate LineTermAux\n");
@ -477,6 +495,7 @@ NS_IMETHODIMP mozXMLTerminal::Activate(void)
mInitInput.GetUnicode(),
mPromptExpr.GetUnicode(),
options, LTERM_DETERMINE_PROCESS,
nRows, nCols, xPixels, yPixels,
mDOMDocument, anObserver, cookie);
if (NS_FAILED(result)) {
@ -488,7 +507,7 @@ NS_IMETHODIMP mozXMLTerminal::Activate(void)
// Save cookie
mCookie = cookie;
// Resize XMLterm
// Resize XMLterm (before displaying any output)
result = Resize();
if (NS_FAILED(result))
return result;
@ -567,6 +586,80 @@ NS_IMETHODIMP mozXMLTerminal::Activate(void)
}
/** Returns current screen size in rows/cols and in pixels
* @param (output) rows
* @param (output) cols
* @param (output) xPixels
* @param (output) yPixels
*/
NS_IMETHODIMP mozXMLTerminal::ScreenSize(PRInt32& rows, PRInt32& cols,
PRInt32& xPixels, PRInt32& yPixels)
{
nsresult result;
XMLT_LOG(mozXMLTerminal::ScreenSize,70,("\n"));
// Get presentation context
nsCOMPtr<nsIPresContext> presContext;
result = mPresShell->GetPresContext( getter_AddRefs(presContext) );
if (NS_FAILED(result))
return result;
// Get the default fixed pitch font
nsFont defaultFixedFont("dummyfont", NS_FONT_STYLE_NORMAL,
NS_FONT_VARIANT_NORMAL,
NS_FONT_WEIGHT_NORMAL,
NS_FONT_DECORATION_NONE, 16);
result = presContext->GetDefaultFixedFont(defaultFixedFont);
if (NS_FAILED(result))
return result;
// Get metrics for fixed font
nsCOMPtr<nsIFontMetrics> fontMetrics;
result = presContext->GetMetricsFor(defaultFixedFont,
getter_AddRefs(fontMetrics));
if (NS_FAILED(result) || !fontMetrics)
return result;
// Get font height (includes leading?)
nscoord fontHeight, fontWidth;
result = fontMetrics->GetHeight(fontHeight);
result = fontMetrics->GetMaxAdvance(fontWidth);
// Determine docshell size in twips
nsRect shellArea;
result = presContext->GetVisibleArea(shellArea);
if (NS_FAILED(result))
return result;
// Determine twips to pixels conversion factor
float pixelScale;
presContext->GetTwipsToPixels(&pixelScale);
// Convert dimensions to pixels
float xdel, ydel;
xdel = pixelScale * fontWidth;
ydel = pixelScale * fontHeight + 2;
xPixels = (int) (pixelScale * shellArea.height);
yPixels = (int) (pixelScale * shellArea.width);
// Determine number of rows/columns
rows = (int) ((xPixels-44) / ydel);
cols = (int) ((yPixels-20) / xdel);
if (rows < 1) rows = 1;
if (cols < 1) cols = 1;
XMLT_LOG(mozXMLTerminal::ScreenSize,72,
("rows=%d, cols=%d, xPixels=%d, yPixels=%d\n",
rows, cols, xPixels, yPixels));
return NS_OK;
}
// Transmit string to LineTerm (use saved cookie)
NS_IMETHODIMP mozXMLTerminal::SendTextAux(const nsString& aString)
{
@ -592,8 +685,9 @@ NS_IMETHODIMP mozXMLTerminal::SendText(const nsString& aString,
if (!consumed) {
result = mLineTermAux->Write(sendStr.GetUnicode(), aCookie);
if (NS_FAILED(result)) {
// Close LineTerm
mLineTermAux->Close(aCookie);
// Abort XMLterm session
nsAutoString abortCode = "SendText";
mXMLTermSession->Abort(mLineTermAux, abortCode);
return NS_ERROR_FAILURE;
}
}
@ -813,6 +907,7 @@ NS_IMETHODIMP mozXMLTerminal::Resize(void)
if (!mXMLTermSession)
return NS_ERROR_FAILURE;
// Delay resizing until next command output display
result = mXMLTermSession->NeedsResizing();
if (NS_FAILED(result))
return result;

Просмотреть файл

@ -87,6 +87,9 @@ class mozXMLTerminal : public mozIXMLTerminal,
NS_IMETHOD ShowCaret(void);
NS_IMETHOD ScreenSize(PRInt32& rows, PRInt32& cols,
PRInt32& xPixels, PRInt32& yPixels);
// nsIDocumentLoaderObserver interface
NS_DECL_NSIDOCUMENTLOADEROBSERVER

Просмотреть файл

@ -100,6 +100,7 @@ static void pty_error(const char *errmsg, const char *errmsg2);
/* creates a new pseudo-TTY */
int pty_create(struct ptys *ptyp, char *const argv[],
int rows, int cols, int x_pixels, int y_pixels,
int errfd, int noblock, int noecho, int noexport, int debug)
{
pid_t child_pid;
@ -124,7 +125,7 @@ int pty_create(struct ptys *ptyp, char *const argv[],
#ifndef BSDFAMILY
/* Set default TTY size */
if (pty_resize(ptyp, 24, 80, 0, 0) != 0)
if (pty_resize(ptyp, rows, cols, x_pixels, y_pixels) != 0)
return -1;
#endif
@ -170,7 +171,7 @@ int pty_create(struct ptys *ptyp, char *const argv[],
#ifdef BSDFAMILY
/* Set default TTY size */
if (pty_resize(NULL, 24, 80, 0, 0) != 0)
if (pty_resize(NULL, rows, cols, x_pixels, y_pixels) != 0)
return -1;
#endif

Просмотреть файл

@ -1,94 +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.
*/
/* ptystream.h: pseudo-TTY stream header
* (used by ltermPrivate.h)
*/
#ifndef _PTYSTREAM_H
#define _PTYSTREAM_H 1
#ifdef __cplusplus
extern "C" {
#endif
#define PTYNAMELEN 10 /* Length of PTY/TTY device name: /dev/pty?? */
struct ptys { /* PTY structure */
int ptyFD; /* PTY file descriptor (bi-directional) */
int errpipeFD; /* stderr pipe file descriptor (-1, if none) */
long pid; /* PTY child PID */
int debug; /* Debugging flag */
char ptydev[PTYNAMELEN+1]; /* PTY (master) name */
char ttydev[PTYNAMELEN+1]; /* TTY (slave) name */
};
/* creates a new pseudo-TTY (PTY) and also a new process attached to
* it to execute the command line contained in array ARGV.
* The PTY details are stored in the PTY structure PTYP.
* ERRFD is the file descriptor to which the STDERR output of the
* child process is directed.
* If ERRFD == -1, then the STDERR output is redirected to STDOUT.
* If ERRFD == -2, then a new pipe is created and STDERR is redirected
* through it.
* If NOBLOCK is true, enable non-blocking I/O on PTY.
* If NOECHO is true, tty echoing is turned off.
* If NOEXPORT is true, then the current environment is not exported
* to the new process.
* If DEBUG is true, debugging messages are printed to STDERR.
* Returns 0 on success and -1 on error.
*/
int pty_create(struct ptys *ptyp, char *const argv[],
int errfd, int noblock, int noecho, int noexport, int debug);
/* resizes a PTY; if ptyp is null, resizes file desciptor 0,
* returning 0 on success and -1 on error.
*/
int pty_resize(struct ptys *ptyp, int rows, int cols,
int xpix, int ypix);
/* closes the PTY and kills the associated child process, if still alive.
* Also close STDERR pipe, if open.
* Returns 0 on success and -1 on error.
*/
int pty_close(struct ptys *ptyp);
#ifdef __cplusplus
}
#endif
#endif /* _PTYSTREAM_H */

Просмотреть файл

@ -306,7 +306,9 @@ int main(int argc, char *argv[]) {
ltermNumber = lterm_new();
retValue = lterm_open(ltermNumber, commandArgs, NULL, NULL, uregexp,
options, processType, NULL, NULL);
options, processType,
24, 80, 0, 0,
NULL, NULL);
if (retValue < 0) {
fprintf(stderr, "lterm: Error %d in opening LTERM\n", retValue);
exit(1);

Просмотреть файл

@ -128,7 +128,8 @@ void ptyTest(int argc, char *argv[])
char temstr[3] = "^@";
/* Create a PTY */
if (pty_create(&ptyStruc,argv,-1,0,0,0,1) == -1) {
if (pty_create(&ptyStruc,argv,24,80,0,0,
-1,0,0,0,1) == -1) {
fprintf(stderr, "PTY creation failed\n");
exit(-1);
}
@ -153,7 +154,10 @@ void ptyTest(int argc, char *argv[])
ch = getchar();
/* Exit poll loop if a Control-] character is read */
if (ch == 0x1D) break;
if (ch == 0x1D) {
fprintf(stderr, "EXIT ptytest\n");
break;
}
if (write(ptyFD, &ch, 1) != 1) {
fprintf(stderr, "Error in writing to child STDIN\n");

Просмотреть файл

@ -28,7 +28,7 @@
<window id="xmlterm-window" xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="StartupXMLTerm();"
title="xmlterm" align="vertical" width="740" height="484">
title="xmlterm" align="vertical" width="586" height="444">
<html:script src="chrome://xmlterm/content/XMLTermChrome.js"></html:script>

Просмотреть файл

@ -13,6 +13,9 @@ PRE { font-family: monaco;
SPAN.prompt { color: blue }
SPAN.command { color: blue }
/* Error messages */
DIV.errmsg { color: red }
/* Explicit hyperlinks (underlined) */
DIV.textlink { font-family: monaco; color: blue; cursor: hand;
text-decoration: underline }