/Users/huttone/Devel/sedflux-new/sedflux/trunk/ew/utils/eh_file_utils.c File Reference

#include <eh_utils.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <glib/gstdio.h>
#include <dirent.h>

Go to the source code of this file.

Functions

FILE * eh_fopen (const char *filename, const char *type)
gchar * eh_render_file_error_str (gint err_no)
FILE * eh_fopen_error (const char *file, const char *type, GError **error)
void eh_set_file_error_from_errno (GError **error, const gchar *file, gint err_no)
FILE * eh_open_file (const char *filename, const char *type)
FILE * eh_open_temp_file (const char *template, char **name_used)
gboolean eh_is_readable_file (const char *filename)
gboolean eh_is_writable_file (const char *filename)
gboolean eh_try_open (const char *file)
gboolean eh_open_dir (const char *dir, GError **error)
gboolean try_open (const char *filename, int flags)
gboolean eh_touch_file (const gchar *file, int flags, GError **error)
gboolean try_dir (const char *file, GError **error)
Eh_file_listeh_create_file_list (char *base_name)
gchar * eh_get_next_file (Eh_file_list *list)
void eh_destroy_file_list (Eh_file_list *list)


Function Documentation

Eh_file_list* eh_create_file_list ( char *  base_name  ) 

Create a list of successive file name.

Create a list of files that all have the same form but contain a numerical portion that is incremented. For instance, a list of files might be something like: file0001.txt, file0002.txt, etc.

The input is a template from which the file of the list will be made. The template must contain one '#' which indicates the position of the increment within the file names. The '#' will be replaced by a number with a format of "%04d".

Use eh_get_next_file to obtain the next file name in the list.

Parameters:
base_name The form for the files in the list.
Returns:
A pointer to an Eh_file_list.
See also:
eh_get_next_file , eh_destroy_file_list .

Definition at line 326 of file eh_file_utils.c.

References Eh_file_list::count, eh_free, eh_new, Eh_file_list::format, Eh_file_list::prefix, and Eh_file_list::suffix.

Referenced by init_cpr_data(), and main().

void eh_destroy_file_list ( Eh_file_list list  ) 

Destroy an Eh_file_list.

Parameters:
list A pointer to an Eh_file_list.
See also:
eh_create_file_list , eh_get_next_file .

Definition at line 371 of file eh_file_utils.c.

References eh_free, Eh_file_list::format, Eh_file_list::prefix, and Eh_file_list::suffix.

Referenced by destroy_cpr().

FILE* eh_fopen ( const char *  filename,
const char *  type 
)

Definition at line 4 of file eh_file_utils.c.

References eh_require.

Referenced by eh_open_file(), eh_write_project_info_file(), main(), sakura_set_constant_output_data(), and sed_process_create().

FILE* eh_fopen_error ( const char *  file,
const char *  type,
GError **  error 
)

Definition at line 90 of file eh_file_utils.c.

References eh_return_val_if_fail, and eh_set_file_error_from_errno().

Referenced by eh_dlm_print_full(), main(), sed_bathy_grid_scan_2d_binary(), sed_get_floor_sequence_3(), sed_hydro_file_guess_type(), sed_hydro_file_new(), sed_hydrotrend_byte_order(), sed_hydrotrend_read_n_recs(), and sed_hydrotrend_write().

gchar* eh_get_next_file ( Eh_file_list list  ) 

Get the next file name from an Eh_file_list.

Parameters:
list A pointer to an Eh_file_list.
Returns:
A pointer to string containing the next file name in the list.
See also:
eh_create_file_list , eh_destroy_file_list .

Definition at line 353 of file eh_file_utils.c.

References Eh_file_list::count, eh_free, Eh_file_list::format, Eh_file_list::prefix, and Eh_file_list::suffix.

Referenced by main(), and run_cpr().

gboolean eh_is_readable_file ( const char *  filename  ) 

Definition at line 160 of file eh_file_utils.c.

Referenced by eh_get_opt_defaults(), and set_default_values().

gboolean eh_is_writable_file ( const char *  filename  ) 

Definition at line 173 of file eh_file_utils.c.

gboolean eh_open_dir ( const char *  dir,
GError **  error 
)

Definition at line 210 of file eh_file_utils.c.

References eh_require, eh_return_val_if_fail, and eh_set_file_error_from_errno().

Referenced by eh_touch_file(), eh_try_open(), and init_data_dump().

FILE* eh_open_file ( const char *  filename,
const char *  type 
)

Definition at line 136 of file eh_file_utils.c.

References eh_fopen().

Referenced by inflow_write_output(), main(), plume_print_data(), sakura_write_data(), and sakura_write_output().

FILE* eh_open_temp_file ( const char *  template,
char **  name_used 
)

Definition at line 148 of file eh_file_utils.c.

gchar* eh_render_file_error_str ( gint  err_no  ) 

Definition at line 23 of file eh_file_utils.c.

Referenced by eh_set_file_error_from_errno().

void eh_set_file_error_from_errno ( GError **  error,
const gchar *  file,
gint  err_no 
)

Definition at line 109 of file eh_file_utils.c.

References eh_free, eh_render_file_error_str(), and eh_return_if_fail.

Referenced by eh_fopen_error(), eh_open_dir(), eh_open_scanner(), eh_scan_str(), eh_scan_str_array(), eh_touch_file(), sedflux_setup_project_dir(), and try_dir().

gboolean eh_touch_file ( const gchar *  file,
int  flags,
GError **  error 
)

Definition at line 248 of file eh_file_utils.c.

References eh_free, eh_open_dir(), eh_require, eh_return_val_if_fail, and eh_set_file_error_from_errno().

Referenced by init_met_station(), init_river(), and init_subsidence().

gboolean eh_try_open ( const char *  file  ) 

Definition at line 188 of file eh_file_utils.c.

References eh_free, and eh_open_dir().

Referenced by sed_epoch_sscan_filename().

gboolean try_dir ( const char *  file,
GError **  error 
)

Definition at line 286 of file eh_file_utils.c.

References eh_set_file_error_from_errno().

Referenced by init_cpr().

gboolean try_open ( const char *  filename,
int  flags 
)

Definition at line 232 of file eh_file_utils.c.


Generated on Fri Jan 4 18:04:18 2008 for sedflux by  doxygen 1.5.2