X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=lib%2Fguile%2Fdolcon-guile.c;h=7a0f3e21b423fddd5b2f0c752020575f2b0b7335;hb=12383d48e624213114482f29af819ff77aef70fa;hp=9e0575366eea8200634c35c041588b270a887324;hpb=0c58c2a0a0792f1b40969242bf1a483cf6405889;p=doldaconnect.git diff --git a/lib/guile/dolcon-guile.c b/lib/guile/dolcon-guile.c index 9e05753..7a0f3e2 100644 --- a/lib/guile/dolcon-guile.c +++ b/lib/guile/dolcon-guile.c @@ -24,21 +24,20 @@ struct scmcb static int fd = -1; static scm_bits_t resptype; -static SCM scm_dc_connect(SCM host, SCM port) +static SCM scm_dc_connect(SCM host) { - int cport; + char *chost; - SCM_ASSERT(SCM_STRINGP(host), host, SCM_ARG1, "dc-connect"); - if(port == SCM_UNDEFINED) + if(fd >= 0) + dc_disconnect(); + if(host == SCM_UNDEFINED) { - cport = -1; + chost = NULL; } else { - SCM_ASSERT(SCM_INUMP(port), port, SCM_ARG2, "dc-connect"); - cport = SCM_INUM(port); + SCM_ASSERT(SCM_STRINGP(host), host, SCM_ARG1, "dc-connect"); + chost = SCM_STRING_CHARS(host); } - if(fd >= 0) - dc_disconnect(); - if((fd = dc_connect(SCM_STRING_CHARS(host), cport)) < 0) + if((fd = dc_connect(chost)) < 0) scm_syserror("dc-connect"); return(SCM_MAKINUM(fd)); } @@ -322,7 +321,7 @@ static int resp_print(SCM respsmob, SCM port, scm_print_state *pstate) void init_guiledc(void) { - scm_c_define_gsubr("dc-connect", 1, 1, 0, scm_dc_connect); + scm_c_define_gsubr("dc-connect", 0, 1, 0, scm_dc_connect); scm_c_define_gsubr("dc-disconnect", 0, 0, 0, scm_dc_disconnect); scm_c_define_gsubr("dc-connected", 0, 0, 0, scm_dc_connected); scm_c_define_gsubr("dc-select", 0, 1, 0, scm_dc_select);