瀏覽代碼

* Removed the network driver and replaced it with a cacaserver executable

that has all the functionality, except it does not work yet (the stdin
    reading routine is missing).
tags/v0.99.beta14
Sam Hocevar sam 19 年之前
父節點
當前提交
08a16c80fe
共有 7 個文件被更改,包括 157 次插入227 次删除
  1. +0
    -1
      caca/Makefile.am
  2. +0
    -3
      caca/caca.c
  3. +0
    -3
      caca/caca.h
  4. +5
    -11
      caca/caca_internals.h
  5. +7
    -1
      src/Makefile.am
  6. +20
    -1
      src/cacaplas.c
  7. +125
    -207
      src/cacaserver.c

+ 0
- 1
caca/Makefile.am 查看文件

@@ -14,7 +14,6 @@ libcaca_la_SOURCES = \
driver_conio.c \
driver_gl.c \
driver_ncurses.c \
driver_network.c \
driver_raw.c \
driver_slang.c \
driver_vga.c \


+ 0
- 3
caca/caca.c 查看文件

@@ -140,9 +140,6 @@ static int caca_init_driver(caca_t *kk)
#if defined(USE_NCURSES)
if(!strcasecmp(var, "ncurses")) return ncurses_install(kk);
#endif
#if defined(USE_NETWORK)
if(!strcasecmp(var, "network")) return network_install(kk);
#endif
#if defined(USE_VGA)
if(!strcasecmp(var, "vga")) return vga_install(kk);
#endif


+ 0
- 3
caca/caca.h 查看文件

@@ -92,9 +92,6 @@
* \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_PORT: set the port the network driver will listen on, when
* the output driver is "network". Default port is 51914 (0xCACA).
*/

#ifndef __CACA_H__


+ 5
- 11
caca/caca_internals.h 查看文件

@@ -46,23 +46,20 @@ enum caca_driver
#if defined(USE_GL)
CACA_DRIVER_GL = 3,
#endif
#if defined(USE_NETWORK)
CACA_DRIVER_NETWORK = 4,
#endif
#if defined(USE_NCURSES)
CACA_DRIVER_NCURSES = 5,
CACA_DRIVER_NCURSES = 4,
#endif
#if defined(USE_SLANG)
CACA_DRIVER_SLANG = 6,
CACA_DRIVER_SLANG = 5,
#endif
#if defined(USE_VGA)
CACA_DRIVER_VGA = 7,
CACA_DRIVER_VGA = 6,
#endif
#if defined(USE_WIN32)
CACA_DRIVER_WIN32 = 8,
CACA_DRIVER_WIN32 = 7,
#endif
#if defined(USE_X11)
CACA_DRIVER_X11 = 9,
CACA_DRIVER_X11 = 8,
#endif
};

@@ -73,9 +70,6 @@ int conio_install(caca_t *);
#if defined(USE_GL)
int gl_install(caca_t *);
#endif
#if defined(USE_NETWORK)
int network_install(caca_t *);
#endif
#if defined(USE_NCURSES)
int ncurses_install(caca_t *);
#endif


+ 7
- 1
src/Makefile.am 查看文件

@@ -5,7 +5,7 @@ pkgdata_DATA = caca.txt
EXTRA_DIST = caca.txt
AM_CPPFLAGS = -I$(top_srcdir)/cucul -I$(top_srcdir)/caca -DLIBCACA=1 -DX_DISPLAY_MISSING=1

bin_PROGRAMS = cacafire cacaball cacaplas cacaview cacamoir cacaplay
bin_PROGRAMS = cacafire cacaball cacaplas cacaserver cacaview cacamoir cacaplay

cacafire_SOURCES = aafire.c
cacafire_LDADD = ../caca/libcaca.la ../cucul/libcucul.la @CACA_LIBS@
@@ -19,6 +19,9 @@ cacaplas_LDADD = ../caca/libcaca.la ../cucul/libcucul.la @CACA_LIBS@ @MATH_LIBS@
cacamoir_SOURCES = cacamoir.c
cacamoir_LDADD = ../caca/libcaca.la ../cucul/libcucul.la @CACA_LIBS@ @MATH_LIBS@

cacaplay_SOURCES = cacaplay.c
cacaplay_LDADD = ../caca/libcaca.la ../cucul/libcucul.la @CACA_LIBS@

