Changeset 1201 for toilet


Ignore:
Timestamp:
Oct 13, 2006, 3:36:23 PM (14 years ago)
Author:
Sam Hocevar
Message:
  • Moved I/O functions into a separate module.
Location:
toilet/trunk/src
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • toilet/trunk/src/Makefile.am

    r1101 r1201  
    33
    44toilet_SOURCES = main.c \
     5        io.c io.h \
    56        render.c render.h \
    67        filters.c filter.h \
  • toilet/trunk/src/figlet.c

    r1200 r1201  
    2727
    2828#include "toilet.h"
     29#include "io.h"
    2930#include "figlet.h"
    3031
     
    123124    char hardblank[10];
    124125    cucul_buffer_t *b;
    125     FILE *f;
     126    TOIFILE *f;
    126127    unsigned int i, j, size, comment_lines;
    127128
     
    129130    snprintf(path, 2047, "%s/%s.tlf", cx->dir, cx->font);
    130131    path[2047] = '\0';
    131     f = fopen(path, "r");
     132    f = toiopen(path, "r");
    132133    if(!f)
    133134    {
    134135        snprintf(path, 2047, "%s/%s.flf", cx->dir, cx->font);
    135136        path[2047] = '\0';
    136         f = fopen(path, "r");
     137        f = toiopen(path, "r");
    137138        if(!f)
    138139        {
     
    146147    cx->full_layout = 0;
    147148    cx->codetag_count = 0;
    148     fgets(buf, 2048, f);
     149    toigets(buf, 2048, f);
    149150    if(sscanf(buf, "%*[ft]lf2a%6s %u %u %u %i %u %u %u %u\n", hardblank,
    150151              &cx->height, &cx->baseline, &cx->max_length,
     
    153154    {
    154155        fprintf(stderr, "font `%s' has invalid header\n", path);
    155         fclose(f);
     156        toiclose(f);
    156157        return -1;
    157158    }
     
    161162    /* Skip comment lines */
    162163    for(i = 0; i < comment_lines; i++)
    163         fgets(buf, 2048, f);
     164        toigets(buf, 2048, f);
    164165
    165166    /* Read mandatory characters (32-127, 196, 214, 220, 228, 246, 252, 223)
     
    185186        else
    186187        {
    187             if(fgets(buf, 2048, f) == NULL)
     188            if(toigets(buf, 2048, f) == NULL)
    188189                break;
    189190
     
    210211                data = realloc(data, size += 2048);
    211212
    212             fgets(data + i, 2048, f);
     213            toigets(data + i, 2048, f);
    213214            i = (uintptr_t)strchr(data + i, 0) - (uintptr_t)data;
    214215        }
    215216    }
    216217
    217     fclose(f);
     218    toiclose(f);
    218219
    219220    if(cx->glyphs < EXT_GLYPHS)
Note: See TracChangeset for help on using the changeset viewer.