toilet/src/io.c
2006-10-13 13:36:23 +00:00

50 lines
955 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* TOIlet The Other Implementations letters
* Copyright (c) 2006 Sam Hocevar <sam@zoy.org>
* All Rights Reserved
*
* $Id$
*
* 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.
*/
/*
* This file contains functions for compressed file I/O.
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include "io.h"
TOIFILE *toiopen(const char *path, const char *mode)
{
TOIFILE *toif;
FILE *f = fopen(path, mode);
if(!f)
return NULL;
toif = malloc(sizeof(*toif));
toif->f = f;
return toif;
}
int toiclose(TOIFILE *toif)
{
FILE *f = toif->f;
free(toif);
return fclose(f);
}
char *toigets(char *s, int size, TOIFILE *toif)
{
return fgets(s, size, toif->f);
}