cacaview_SOURCES = cacaview.c
cacaview_LDADD = ../caca/libcaca.la ../cucul/libcucul.la @CACA_LIBS@
if USE_IMLIB2
@@ -32,3 +35,6 @@ endif
cacaplay_SOURCES = cacaplay.c
cacaplay_LDADD = ../caca/libcaca.la ../cucul/libcucul.la @CACA_LIBS@

cacaserver_SOURCES = cacaserver.c
cacaserver_LDADD = ../caca/libcaca.la ../cucul/libcucul.la @CACA_LIBS@


+ 20
- 1
src/cacaplas.c 查看文件

@@ -15,6 +15,7 @@
#include "config.h"

#if !defined(__KERNEL__)
# include <stdio.h>
# include <math.h>
# ifndef M_PI
# define M_PI 3.14159265358979323846
@@ -39,7 +40,7 @@ static void do_plasma(unsigned char *,

int main (int argc, char **argv)
{
cucul_t *qq; caca_t *kk;
cucul_t *qq, *qq2, *mask; caca_t *kk;
unsigned int red[256], green[256], blue[256], alpha[256];
double r[3], R[6];
struct cucul_bitmap *bitmap;
@@ -54,6 +55,9 @@ int main (int argc, char **argv)

caca_set_delay(kk, 20000);

qq2 = cucul_create(cucul_get_width(qq), cucul_get_height(qq));
mask = cucul_create(cucul_get_width(qq), cucul_get_height(qq));

/* Fill various tables */
for(i = 0 ; i < 256; i++)
red[i] = green[i] = blue[i] = alpha[i] = 0;
@@ -118,6 +122,21 @@ paused:
cucul_draw_bitmap(qq, 0, 0,
cucul_get_width(qq) - 1, cucul_get_height(qq) - 1,
bitmap, screen);

cucul_blit(qq2, 0, 0, qq, NULL);
cucul_invert(qq2);

cucul_clear(mask);
cucul_set_color(mask, CUCUL_COLOR_WHITE, CUCUL_COLOR_WHITE);
cucul_fill_ellipse(mask, (1.0 + 0.7 * sin(0.05 * (float)frame))
* 0.5 * cucul_get_width(mask),
(1.0 + 0.7 * cos(0.05 * (float)frame))
* 0.5 * cucul_get_height(mask),
cucul_get_width(mask) / 3,
cucul_get_height(mask) / 3, "#");

cucul_blit(qq, 0, 0, qq2, mask);

cucul_set_color(qq, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE);
cucul_putstr(qq, cucul_get_width(qq) - 30, cucul_get_height(qq) - 2,
" -=[ Powered by libcaca ]=- ");


caca/driver_network.c → src/cacaserver.c 查看文件

@@ -1,44 +1,40 @@
/*
* libcaca Colour ASCII-Art library
* Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org>
* cacaserver Colour ASCII-Art library
* Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org>
* 2006 Sam Hocevar <sam@zoy.org>
* All Rights Reserved
*
* This library is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
* modify it under the terms of the Do What The Fuck You Want To
* Public License, Version 2, as published by Sam Hocevar. See
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/

/** \file driver_network.c
* \version \$Id$
* \author Jean-Yves Lamoureux <jylam@lnxscene.org>
* \brief Network driver
*
* This file contains the libcaca network input and output driver
*/

#include "config.h"

#if defined(USE_NETWORK)
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <fcntl.h>
#include <string.h>
#include <signal.h>
#include <errno.h>

#include "cucul.h"
#include "caca.h"

#include "config.h"

#if defined(HAVE_UNISTD_H)
# include <unistd.h>
#endif

#include <stdarg.h>

#include "caca.h"
#include "caca_internals.h"
#include "cucul.h"
#include "cucul_internals.h"

#define BACKLOG 1337 /* Number of pending connections */
#define INBUFFER 32 /* Size of per-client input buffer */
@@ -64,22 +60,24 @@
"\x1b[?1049h" /* Clear screen */ \
"\x1b[?1049h" /* Clear screen again */


static char const telnet_commands[16][5] =
{"SE ", "NOP ", "DM ", "BRK ", "IP ", "AO ", "AYT ", "EC ",
"EL ", "GA ", "SB ", "WILL", "WONT", "DO ", "DONT", "IAC "};
{
"SE ", "NOP ", "DM ", "BRK ", "IP ", "AO ", "AYT ", "EC ",
"EL ", "GA ", "SB ", "WILL", "WONT", "DO ", "DONT", "IAC "
};

static char const telnet_options[37][5] =
{"????", "ECHO", "????", "SUGH", "????", "STTS", "TIMK", "????", "????", "????",
"????", "????", "????", "????", "????", "????", "????", "????", "????", "????",
"????", "????", "????", "????", "TTYP", "????", "????", "????", "????", "????",
"????", "NAWS", "TRSP", "RMFC", "LIMO", "????", "EVAR"};

{
"????", "ECHO", "????", "SUGH", "????", "STTS", "TIMK", "????",
"????", "????", "????", "????", "????", "????", "????", "????",
"????", "????", "????", "????", "????", "????", "????", "????",
"TTYP", "????", "????", "????", "????", "????", "????", "NAWS",
"TRSP", "RMFC", "LIMO", "????", "EVAR"
};

#define COMMAND_NAME(x) (x>=240)?telnet_commands[x-240]:"????"
#define OPTION_NAME(x) (x<=36)?telnet_options[x]:"????"


struct client
{
int fd;
@@ -90,7 +88,7 @@ struct client
int start, stop;
};

struct driver_private
struct server
{
unsigned int width, height;
unsigned int port;
@@ -98,6 +96,8 @@ struct driver_private
struct sockaddr_in my_addr;
socklen_t sin_size;

/* Input buffer */

char prefix[sizeof(INIT_PREFIX)];

struct cucul_export *ex;
@@ -108,79 +108,50 @@ struct driver_private
RETSIGTYPE (*sigpipe_handler)(int);
};

static void manage_connections(caca_t *kk);
static int send_data(caca_t *kk, struct client *c);
static void manage_connections(struct server *server);
static int send_data(struct server *server, struct client *c);
ssize_t nonblock_write(int fd, void *buf, size_t len);

static int network_init_graphics(caca_t *kk)
int main(void)
{
int yes = 1, flags;
int port = 0xCACA; /* 51914 */
unsigned int width = 0, height = 0;
cucul_t *qq;
int i, yes = 1, flags;
struct server *server;
char *tmp;

kk->drv.p = malloc(sizeof(struct driver_private));
if(kk->drv.p == NULL)
return -1;
server = malloc(sizeof(struct server));

#if defined(HAVE_GETENV)
tmp = getenv("CACA_PORT");
if(tmp && *tmp)
{
int new_port = atoi(tmp);
if(new_port)
port = new_port;
}

tmp = getenv("CACA_GEOMETRY");
if(tmp && *tmp)
sscanf(tmp, "%ux%u", &width, &height);
#endif

if(width && height)
{
kk->drv.p->width = width;
kk->drv.p->height = height;
}
else
{
kk->drv.p->width = 80;
kk->drv.p->height = 24;
}

kk->drv.p->client_count = 0;
kk->drv.p->clients = NULL;
kk->drv.p->port = port;

_cucul_set_size(kk->qq, kk->drv.p->width, kk->drv.p->height);
server->client_count = 0;
server->clients = NULL;
server->port = 0xCACA; /* 51914 */

/* FIXME, handle >255 sizes */
memcpy(kk->drv.p->prefix, INIT_PREFIX, sizeof(INIT_PREFIX));
tmp = strstr(kk->drv.p->prefix, "____");
tmp[0] = (unsigned char) (kk->drv.p->width & 0xff00) >> 8;
tmp[1] = (unsigned char) kk->drv.p->width & 0xff;
tmp[2] = (unsigned char) (kk->drv.p->height & 0xff00) >> 8;
tmp[3] = (unsigned char) kk->drv.p->height & 0xff;
if ((kk->drv.p->sockfd = socket(PF_INET, SOCK_STREAM, 0)) == -1)
memcpy(server->prefix, INIT_PREFIX, sizeof(INIT_PREFIX));
tmp = strstr(server->prefix, "____");
tmp[0] = (unsigned char) (server->width & 0xff00) >> 8;
tmp[1] = (unsigned char) server->width & 0xff;
tmp[2] = (unsigned char) (server->height & 0xff00) >> 8;
tmp[3] = (unsigned char) server->height & 0xff;

if((server->sockfd = socket(PF_INET, SOCK_STREAM, 0)) == -1)
{
perror("socket");
return -1;
}

if (setsockopt(kk->drv.p->sockfd, SOL_SOCKET,
SO_REUSEADDR, &yes, sizeof(int)) == -1)
if(setsockopt(server->sockfd, SOL_SOCKET,
SO_REUSEADDR, &yes, sizeof(int)) == -1)
{
perror("setsockopt SO_REUSEADDR");
return -1;
}

kk->drv.p->my_addr.sin_family = AF_INET;
kk->drv.p-> my_addr.sin_port = htons(kk->drv.p->port);
kk->drv.p->my_addr.sin_addr.s_addr = INADDR_ANY;
memset(&(kk->drv.p->my_addr.sin_zero), '\0', 8);
server->my_addr.sin_family = AF_INET;
server-> my_addr.sin_port = htons(server->port);
server->my_addr.sin_addr.s_addr = INADDR_ANY;
memset(&(server->my_addr.sin_zero), '\0', 8);

if (bind(kk->drv.p->sockfd, (struct sockaddr *)&kk->drv.p->my_addr,
if(bind(server->sockfd, (struct sockaddr *)&server->my_addr,
sizeof(struct sockaddr)) == -1)
{
perror("bind");
@@ -188,108 +159,78 @@ static int network_init_graphics(caca_t *kk)
}

/* Non blocking socket */
flags = fcntl(kk->drv.p->sockfd, F_GETFL, 0);
fcntl(kk->drv.p->sockfd, F_SETFL, flags | O_NONBLOCK);
flags = fcntl(server->sockfd, F_GETFL, 0);
fcntl(server->sockfd, F_SETFL, flags | O_NONBLOCK);

if (listen(kk->drv.p->sockfd, BACKLOG) == -1)
if(listen(server->sockfd, BACKLOG) == -1)
{
perror("listen");
return -1;
}

kk->drv.p->ex = NULL;
server->ex = NULL;

/* Ignore SIGPIPE */
kk->drv.p->sigpipe_handler = signal(SIGPIPE, SIG_IGN);
server->sigpipe_handler = signal(SIGPIPE, SIG_IGN);

fprintf(stderr, "initialised network, listening on port %i\n",
kk->drv.p->port);

return 0;
}
server->port);

static int network_end_graphics(caca_t *kk)
{
int i;

for(i = 0; i < kk->drv.p->client_count; i++)
/* Main loop */
for(;;)
{
close(kk->drv.p->clients[i].fd);
kk->drv.p->clients[i].fd = -1;
}
/* Manage new connections as this function will be called sometimes
* more often than display */
manage_connections(server);

if(kk->drv.p->ex)
cucul_free_export(kk->drv.p->ex);
/* Read data from stdin */
/* FIXME: read data, then continue if there was a new image */

/* Restore SIGPIPE handler */
signal(SIGPIPE, kk->drv.p->sigpipe_handler);

free(kk->drv.p);

return 0;
}

static int network_set_window_title(caca_t *kk, char const *title)
{
/* Not handled (yet) */
return 0;
}

static unsigned int network_get_window_width(caca_t *kk)
{
return kk->drv.p->width * 6;
}
/* Free the previous export buffer, if any */
if(server->ex)
{
cucul_free_export(server->ex);
server->ex = NULL;
}

static unsigned int network_get_window_height(caca_t *kk)
{
return kk->drv.p->height * 10;
}
/* Get ANSI representation of the image and skip the end-of buffer
* linefeed ("\r\n\0", 3 bytes) */
server->ex = cucul_create_export(qq, CUCUL_FORMAT_ANSI);
server->ex->size -= 3;

static void network_display(caca_t *kk)
{
int i;
for(i = 0; i < server->client_count; i++)
{
if(server->clients[i].fd == -1)
continue;

/* Free the previous export buffer, if any */
if(kk->drv.p->ex)
{
cucul_free_export(kk->drv.p->ex);
kk->drv.p->ex = NULL;
if(send_data(server, &server->clients[i]))
{
fprintf(stderr, "client %i dropped connection\n",
server->clients[i].fd);
close(server->clients[i].fd);
server->clients[i].fd = -1;
}
}
}

/* Get ANSI representation of the image and skip the end-of buffer
* linefeed ("\r\n\0", 3 bytes) */
kk->drv.p->ex = cucul_create_export(kk->qq, CUCUL_FORMAT_ANSI);
kk->drv.p->ex->size -= 3;

for(i = 0; i < kk->drv.p->client_count; i++)
/* Kill all remaining clients */
for(i = 0; i < server->client_count; i++)
{
if(kk->drv.p->clients[i].fd == -1)
if(server->clients[i].fd == -1)
continue;

if(send_data(kk, &kk->drv.p->clients[i]))
{
fprintf(stderr, "client %i dropped connection\n",
kk->drv.p->clients[i].fd);
close(kk->drv.p->clients[i].fd);
kk->drv.p->clients[i].fd = -1;
}
close(server->clients[i].fd);
server->clients[i].fd = -1;
}

manage_connections(kk);
}
if(server->ex)
cucul_free_export(server->ex);

static void network_handle_resize(caca_t *kk)
{
/* Not handled */
}
/* Restore SIGPIPE handler */
signal(SIGPIPE, server->sigpipe_handler);

static int network_get_event(caca_t *kk, struct caca_event *ev)
{
/* Manage new connections as this function will be called sometimes
* more often than display */
manage_connections(kk);
free(server);

/* Event not handled */
return 0;
}

@@ -297,13 +238,13 @@ static int network_get_event(caca_t *kk, struct caca_event *ev)
* XXX: The following functions are local
*/

static void manage_connections(caca_t *kk)
static void manage_connections(struct server *server)
{
int fd, flags;
struct sockaddr_in remote_addr;
socklen_t len = sizeof(struct sockaddr_in);

fd = accept(kk->drv.p->sockfd, (struct sockaddr *)&remote_addr, &len);
fd = accept(server->sockfd, (struct sockaddr *)&remote_addr, &len);
if(fd == -1)
return;

@@ -314,37 +255,37 @@ static void manage_connections(caca_t *kk)
flags = fcntl(fd, F_SETFL, 0);
fcntl(fd, F_SETFL, flags | O_NONBLOCK);

if(kk->drv.p->clients == NULL)
if(server->clients == NULL)
{
kk->drv.p->clients = malloc(sizeof(struct client));
if(kk->drv.p->clients == NULL)
server->clients = malloc(sizeof(struct client));
if(server->clients == NULL)
return;
}
else
{
kk->drv.p->clients = realloc(kk->drv.p->clients,
(kk->drv.p->client_count+1) * sizeof(struct client));
server->clients = realloc(server->clients,
(server->client_count+1) * sizeof(struct client));
}

kk->drv.p->clients[kk->drv.p->client_count].fd = fd;
kk->drv.p->clients[kk->drv.p->client_count].ready = 0;
kk->drv.p->clients[kk->drv.p->client_count].inbytes = 0;
kk->drv.p->clients[kk->drv.p->client_count].start = 0;
kk->drv.p->clients[kk->drv.p->client_count].stop = 0;
server->clients[server->client_count].fd = fd;
server->clients[server->client_count].ready = 0;
server->clients[server->client_count].inbytes = 0;
server->clients[server->client_count].start = 0;
server->clients[server->client_count].stop = 0;

/* If we already have data to send, send it to the new client */
if(send_data(kk, &kk->drv.p->clients[kk->drv.p->client_count]))
if(send_data(server, &server->clients[server->client_count]))
{
fprintf(stderr, "client %i dropped connection\n", fd);
close(fd);
kk->drv.p->clients[kk->drv.p->client_count].fd = -1;
server->clients[server->client_count].fd = -1;
return;
}

kk->drv.p->client_count++;
server->client_count++;
}

static int send_data(caca_t *kk, struct client *c)
static int send_data(struct server *server, struct client *c)
{
ssize_t ret;

@@ -397,7 +338,7 @@ static int send_data(caca_t *kk, struct client *c)
/* Send the telnet initialisation commands */
if(!c->ready)
{
ret = nonblock_write(c->fd, kk->drv.p->prefix, sizeof(INIT_PREFIX));
ret = nonblock_write(c->fd, server->prefix, sizeof(INIT_PREFIX));
if(ret == -1)
return (errno == EAGAIN) ? 0 : -1;

@@ -408,7 +349,7 @@ static int send_data(caca_t *kk, struct client *c)
}

/* No error, there's just nothing to send yet */
if(!kk->drv.p->ex)
if(!server->ex)
return 0;

/* If we have backlog, send the backlog */
@@ -433,7 +374,7 @@ static int send_data(caca_t *kk, struct client *c)
{
c->start += ret;

if(c->stop - c->start + strlen(ANSI_PREFIX) + kk->drv.p->ex->size
if(c->stop - c->start + strlen(ANSI_PREFIX) + server->ex->size
> OUTBUFFER)
{
/* Overflow! Empty buffer and start again */
@@ -444,7 +385,7 @@ static int send_data(caca_t *kk, struct client *c)
}

/* Need to move? */
if(c->stop + strlen(ANSI_PREFIX) + kk->drv.p->ex->size > OUTBUFFER)
if(c->stop + strlen(ANSI_PREFIX) + server->ex->size > OUTBUFFER)
{
memmove(c->outbuf, c->outbuf + c->start, c->stop - c->start);
c->stop -= c->start;
@@ -453,8 +394,8 @@ static int send_data(caca_t *kk, struct client *c)

memcpy(c->outbuf + c->stop, ANSI_PREFIX, strlen(ANSI_PREFIX));
c->stop += strlen(ANSI_PREFIX);
memcpy(c->outbuf + c->stop, kk->drv.p->ex->buffer, kk->drv.p->ex->size);
c->stop += kk->drv.p->ex->size;
memcpy(c->outbuf + c->stop, server->ex->buffer, server->ex->size);
c->stop += server->ex->size;

return 0;
}
@@ -474,7 +415,7 @@ static int send_data(caca_t *kk, struct client *c)

if(ret < (ssize_t)strlen(ANSI_PREFIX))
{
if(strlen(ANSI_PREFIX) + kk->drv.p->ex->size > OUTBUFFER)
if(strlen(ANSI_PREFIX) + server->ex->size > OUTBUFFER)
{
/* Overflow! Empty buffer and start again */
memcpy(c->outbuf, ANSI_RESET, strlen(ANSI_RESET));
@@ -485,14 +426,14 @@ static int send_data(caca_t *kk, struct client *c)

memcpy(c->outbuf, ANSI_PREFIX, strlen(ANSI_PREFIX) - ret);
c->stop = strlen(ANSI_PREFIX) - ret;
memcpy(c->outbuf + c->stop, kk->drv.p->ex->buffer, kk->drv.p->ex->size);
c->stop += kk->drv.p->ex->size;
memcpy(c->outbuf + c->stop, server->ex->buffer, server->ex->size);
c->stop += server->ex->size;

return 0;
}

/* Send actual data */
ret = nonblock_write(c->fd, kk->drv.p->ex->buffer, kk->drv.p->ex->size);
ret = nonblock_write(c->fd, server->ex->buffer, server->ex->size);
if(ret == -1)
{
if(errno == EAGAIN)
@@ -501,9 +442,9 @@ static int send_data(caca_t *kk, struct client *c)
return -1;
}

if(ret < (int)kk->drv.p->ex->size)
if(ret < (int)server->ex->size)
{
if(kk->drv.p->ex->size > OUTBUFFER)
if(server->ex->size > OUTBUFFER)
{
/* Overflow! Empty buffer and start again */
memcpy(c->outbuf, ANSI_RESET, strlen(ANSI_RESET));
@@ -512,8 +453,8 @@ static int send_data(caca_t *kk, struct client *c)
return 0;
}

memcpy(c->outbuf, kk->drv.p->ex->buffer, kk->drv.p->ex->size - ret);
c->stop = kk->drv.p->ex->size - ret;
memcpy(c->outbuf, server->ex->buffer, server->ex->size - ret);
c->stop = server->ex->size - ret;

return 0;
}
@@ -546,26 +487,3 @@ ssize_t nonblock_write(int fd, void *buf, size_t len)
return total;
}

/*
* Driver initialisation
*/

int network_install(caca_t *kk)
{
kk->drv.driver = CACA_DRIVER_NETWORK;

kk->drv.init_graphics = network_init_graphics;
kk->drv.end_graphics = network_end_graphics;
kk->drv.set_window_title = network_set_window_title;
kk->drv.get_window_width = network_get_window_width;
kk->drv.get_window_height = network_get_window_height;
kk->drv.display = network_display;
kk->drv.handle_resize = network_handle_resize;
kk->drv.get_event = network_get_event;
kk->drv.set_mouse = NULL;

return 0;
}

#endif /* USE_NETWORK */


Loading…
取消
儲存