JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
run.sh: complain if not passed width/height
[watch-my-terminal.git] / server.coffee
index adf1d55..f79fe33 100644 (file)
@@ -1,3 +1,14 @@
+# SETTINGS
+term_columns = 97
+term_lines = 63
+http_port = 2218
+
+if process.argv.length > 2
+       term_columns = parseInt process.argv[2]
+if process.argv.length > 3
+       term_lines = parseInt process.argv[3]
+
+
 handler = (req, res) ->
        reply_err = (req, res, msg) ->
                res.writeHead(200, 'Content-Type': 'text/plain')
@@ -12,6 +23,9 @@ handler = (req, res) ->
                when '/terminal.js'
                        filename = __dirname + '/terminal.coffee'
                        type = 'text/javascript'
+               when '/htmlterm.js'
+                       filename = __dirname + '/htmlterm.coffee'
+                       type = 'text/javascript'
                when '/client.js'
                        filename = __dirname + '/client.coffee'
                        type = 'text/javascript'
@@ -35,9 +49,8 @@ io = require('socket.io').listen(app)
 fs = require('fs')
 terminal = require('./terminal.coffee')
 
-# SETTINGS
-app.listen(2218)
-term = terminal.new(104, 34)
+app.listen(http_port)
+term = terminal.new(term_columns, term_lines)
 
 sockets = []