diff --git a/README.rst b/README.rst index cc80269..c91307b 100644 --- a/README.rst +++ b/README.rst @@ -85,17 +85,20 @@ Commandline usage usage: achilterm [options] options: - -h, --help show this help message and exit - -pPORT, --port=PORT Set the TCP port (default: 8022) - -cCMD, --command=CMD set the command (default: /bin/login or ssh localhost) - -l, --log log requests to stderr (default: quiet mode) - -d, --daemon run as daemon in the background - -PPIDFILE, --pidfile=PIDFILE - set the pidfile (default: /var/run/achilterm.pid) - -iINDEX_FILE, --index=INDEX_FILE - default index file (default: achilterm.html) - -uUID, --uid=UID Set the daemon's user id - -L, --lite use Achiltermlite + --version show program's version number and exit + -h, --help show this help message and exit + -p PORT, --port=PORT set the TCP port (default: 8022) + -c CMD, --command=CMD set the command (default: /bin/login or ssh localhost) + -l, --log log requests to stderr (default: quiet mode) + -d, --daemon run as daemon in the background + -P PIDFILE, --pidfile=PIDFILE + set the pidfile (default: /var/run/achilterm.pid) + -i INDEX_FILE, --index=INDEX_FILE + default index file (default: achilterm.html) + -u UID, --uid=UID set the daemon's user id + -L, --lite use Achiltermlite + -w WIDTH, --width=WIDTH set the width (default: 80) + -H HEIGHT, --height=HEIGHT set the height (default: 25) Configuration example --------------------- diff --git a/achilterm.1 b/achilterm.1 index 52003df..7360008 100644 --- a/achilterm.1 +++ b/achilterm.1 @@ -1,4 +1,4 @@ -.TH achilterm "1" "August 2016" "achilterm 0.20" "User commands" +.TH achilterm "1" "August 2016" "achilterm 0.21" "User commands" .SH NAME Achilterm \- Web based terminal written in python @@ -15,11 +15,15 @@ It can use almost any web browser and even works through firewalls. .SH OPTIONS A summary of the options supported by \fBachilterm\fR is included below: - \fB-h, --help\fR show this help message and exit - \fB-pPORT, --port=PORT\fR Set the TCP port (default: 8022) - \fB-cCMD, --command=CMD\fR set the command (default: /bin/login or ssh localhost) - \fB-l, --log\fR log requests to stderr (default: quiet mode) - \fB-L, --lite\fR use Achiltermlite + \fB--version\fR show program's version number and exit + \fB-h, --help\fR show this help message and exit + \fB-p PORT, --port=PORT\fR set the TCP port (default: 8022) + \fB-c CMD, --command=CMD\fR set the command (default: /bin/login or ssh localhost) + \fB-l, --log\fR log requests to stderr (default: quiet mode) + \fB-d, --daemon\fR run as daemon in the background + \fB-L, --lite\fR use Achiltermlite + \fB-w WIDTH, --width=WIDTH\fR set the width (default: 80) + \fB-H HEIGHT, --height=HEIGHT\fR set the height (default: 25) .SH AUTHOR Florent Gallaire diff --git a/achilterm/achilterm.html b/achilterm/achilterm.html index b74ecf7..10874c0 100644 --- a/achilterm/achilterm.html +++ b/achilterm/achilterm.html @@ -7,7 +7,7 @@ diff --git a/achilterm/achilterm.py b/achilterm/achilterm.py index 0b04b74..a3f0da5 100755 --- a/achilterm/achilterm.py +++ b/achilterm/achilterm.py @@ -19,7 +19,7 @@ along with this program. If not, see . """ -__version__ = '0.20' +__version__ = '0.21' import array,cgi,fcntl,glob,mimetypes,optparse,os,pty,random,re,signal,select,sys,threading,time,termios,struct,pwd @@ -488,7 +488,7 @@ def loop(self): pass class AchilTerm: - def __init__(self,cmd=None,index_file='achilterm.html',lite=False): + def __init__(self,cmd=None,index_file='achilterm.html',lite=False,width=80,height=25): os.chdir(os.path.normpath(os.path.dirname(__file__))) if lite: index_file = 'achiltermlite.html' @@ -496,7 +496,7 @@ def __init__(self,cmd=None,index_file='achilterm.html',lite=False): for i in ['css','html','js']: for j in glob.glob('*.%s'%i): self.files[j]=open(j).read() - self.files['index']=open(index_file).read() + self.files['index']=open(index_file).read() % {'width': width, 'height': height} self.mime = mimetypes.types_map.copy() self.mime['.html']= 'text/html; charset=UTF-8' self.multi = Multiplex(cmd) @@ -552,14 +552,16 @@ def log_message(self, format, *args): def main(): parser = optparse.OptionParser(version='Achilterm version ' + __version__) - parser.add_option("-p", "--port", dest="port", default="8022", help="Set the TCP port (default: 8022)") + parser.add_option("-p", "--port", dest="port", default="8022", help="set the TCP port (default: 8022)") parser.add_option("-c", "--command", dest="cmd", default=None,help="set the command (default: /bin/login or ssh localhost)") parser.add_option("-l", "--log", action="store_true", dest="log",default=0,help="log requests to stderr (default: quiet mode)") parser.add_option("-d", "--daemon", action="store_true", dest="daemon", default=0, help="run as daemon in the background") parser.add_option("-P", "--pidfile",dest="pidfile",default="/var/run/achilterm.pid",help="set the pidfile (default: /var/run/achilterm.pid)") parser.add_option("-i", "--index", dest="index_file", default=0, help="default index file (default: achilterm.html)") - parser.add_option("-u", "--uid", dest="uid", help="Set the daemon's user id") + parser.add_option("-u", "--uid", dest="uid", help="set the daemon's user id") parser.add_option("-L", "--lite", action="store_true", dest="lite", default=0, help="use Achiltermlite") + parser.add_option("-w", "--width", dest="width", default="80", help="set the width (default: 80)") + parser.add_option("-H", "--height", dest="height", default="25", help="set the height (default: 25)") (o, a) = parser.parse_args() if o.daemon: pid=os.fork() @@ -590,9 +592,9 @@ def main(): else: handler_class = NoLogWSGIRequestHandler if o.index_file: - at=AchilTerm(o.cmd,os.path.abspath(o.index_file),o.lite) + at=AchilTerm(o.cmd,os.path.abspath(o.index_file),o.lite,o.width,o.height) else: - at=AchilTerm(o.cmd,lite=o.lite) + at=AchilTerm(o.cmd,lite=o.lite,width=o.width,height=o.height) try: make_server('localhost', int(o.port), at, handler_class=handler_class).serve_forever() except KeyboardInterrupt: diff --git a/achilterm/achiltermlite.html b/achilterm/achiltermlite.html index e739e0c..0bb9848 100644 --- a/achilterm/achiltermlite.html +++ b/achilterm/achiltermlite.html @@ -7,7 +7,7 @@