summaryrefslogtreecommitdiff
path: root/ebus-racket/dumper.rkt
diff options
context:
space:
mode:
authorYves Fischer <yvesf-git@xapek.org>2012-02-26 02:15:43 +0100
committerYves Fischer <yvesf-git@xapek.org>2012-02-26 02:15:43 +0100
commitb71ecd26a9a0822a890f9aa494c6821356ef6bea (patch)
treeee158f301ebc3c07bcda785f35377a1fd72c8a13 /ebus-racket/dumper.rkt
parent99e5d85621eb3b7153da9c7c46c3ab39f5d99f1f (diff)
downloadebus-alt-b71ecd26a9a0822a890f9aa494c6821356ef6bea.tar.gz
ebus-alt-b71ecd26a9a0822a890f9aa494c6821356ef6bea.zip
ebus-racket: cli interface
Diffstat (limited to 'ebus-racket/dumper.rkt')
-rwxr-xr-xebus-racket/dumper.rkt27
1 files changed, 27 insertions, 0 deletions
diff --git a/ebus-racket/dumper.rkt b/ebus-racket/dumper.rkt
new file mode 100755
index 0000000..7ac1da6
--- /dev/null
+++ b/ebus-racket/dumper.rkt
@@ -0,0 +1,27 @@
+#! /usr/bin/env racket
+#lang racket
+
+(require "parser.ss")
+
+;(define verbose? (make-parameter #f))
+(define connect-host? (make-parameter null))
+(define connect-port? (make-parameter null))
+
+(define greeting
+ (command-line
+ #:once-each
+; [("-v") "Verbose mode" (verbose? #t)]
+ [("-c" "--connect") host port
+ "Connect to server <host> <port>"
+ (connect-host? host)
+ (connect-port? (string->number port))
+ ]))
+; Connect
+(if (or (null? (connect-host?)) (null? (connect-port?)))
+ (display "Using stdin")
+ (let-values ([(cin cout) (tcp-connect (connect-host?) (connect-port?))])
+ (display (format "Connected to ~s ~s ~n" (connect-host?) (connect-port?)))
+ (current-input-port cin)))
+
+;
+(read-ebus-loop (current-input-port))