CWB
Data Structures | Typedefs | Functions
fileutils.h File Reference
#include <sys/types.h>
#include "globals.h"

Data Structures

struct  _CLStream
 

Typedefs

typedef struct _CLStreamCLStream
 

Functions

off_t file_length (char *filename)
 Gets the size of the specified file; returns EOF for error. More...
 
off_t fd_file_length (FILE *fd)
 Gets the size of the specified file; returns EOF for error. More...
 
off_t fi_file_length (int fileno)
 Gets the size of the specified file; returns EOF for error. More...
 
long fprobe (char *fname)
 Gets the size of the specified file; returns EOF for error. More...
 
int is_directory (char *path)
 Checks whether the specified path indicates a directory. More...
 
int is_file (char *path)
 Checks whether the specified path indicates a regular file. More...
 
int is_link (char *path)
 Checks whether the specified path indicates a link. More...
 

Typedef Documentation

typedef struct _CLStream* CLStream

Function Documentation

off_t fd_file_length ( FILE *  fd)

Gets the size of the specified file; returns EOF for error.

As file_length, but the file is specified by file handle, not name.

Parameters
fdThe file to size up.
Returns
Size of file in bytes.
off_t fi_file_length ( int  fileno)

Gets the size of the specified file; returns EOF for error.

As file_length, but the file is specified by number, not name.

See also
file_length
Parameters
filenoThe file to size up.
Returns
Size of file in bytes.
off_t file_length ( char *  filename)

Gets the size of the specified file; returns EOF for error.

Parameters
filenameThe file to size up.
Returns
Size of file in bytes (or EOF if call to stat() failed)

Referenced by attach_subcorpus(), and comp_component_state().

long fprobe ( char *  fname)

Gets the size of the specified file; returns EOF for error.

Duplicates functionality of file_length, but return is long instead of off_t.

See also
file_length
Parameters
fnameThe file to size up.
Returns
Size of file in bytes.
int is_directory ( char *  path)

Checks whether the specified path indicates a directory.

Parameters
pathPath to check.
Returns
Boolean. (Also false if there's an error.)

Referenced by makeall_do_attribute().

int is_file ( char *  path)

Checks whether the specified path indicates a regular file.

Parameters
pathPath to check.
Returns
Boolean. (Also false if there's an error.)
int is_link ( char *  path)

Checks whether the specified path indicates a link.

Note this function always returns false in Windows, because Windows doesn't have Unix-style links. (.lnk files don't count.)

Parameters
pathPath to check.
Returns
Boolean. (Also false if there's an error.)