From adadddf91cf0656e3a6dc78dacc789b106499f7b Mon Sep 17 00:00:00 2001 From: "zodiac@gmail.com" Date: Sat, 23 May 2009 19:53:09 +0000 Subject: [PATCH] Released version 2.8 git-svn-id: https://shellinabox.googlecode.com/svn/trunk@121 0da03de8-d603-11dd-86c2-0f8696b7b6f9 --- ChangeLog | 4 ++ config.h | 8 ++-- configure | 22 +++++----- configure.ac | 4 +- debian/changelog | 6 +++ demo/demo.js | 81 ++++++++++++++++++++--------------- demo/demo.jspp | 81 ++++++++++++++++++++--------------- demo/vt100.js | 2 +- shellinabox/externalfile.c | 4 ++ shellinabox/launcher.c | 2 +- shellinabox/shell_in_a_box.js | 2 +- shellinabox/vt100.js | 2 +- 12 files changed, 127 insertions(+), 91 deletions(-) diff --git a/ChangeLog b/ChangeLog index 906ffbc..6512433 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2009-05-23 Markus Gutschke + + * Released version 2.8 + 2009-05-22 Markus Gutschke * Improved support for entering non-ASCII characters. diff --git a/config.h b/config.h index c7f0654..9e9e936 100644 --- a/config.h +++ b/config.h @@ -117,22 +117,22 @@ #define PACKAGE_NAME "shellinabox" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "shellinabox 2.7" +#define PACKAGE_STRING "shellinabox 2.8" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "shellinabox" /* Define to the version of this package. */ -#define PACKAGE_VERSION "2.7" +#define PACKAGE_VERSION "2.8" /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Most recent revision number in the version control system */ -#define VCS_REVISION "120" +#define VCS_REVISION "121" /* Version number of package */ -#define VERSION "2.7" +#define VERSION "2.8" /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ diff --git a/configure b/configure index bea7c9b..2cab1a5 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.63 for shellinabox 2.7. +# Generated by GNU Autoconf 2.63 for shellinabox 2.8. # # Report bugs to . # @@ -745,8 +745,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='shellinabox' PACKAGE_TARNAME='shellinabox' -PACKAGE_VERSION='2.7' -PACKAGE_STRING='shellinabox 2.7' +PACKAGE_VERSION='2.8' +PACKAGE_STRING='shellinabox 2.8' PACKAGE_BUGREPORT='markus@shellinabox.com' ac_c_werror_flag= @@ -1469,7 +1469,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures shellinabox 2.7 to adapt to many kinds of systems. +\`configure' configures shellinabox 2.8 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1539,7 +1539,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of shellinabox 2.7:";; + short | recursive ) echo "Configuration of shellinabox 2.8:";; esac cat <<\_ACEOF @@ -1655,7 +1655,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -shellinabox configure 2.7 +shellinabox configure 2.8 generated by GNU Autoconf 2.63 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1669,7 +1669,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by shellinabox $as_me 2.7, which was +It was created by shellinabox $as_me 2.8, which was generated by GNU Autoconf 2.63. Invocation command line was $ $0 $@ @@ -2037,7 +2037,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -VCS_REVISION=120 +VCS_REVISION=121 cat >>confdefs.h <<_ACEOF @@ -2394,7 +2394,7 @@ fi # Define the identity of the package. PACKAGE='shellinabox' - VERSION='2.7' + VERSION='2.8' cat >>confdefs.h <<_ACEOF @@ -13592,7 +13592,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by shellinabox $as_me 2.7, which was +This file was extended by shellinabox $as_me 2.8, which was generated by GNU Autoconf 2.63. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13655,7 +13655,7 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ -shellinabox config.status 2.7 +shellinabox config.status 2.8 configured by $0, generated by GNU Autoconf 2.63, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.ac b/configure.ac index eddaa97..a5c8f14 100644 --- a/configure.ac +++ b/configure.ac @@ -1,8 +1,8 @@ AC_PREREQ(2.57) dnl This is the one location where the authoritative version number is stored -AC_INIT(shellinabox, 2.7, markus@shellinabox.com) -VCS_REVISION=120 +AC_INIT(shellinabox, 2.8, markus@shellinabox.com) +VCS_REVISION=121 AC_SUBST(VCS_REVISION) AC_DEFINE_UNQUOTED(VCS_REVISION, "${VCS_REVISION}", [Most recent revision number in the version control system]) diff --git a/debian/changelog b/debian/changelog index 6137cfd..17e9954 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +shellinabox (2.8-1) unstable; urgency=low + + * New upstream release, version 2.8. + + -- Markus Gutschke Sat, 23 May 2009 11:53:13 -0800 + shellinabox (2.7-1) unstable; urgency=low * New upstream release, version 2.7. diff --git a/demo/demo.js b/demo/demo.js index 5a4d388..a0ec304 100644 --- a/demo/demo.js +++ b/demo/demo.js @@ -89,32 +89,17 @@ function Demo(container) { extend(Demo, VT100); Demo.prototype.keysPressed = function(ch) { - for (var i = 0; i < ch.length; i++) { - var c = ch.charCodeAt(i); - if (c == 3) { - if (this.state == 5 /* STATE_EXEC */) { + if (this.state == 5 /* STATE_EXEC */) { + for (var i = 0; i < ch.length; i++) { + var c = ch.charAt(i); + if (c == '\u0003') { this.keys = ''; this.error('Interrupted'); return; } - } else { - if (c < 128) { - this.keys += String.fromCharCode(c); - } else if (c < 0x800) { - this.keys += String.fromCharCode(0xC0 + (c >> 6) ) + - String.fromCharCode(0x80 + ( c & 0x3F)); - } else if (c < 0x10000) { - this.keys += String.fromCharCode(0xE0 + (c >> 12) ) + - String.fromCharCode(0x80 + ((c >> 6) & 0x3F)) + - String.fromCharCode(0x80 + ( c & 0x3F)); - } else if (c < 0x110000) { - this.keys += String.fromCharCode(0xF0 + (c >> 18) ) + - String.fromCharCode(0x80 + ((c >> 12) & 0x3F)) + - String.fromCharCode(0x80 + ((c >> 6) & 0x3F)) + - String.fromCharCode(0x80 + ( c & 0x3F)); - } } } + this.keys += ch; this.gotoState(this.state); }; @@ -175,10 +160,10 @@ Demo.prototype.error = function(msg) { if (msg == undefined) { msg = 'Syntax Error'; } - this.vt100((this.cursorX != 0 ? '\r\n' : '') + '\u0007? ' + msg + - (this.currentLineIndex >= 0 ? - ' in line ' + this.program[this.evalLineIndex].lineNumber() : - '') + '\r\n'); + this.printUnicode((this.cursorX != 0 ? '\r\n' : '') + '\u0007? ' + msg + + (this.currentLineIndex >= 0 ? ' in line ' + + this.program[this.evalLineIndex].lineNumber() : + '') + '\r\n'); this.gotoState(2 /* STATE_PROMPT */); this.currentLineIndex = -1; this.evalLineIndex = -1; @@ -188,7 +173,7 @@ Demo.prototype.error = function(msg) { Demo.prototype.doInit = function() { this.vars = new Object(); this.program = new Array(); - this.vt100( + this.printUnicode( '\u001Bc\u001B[34;4m' + 'ShellInABox Demo Script\u001B[24;31m\r\n' + '\r\n' + @@ -215,20 +200,39 @@ Demo.prototype.doPrompt = function() { return false; }; +Demo.prototype.printUnicode = function(s) { + var out = ''; + for (var i = 0; i < s.length; i++) { + var c = s.charAt(i); + if (c < '\x0080') { + out += c; + } else { + var c = s.charCodeAt(i); + if (c < 0x800) { + out += String.fromCharCode(0xC0 + (c >> 6) ) + + String.fromCharCode(0x80 + ( c & 0x3F)); + } else if (c < 0x10000) { + out += String.fromCharCode(0xE0 + (c >> 12) ) + + String.fromCharCode(0x80 + ((c >> 6) & 0x3F)) + + String.fromCharCode(0x80 + ( c & 0x3F)); + } else if (c < 0x110000) { + out += String.fromCharCode(0xF0 + (c >> 18) ) + + String.fromCharCode(0x80 + ((c >> 12) & 0x3F)) + + String.fromCharCode(0x80 + ((c >> 6) & 0x3F)) + + String.fromCharCode(0x80 + ( c & 0x3F)); + } + } + } + this.vt100(out); +}; + Demo.prototype.doReadLine = function() { this.gotoState(3 /* STATE_READLINE */); var keys = this.keys; this.keys = ''; for (var i = 0; i < keys.length; i++) { var ch = keys.charAt(i); - if (ch >= ' ') { - this.line += ch; - this.vt100(ch); - } else if (ch == '\r' || ch == '\n') { - this.vt100('\r\n'); - this.gotoState(4 /* STATE_COMMAND */); - return false; - } else if (ch == '\u0008' || ch == '\u007F') { + if (ch == '\u0008' || ch == '\u007F') { if (this.line.length > 0) { this.line = this.line.substr(0, this.line.length - 1); if (this.cursorX == 0) { @@ -243,6 +247,13 @@ Demo.prototype.doReadLine = function() { } else { this.vt100('\u0007'); } + } else if (ch >= ' ') { + this.line += ch; + this.printUnicode(ch); + } else if (ch == '\r' || ch == '\n') { + this.vt100('\r\n'); + this.gotoState(4 /* STATE_COMMAND */); + return false; } else if (ch == '\u001B') { // This was probably a function key. Just eat all of the following keys. break; @@ -592,7 +603,7 @@ Demo.prototype.doList = function() { token = 'PRINT'; // fall thru default: - this.vt100((id ? ' ' : '') + token); + this.printUnicode((id ? ' ' : '') + token); space = false; id = true; break; @@ -621,7 +632,7 @@ Demo.prototype.doPrint = function() { if (value == undefined) { return; } - this.vt100(value.toString()); + this.printUnicode(value.toString()); } } if (last != ';') { diff --git a/demo/demo.jspp b/demo/demo.jspp index 9e13654..bc2b1a4 100644 --- a/demo/demo.jspp +++ b/demo/demo.jspp @@ -89,32 +89,17 @@ function Demo(container) { extend(Demo, VT100); Demo.prototype.keysPressed = function(ch) { - for (var i = 0; i < ch.length; i++) { - var c = ch.charCodeAt(i); - if (c == 3) { - if (this.state == STATE_EXEC) { + if (this.state == STATE_EXEC) { + for (var i = 0; i < ch.length; i++) { + var c = ch.charAt(i); + if (c == '\u0003') { this.keys = ''; this.error('Interrupted'); return; } - } else { - if (c < 128) { - this.keys += String.fromCharCode(c); - } else if (c < 0x800) { - this.keys += String.fromCharCode(0xC0 + (c >> 6) ) + - String.fromCharCode(0x80 + ( c & 0x3F)); - } else if (c < 0x10000) { - this.keys += String.fromCharCode(0xE0 + (c >> 12) ) + - String.fromCharCode(0x80 + ((c >> 6) & 0x3F)) + - String.fromCharCode(0x80 + ( c & 0x3F)); - } else if (c < 0x110000) { - this.keys += String.fromCharCode(0xF0 + (c >> 18) ) + - String.fromCharCode(0x80 + ((c >> 12) & 0x3F)) + - String.fromCharCode(0x80 + ((c >> 6) & 0x3F)) + - String.fromCharCode(0x80 + ( c & 0x3F)); - } } } + this.keys += ch; this.gotoState(this.state); }; @@ -175,10 +160,10 @@ Demo.prototype.error = function(msg) { if (msg == undefined) { msg = 'Syntax Error'; } - this.vt100((this.cursorX != 0 ? '\r\n' : '') + '\u0007? ' + msg + - (this.currentLineIndex >= 0 ? - ' in line ' + this.program[this.evalLineIndex].lineNumber() : - '') + '\r\n'); + this.printUnicode((this.cursorX != 0 ? '\r\n' : '') + '\u0007? ' + msg + + (this.currentLineIndex >= 0 ? ' in line ' + + this.program[this.evalLineIndex].lineNumber() : + '') + '\r\n'); this.gotoState(STATE_PROMPT); this.currentLineIndex = -1; this.evalLineIndex = -1; @@ -188,7 +173,7 @@ Demo.prototype.error = function(msg) { Demo.prototype.doInit = function() { this.vars = new Object(); this.program = new Array(); - this.vt100( + this.printUnicode( '\u001Bc\u001B[34;4m' + 'ShellInABox Demo Script\u001B[24;31m\r\n' + '\r\n' + @@ -215,20 +200,39 @@ Demo.prototype.doPrompt = function() { return false; }; +Demo.prototype.printUnicode = function(s) { + var out = ''; + for (var i = 0; i < s.length; i++) { + var c = s.charAt(i); + if (c < '\x0080') { + out += c; + } else { + var c = s.charCodeAt(i); + if (c < 0x800) { + out += String.fromCharCode(0xC0 + (c >> 6) ) + + String.fromCharCode(0x80 + ( c & 0x3F)); + } else if (c < 0x10000) { + out += String.fromCharCode(0xE0 + (c >> 12) ) + + String.fromCharCode(0x80 + ((c >> 6) & 0x3F)) + + String.fromCharCode(0x80 + ( c & 0x3F)); + } else if (c < 0x110000) { + out += String.fromCharCode(0xF0 + (c >> 18) ) + + String.fromCharCode(0x80 + ((c >> 12) & 0x3F)) + + String.fromCharCode(0x80 + ((c >> 6) & 0x3F)) + + String.fromCharCode(0x80 + ( c & 0x3F)); + } + } + } + this.vt100(out); +}; + Demo.prototype.doReadLine = function() { this.gotoState(STATE_READLINE); var keys = this.keys; this.keys = ''; for (var i = 0; i < keys.length; i++) { var ch = keys.charAt(i); - if (ch >= ' ') { - this.line += ch; - this.vt100(ch); - } else if (ch == '\r' || ch == '\n') { - this.vt100('\r\n'); - this.gotoState(STATE_COMMAND); - return false; - } else if (ch == '\u0008' || ch == '\u007F') { + if (ch == '\u0008' || ch == '\u007F') { if (this.line.length > 0) { this.line = this.line.substr(0, this.line.length - 1); if (this.cursorX == 0) { @@ -243,6 +247,13 @@ Demo.prototype.doReadLine = function() { } else { this.vt100('\u0007'); } + } else if (ch >= ' ') { + this.line += ch; + this.printUnicode(ch); + } else if (ch == '\r' || ch == '\n') { + this.vt100('\r\n'); + this.gotoState(STATE_COMMAND); + return false; } else if (ch == '\u001B') { // This was probably a function key. Just eat all of the following keys. break; @@ -592,7 +603,7 @@ Demo.prototype.doList = function() { token = 'PRINT'; // fall thru default: - this.vt100((id ? ' ' : '') + token); + this.printUnicode((id ? ' ' : '') + token); space = false; id = true; break; @@ -621,7 +632,7 @@ Demo.prototype.doPrint = function() { if (value == undefined) { return; } - this.vt100(value.toString()); + this.printUnicode(value.toString()); } } if (last != ';') { diff --git a/demo/vt100.js b/demo/vt100.js index 8e49d32..3787cd8 100644 --- a/demo/vt100.js +++ b/demo/vt100.js @@ -1500,7 +1500,7 @@ VT100.prototype.toggleBell = function() { }; VT100.prototype.about = function() { - alert("VT100 Terminal Emulator " + "2.7 (revision 120)" + + alert("VT100 Terminal Emulator " + "2.8 (revision 121)" + "\nCopyright 2008-2009 by Markus Gutschke\n" + "For more information check http://shellinabox.com"); }; diff --git a/shellinabox/externalfile.c b/shellinabox/externalfile.c index bf2b905..332cb4f 100644 --- a/shellinabox/externalfile.c +++ b/shellinabox/externalfile.c @@ -59,6 +59,10 @@ #include "libhttp/server.h" #include "logging/logging.h" +#ifdef HAVE_STRLCAT +#define strncat(a,b,c) ({ char *_a = (a); strlcat(_a, (b), (c)+1); _a; }) +#endif + static int externalFileHttpHandler(HttpConnection *http, void *arg, const char *buf, int len) { checkGraveyard(); diff --git a/shellinabox/launcher.c b/shellinabox/launcher.c index f22ed39..934a3c0 100644 --- a/shellinabox/launcher.c +++ b/shellinabox/launcher.c @@ -576,7 +576,7 @@ void closeAllFds(int *exceptFds, int num) { } } -#if !defined(HAVE_PTSNAME_R) && 0 +#if !defined(HAVE_OPENPTY) && !defined(HAVE_PTSNAME_R) static int ptsname_r(int fd, char *buf, size_t buflen) { // It is unfortunate that ptsname_r is not universally available. // For the time being, this is not a big problem, as ShellInABox is diff --git a/shellinabox/shell_in_a_box.js b/shellinabox/shell_in_a_box.js index 2354e96..4460671 100644 --- a/shellinabox/shell_in_a_box.js +++ b/shellinabox/shell_in_a_box.js @@ -355,7 +355,7 @@ ShellInABox.prototype.extendContextMenu = function(entries, actions) { }; ShellInABox.prototype.about = function() { - alert("Shell In A Box version " + "2.7 (revision 120)" + + alert("Shell In A Box version " + "2.8 (revision 121)" + "\nCopyright 2008-2009 by Markus Gutschke\n" + "For more information check http://shellinabox.com" + (typeof serverSupportsSSL != 'undefined' && serverSupportsSSL ? diff --git a/shellinabox/vt100.js b/shellinabox/vt100.js index 8e49d32..3787cd8 100644 --- a/shellinabox/vt100.js +++ b/shellinabox/vt100.js @@ -1500,7 +1500,7 @@ VT100.prototype.toggleBell = function() { }; VT100.prototype.about = function() { - alert("VT100 Terminal Emulator " + "2.7 (revision 120)" + + alert("VT100 Terminal Emulator " + "2.8 (revision 121)" + "\nCopyright 2008-2009 by Markus Gutschke\n" + "For more information check http://shellinabox.com"); };