Permalink
Browse files

move from google code

  • Loading branch information...
radiumce committed Aug 3, 2012
1 parent ac017fe commit 7eefb848ee0a7ad4276fd0ebf9003412e489812c
Showing with 819 additions and 0 deletions.
  1. +5 −0 Emakefile
  2. +9 −0 HowTo
  3. BIN native/linux/.DS_Store
  4. +7 −0 native/linux/README
  5. +60 −0 native/linux/readline_drv.c
  6. +392 −0 src/essh.erl
  7. +183 −0 src/essh_agent.erl
  8. +163 −0 src/essh_scheduler.erl
View
@@ -0,0 +1,5 @@
{'src/*',
[debug_info,
{i,"include"},
{outdir,"ebin"}
]}.
View
9 HowTo
@@ -0,0 +1,9 @@
RUN:
erl -noinput -pa $ESSH_HOME/ebin -run essh start $LD_LIBRARY_PATH $PATH_TO_SERVER_LST_FILE
SERVER_LST_FILE's Format:
#------------
server-1
server-2
server-3
#------------
View
Binary file not shown.
View
@@ -0,0 +1,7 @@
denpendency:
libreadline.so.5.2
libhistory.so.5.2
--------------------------
compiled under 64bit debian
readline_drv.so
@@ -0,0 +1,60 @@
#include <stdio.h>
#include "erl_driver.h"
#include <readline/history.h>
#include <readline/readline.h>
typedef struct {
ErlDrvPort port;
} readline_data;
static char *line_read = (char*)NULL;
static char *prompt = "essh>: ";
static ErlDrvData readline_drv_start(ErlDrvPort port, char *buff){
readline_data* d = (readline_data*)driver_alloc(sizeof(readline_data));
d->port = port;
return (ErlDrvData)d;
}
static void readline_drv_stop(ErlDrvData handle)
{
driver_free((char*)handle);
}
static void readline_drv_output(ErlDrvData handle, char *buff, int bufflen)
{
readline_data* d = (readline_data*)handle;
if (line_read)
{
free(line_read);
line_read = (char *)NULL;
}
line_read = readline(prompt);
if (line_read && *line_read)
add_history(line_read);
driver_output(d->port, line_read, strlen(line_read));
}
ErlDrvEntry readline_driver_entry = {
NULL, /* F_PTR init, N/A */
readline_drv_start, /* L_PTR start, called when port is opened */
readline_drv_stop, /* F_PTR stop, called when port is closed */
readline_drv_output, /* F_PTR output, called when erlang has sent */
NULL, /* F_PTR ready_input, called when input descriptor ready */
NULL, /* F_PTR ready_output, called when output descriptor ready */
"readline_drv", /* char *driver_name, the argument to open_port */
NULL, /* F_PTR finish, called when unloaded */
NULL, /* F_PTR control, port_command callback */
NULL, /* F_PTR timeout, reserved */
NULL /* F_PTR outputv, reserved */
};
DRIVER_INIT(readline_drv) /* must match name in driver_entry */
{
return &readline_driver_entry;
}
Oops, something went wrong.

0 comments on commit 7eefb84

Please sign in to comment.