@@ -114,10 +114,10 @@ static int caca_init_driver(caca_t *kk) | |||||
{ | { | ||||
#if defined(HAVE_GETENV) && defined(HAVE_STRCASECMP) | #if defined(HAVE_GETENV) && defined(HAVE_STRCASECMP) | ||||
char *var = getenv("CACA_DRIVER"); | char *var = getenv("CACA_DRIVER"); | ||||
/* If the environment variable was set, use it */ | /* If the environment variable was set, use it */ | ||||
if(var && *var) | if(var && *var) | ||||
{ | |||||
{ | |||||
#if defined(USE_WIN32) | #if defined(USE_WIN32) | ||||
if(!strcasecmp(var, "win32")) | if(!strcasecmp(var, "win32")) | ||||
win32_init_driver(kk); | win32_init_driver(kk); | ||||
@@ -92,6 +92,10 @@ | |||||
* \li \b CACA_FONT: set the rendered font. The format of this variable is | * \li \b CACA_FONT: set the rendered font. The format of this variable is | ||||
* implementation dependent, but since it currently only works with the | * implementation dependent, but since it currently only works with the | ||||
* X11 driver, an X11 font name such as "fixed" or "5x7" is expected. | * X11 driver, an X11 font name such as "fixed" or "5x7" is expected. | ||||
* | |||||
* \li \b CACA_NETWORK_PORT: set the port the network driver will listen on. | |||||
* Obviously only works when using CACA_DRIVER=network. | |||||
* Default to 7575 (KK in ASCII Dec) | |||||
*/ | */ | ||||
#ifndef __CACA_H__ | #ifndef __CACA_H__ | ||||
@@ -77,17 +77,30 @@ static char codes[] = {0xff, 0xfb, 0x01, // WILL ECHO | |||||
static int network_init_graphics(caca_t *kk) | static int network_init_graphics(caca_t *kk) | ||||
{ | { | ||||
int yes=1; | int yes=1; | ||||
int net_port = 7575; | |||||
char *network_port; | |||||
kk->drv.p = malloc(sizeof(struct driver_private)); | kk->drv.p = malloc(sizeof(struct driver_private)); | ||||
if(kk->drv.p == NULL) | if(kk->drv.p == NULL) | ||||
return -1; | return -1; | ||||
#if defined(HAVE_GETENV) | |||||
network_port = getenv("CACA_NETWORK_PORT"); | |||||
if(network_port && *network_port) { | |||||
net_port = atoi(network_port); | |||||
if(!net_port) | |||||
net_port = 7575; | |||||
} | |||||
#endif | |||||
kk->drv.p->width = 80; | kk->drv.p->width = 80; | ||||
kk->drv.p->height = 23; // Avoid scrolling | kk->drv.p->height = 23; // Avoid scrolling | ||||
kk->drv.p->port = 7575; // 75 75 decimal ASCII -> KK // FIXME, sadly | |||||
kk->drv.p->client_count = 0; | kk->drv.p->client_count = 0; | ||||
kk->drv.p->fd_list = NULL; | kk->drv.p->fd_list = NULL; | ||||
kk->drv.p->port = net_port; | |||||
_cucul_set_size(kk->qq, kk->drv.p->width, kk->drv.p->height); | _cucul_set_size(kk->qq, kk->drv.p->width, kk->drv.p->height); | ||||
@@ -265,5 +278,6 @@ void network_init_driver(caca_t *kk) | |||||
kk->drv.get_event = network_get_event; | kk->drv.get_event = network_get_event; | ||||
} | } | ||||
#endif // USE_NETWORK | #endif // USE_NETWORK | ||||