|
Atrinik Server 2.5
|
#include <global.h>Go to the source code of this file.
Functions | |
| char * | tempnam_local (const char *dir, const char *pfx) |
| char * | strdup_local (const char *str) |
| char * | strerror_local (int errnum) |
| unsigned long | isqrt (unsigned long n) |
| static FILE * | open_and_uncompress_file (const char *ext, const char *uncompressor, const char *name, int flag, int *compressed) |
| FILE * | open_and_uncompress (const char *name, int flag, int *compressed) |
| void | close_and_delete (FILE *fp, int compressed) |
| void | make_path_to_file (char *filename) |
| const char * | strcasestr_local (const char *s, const char *find) |
Variables | |
| static uint32 | curtmp = 0 |
| char * | uncomp [NROF_COMPRESS_METHODS][3] |
This file contains various functions that are not really unique for Atrinik, but rather provides what should be standard functions for systems that do not have them. In this way, most of the nasty system dependent stuff is contained here, with the program calling these functions.
Definition in file porting.c.
| void close_and_delete | ( | FILE * | fp, |
| int | compressed | ||
| ) |
Closes specified file.
| fp | File to close. |
| compressed | Whether the file was compressed or not. Set by open_and_uncompress(). |
| unsigned long isqrt | ( | unsigned long | n | ) |
| void make_path_to_file | ( | char * | filename | ) |
| FILE* open_and_uncompress | ( | const char * | name, |
| int | flag, | ||
| int * | compressed | ||
| ) |
open_and_uncompress() first searches for the original filename. If it exists, then it opens it and returns the file-pointer.
| name | The base file name without compression extension. | |
| flag | Only used for compressed files:
| |
| [out] | compressed | Set to zero if the file was uncompressed |
| static FILE* open_and_uncompress_file | ( | const char * | ext, |
| const char * | uncompressor, | ||
| const char * | name, | ||
| int | flag, | ||
| int * | compressed | ||
| ) | [static] |
Open and possibly uncompress a file.
| ext | The extension if the file is compressed. | |
| uncompressor | The command to uncompress the file if the file is compressed. | |
| name | The base file name without compression extension. | |
| flag | Only used for compressed files:
| |
| [out] | compressed | Set to zero if the file was uncompressed. |
| const char* strcasestr_local | ( | const char * | s, |
| const char * | find | ||
| ) |
| char* strdup_local | ( | const char * | str | ) |
| char* strerror_local | ( | int | errnum | ) |
| char* tempnam_local | ( | const char * | dir, |
| const char * | pfx | ||
| ) |
A replacement for the tempnam() function since it's not defined at some UNIX variants.
| dir | Directory where to create the file. Can be NULL, in which case NULL is returned. |
| pfx | prefix to create unique name. Can be NULL. |
| char* uncomp[NROF_COMPRESS_METHODS][3] |
{
{NULL, NULL, NULL},
{".Z", UNCOMPRESS, COMPRESS},
{".gz", GUNZIP, GZIP},
{".bz2", BUNZIP, BZIP}
}
This is a list of the suffix, uncompress and compress functions. Thus, if you have some other compress program you want to use, the only thing that needs to be done is to extended this.
The first entry must be NULL - this is what is used for non compressed files.
1.7.4