Ignore:
Timestamp:
Mar 10, 2006, 3:41:24 PM (15 years ago)
Author:
Jean-Yves Lamoureux
Message:
  • Fixed configure script to check for UTF8 enabled slang, removed network driver debug output, added size > 255 in telnet negociation, fixed scrolling bug in network driver
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca/driver_network.c

    r584 r585  
    7171                       0xff, 253, 31,     // DO NAWS
    7272                       0xff, 254, 31,     // DON'T NAWS
    73                        0xff, 31, 250, 0, 30, 0, 0xFF, // to be replaced
     73                       0xff, 31, 250, 0, 30, 0, 0xFF, // Set size, replaced in display
    7474                       0xff, 240};
    7575
     
    7878{
    7979    int yes=1;
    80 
    81     printf("Initing network stack.\n");
    8280
    8381    kk->drv.p = malloc(sizeof(struct driver_private));
     
    8684
    8785    kk->drv.p->width = 80;
    88     kk->drv.p->height = 24;
     86    kk->drv.p->height = 23; // Avoid scrolling
    8987    kk->drv.p->port = 7575; // 75 75 decimal ASCII -> KK   // FIXME, sadly
    9088    kk->drv.p->client_count = 0;
     
    9694
    9795
    98     printf("socket\n");
    9996    if ((kk->drv.p->sockfd = socket(PF_INET, SOCK_STREAM, 0)) == -1) {
    10097        perror("socket");
    10198        return -1;
    10299    }
    103     printf("setsockopt\n");
     100
    104101    if (setsockopt(kk->drv.p->sockfd,SOL_SOCKET,SO_REUSEADDR,&yes,sizeof(int)) == -1) {
    105102        perror("setsockopt");
     
    112109    memset(&(kk->drv.p->my_addr.sin_zero), '\0', 8);
    113110
    114     printf("bind\n");
    115111    if (bind(kk->drv.p->sockfd, (struct sockaddr *)&kk->drv.p->my_addr, sizeof(struct sockaddr))
    116112                                                                   == -1) {
     
    122118    fcntl(kk->drv.p->sockfd, F_SETFL, O_NONBLOCK);
    123119
    124 
    125     printf("listen\n");
    126120    if (listen(kk->drv.p->sockfd, BACKLOG) == -1) {
    127121        perror("listen");
     
    129123    }
    130124
    131     printf("network ok.\n");
    132 
    133125    kk->drv.p->buffer = NULL;
    134126
     
    167159    int i;
    168160
     161    /* Get ANSI representation of the image */
    169162    kk->drv.p->buffer = cucul_get_ansi(kk->qq, 0, &kk->drv.p->size);;
    170163
     
    185178static unsigned int network_get_event(caca_t *kk)
    186179{
     180    /* Manage new connections as this function will be called sometimes
     181     *  more often than display
     182     */
    187183    manage_connections(kk);
    188184
    189     /* Not handled */
     185    /* Event not handled */
    190186    return 0;
    191187}
     
    201197    kk->drv.p->clilen = sizeof(kk->drv.p->remote_addr);
    202198    fd = accept(kk->drv.p->sockfd, (struct sockaddr *) &kk->drv.p->remote_addr, &kk->drv.p->clilen);
    203     if(fd != -1)
     199    if(fd != -1) /* That's non blocking socket, -1 if no connection received */
    204200    {
    205201        if(kk->drv.p->fd_list == NULL)
     
    232228
    233229    /* FIXME, handle >255 sizes */
     230    codes[15] = (unsigned char) (kk->drv.p->width & 0xff00)>>8;
    234231    codes[16] = (unsigned char) kk->drv.p->width & 0xff;
     232    codes[17] = (unsigned char) (kk->drv.p->height & 0xff00)>>8;
    235233    codes[18] = (unsigned char) kk->drv.p->height & 0xff;
    236234           
     
    243241        return -1;
    244242   
     243    /* Send actual data */
    245244    if (send(fd, kk->drv.p->buffer, kk->drv.p->size, 0) == -1)
    246245        return -1;
Note: See TracChangeset for help on using the changeset viewer.