Browse Source

* Added CACA_NETWORK_PORT env and related documentation

tags/v0.99.beta14
Jean-Yves Lamoureux jylam 18 years ago
parent
commit
d47bd8b490
3 changed files with 22 additions and 4 deletions
  1. +2
    -2
      caca/caca.c
  2. +4
    -0
      caca/caca.h
  3. +16
    -2
      caca/driver_network.c

+ 2
- 2
caca/caca.c View File

@@ -114,10 +114,10 @@ static int caca_init_driver(caca_t *kk)
{
#if defined(HAVE_GETENV) && defined(HAVE_STRCASECMP)
char *var = getenv("CACA_DRIVER");
/* If the environment variable was set, use it */
if(var && *var)
{
{
#if defined(USE_WIN32)
if(!strcasecmp(var, "win32"))
win32_init_driver(kk);


+ 4
- 0
caca/caca.h View File

@@ -92,6 +92,10 @@
* \li \b CACA_FONT: set the rendered font. The format of this variable is
* implementation dependent, but since it currently only works with the
* 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__


+ 16
- 2
caca/driver_network.c View File

@@ -77,17 +77,30 @@ static char codes[] = {0xff, 0xfb, 0x01, // WILL ECHO
static int network_init_graphics(caca_t *kk)
{
int yes=1;
int net_port = 7575;
char *network_port;


kk->drv.p = malloc(sizeof(struct driver_private));
if(kk->drv.p == NULL)
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->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->fd_list = NULL;

kk->drv.p->port = net_port;


_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;
}


#endif // USE_NETWORK


Loading…
Cancel
Save