Use "address" instead of "file" in f_file to help make things less confusing.
Shorten use of "file_information" with "file".
Implement f_file_exists().
Implement f_file_exists_at().
Try to avoid returning f_invalid_parameter to represent invalid parameters for standard C/POSIX functions.
Implement new exceptions, like f_invalid_name and f_invalid_desciptor, to accommodate this.
Use f_string_eol instead of "\n".
#endif
#ifndef _di_f_file_open_
- f_return_status f_file_open(f_file *file_information, const f_string filename) {
+ f_return_status f_file_open(f_file *file, const f_string filename) {
#ifndef _di_level_0_parameter_checking_
- if (file_information == 0) return f_status_set_error(f_invalid_parameter);
+ if (file == 0) return f_status_set_error(f_invalid_parameter);
#endif // _di_level_0_parameter_checking_
// if file->mode is unset, then this may cause a segfault, depending on whether or not the libc will handle this appropriately
- if (file_information->mode == 0) return f_status_set_error(f_invalid_parameter);
+ if (file->mode == 0) return f_status_set_error(f_invalid_parameter);
- file_information->file = fopen(filename, file_information->mode);
+ file->address = fopen(filename, file->mode);
- if (file_information->file == 0) return f_status_set_error(f_file_not_found);
- if (ferror(file_information->file) != 0) return f_status_set_error(f_file_open_error);
+ if (file->address == 0) return f_status_set_error(f_file_not_found);
+ if (ferror(file->address) != 0) return f_status_set_error(f_file_open_error);
- file_information->id = fileno(file_information->file);
+ file->id = fileno(file->address);
- if (file_information->id == -1) return f_status_set_error(f_file_descriptor_error);
+ if (file->id == -1) return f_status_set_error(f_file_descriptor_error);
return f_none;
}
#endif // _di_f_file_open_
#ifndef _di_f_file_close_
- f_return_status f_file_close(f_file *file_information) {
+ f_return_status f_file_close(f_file *file) {
#ifndef _di_level_0_parameter_checking_
- if (file_information == 0) return f_status_set_error(f_invalid_parameter);
+ if (file == 0) return f_status_set_error(f_invalid_parameter);
#endif // _di_level_0_parameter_checking_
- if (file_information->file == 0) return f_status_set_error(f_file_not_open);
+ if (file->address == 0) return f_status_set_error(f_file_not_open);
// if we were given a file descriptor as well, make sure to flush all changes to the disk that are not flushed by the 'fflush()' command
- if (file_information->id != 0) {
+ if (file->id != 0) {
// make sure all unfinished data gets completed
- if (fsync(file_information->id) != 0) return f_status_set_error(f_file_synchronize_error);
+ if (fsync(file->id) != 0) return f_status_set_error(f_file_synchronize_error);
}
- if (fclose(file_information->file) == 0) {
- file_information->file = 0;
+ if (fclose(file->address) == 0) {
+ file->address = 0;
return f_none;
}
else return f_status_set_error(f_file_close_error);
}
#endif // _di_f_file_close_
+#ifndef _di_f_file_exists_
+ f_return_status f_file_exists(const f_string file_name) {
+ #ifndef _di_level_0_parameter_checking_
+ if (file_name == 0) return f_status_set_error(f_invalid_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (access(file_name, F_OK)) {
+ if (errno == ENOENT) {
+ return f_false;
+ }
+
+ if (errno == ENAMETOOLONG || errno == EFAULT) {
+ return f_status_set_error(f_invalid_name);
+ }
+ else if (errno == ENOMEM) {
+ return f_status_set_error(f_out_of_memory);
+ }
+ else if (errno == EOVERFLOW) {
+ return f_status_set_error(f_overflow);
+ }
+ else if (errno == ENOTDIR) {
+ return f_status_set_error(f_invalid_directory);
+ }
+ else if (errno == EACCES) {
+ return f_status_set_error(f_access_denied);
+ }
+ else if (errno == ELOOP) {
+ return f_status_set_error(f_loop);
+ }
+
+ return f_status_set_error(f_false);
+ }
+
+ return f_true;
+ }
+#endif // _di_f_file_exists_
+
+#ifndef _di_f_file_exists_at_
+ f_return_status f_file_exists_at(const int directory_file_descriptor, const f_string file_name, const int flags) {
+ #ifndef _di_level_0_parameter_checking_
+ if (directory_file_descriptor == 0) return f_status_set_error(f_invalid_parameter);
+ if (file_name == 0) return f_status_set_error(f_invalid_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (faccessat(directory_file_descriptor, file_name, F_OK, flags)) {
+ if (errno == ENOENT) {
+ return f_false;
+ }
+
+ if (errno == ENAMETOOLONG || errno == EFAULT) {
+ return f_status_set_error(f_invalid_name);
+ }
+ else if (errno == ENOMEM) {
+ return f_status_set_error(f_out_of_memory);
+ }
+ else if (errno == EOVERFLOW) {
+ return f_status_set_error(f_overflow);
+ }
+ else if (errno == ENOTDIR) {
+ return f_status_set_error(f_invalid_directory);
+ }
+ else if (errno == EACCES) {
+ return f_status_set_error(f_access_denied);
+ }
+ else if (errno == ELOOP) {
+ return f_status_set_error(f_loop);
+ }
+ else if (errno == EBADF) {
+ return f_status_set_error(f_invalid_descriptor);
+ }
+ else if (errno == EINVAL) {
+ return f_status_set_error(f_invalid_parameter);
+ }
+
+ return f_status_set_error(f_false);
+ }
+
+ return f_true;
+ }
+#endif // _di_f_file_exists_at_
+
#ifndef _di_f_file_flush_
- f_return_status f_file_flush(f_file *file_information) {
+ f_return_status f_file_flush(f_file *file) {
#ifndef _di_level_0_parameter_checking_
- if (file_information == 0) return f_status_set_error(f_invalid_parameter);
+ if (file == 0) return f_status_set_error(f_invalid_parameter);
#endif // _di_level_0_parameter_checking_
- if (file_information->file == 0) return f_status_set_error(f_file_not_open);
+ if (file->address == 0) return f_status_set_error(f_file_not_open);
- if (fflush(file_information->file) == 0) return f_none;
+ if (fflush(file->address) == 0) return f_none;
else return f_status_set_error(f_file_flush_error);
}
#endif // _di_f_file_flush_
#ifndef _di_f_file_read_
- f_return_status f_file_read(f_file *file_information, f_string_dynamic *buffer, const f_file_position location) {
+ f_return_status f_file_read(f_file *file, f_string_dynamic *buffer, const f_file_position location) {
#ifndef _di_level_0_parameter_checking_
- if (file_information == 0) return f_status_set_error(f_invalid_parameter);
+ if (file == 0) return f_status_set_error(f_invalid_parameter);
if (buffer->used >= buffer->size) return f_status_set_error(f_invalid_parameter);
if (location.buffer_start < 0) return f_status_set_error(f_invalid_parameter);
}
#endif // _di_level_0_parameter_checking_
- if (file_information->file == 0) return f_status_set_error(f_file_not_open);
+ if (file->address == 0) return f_status_set_error(f_file_not_open);
// first seek to 'where' we need to begin the read
- f_u_long current_file_position = ftell(file_information->file);
+ f_u_long current_file_position = ftell(file->address);
if (current_file_position == (f_u_long) -1) return f_status_set_error(f_file_seek_error);
f_s_int result = 0;
if (current_file_position > location.file_start) {
- result = f_file_seek_from_current(file_information->file, file_information->byte_size * (0 - (current_file_position - location.file_start)));
+ result = f_file_seek_from_current(file->address, file->byte_size * (0 - (current_file_position - location.file_start)));
}
else if (current_file_position < location.file_start) {
- result = f_file_seek_from_current(file_information->file, file_information->byte_size * (location.file_start - current_file_position));
+ result = f_file_seek_from_current(file->address, file->byte_size * (location.file_start - current_file_position));
}
if (result != 0) return f_status_set_error(f_file_seek_error);
// now do the actual read
if (location.total_elements == 0) {
- result = fread(buffer->string + location.buffer_start, file_information->byte_size, buffer->size - buffer->used - 1, file_information->file);
+ result = fread(buffer->string + location.buffer_start, file->byte_size, buffer->size - buffer->used - 1, file->address);
}
else {
- result = fread(buffer->string + location.buffer_start, file_information->byte_size, location.total_elements, file_information->file);
+ result = fread(buffer->string + location.buffer_start, file->byte_size, location.total_elements, file->address);
}
- if (file_information->file == 0) return f_status_set_error(f_file_read_error);
- if (ferror(file_information->file) != 0) return f_status_set_error(f_file_read_error);
+ if (file->address == 0) return f_status_set_error(f_file_read_error);
+ if (ferror(file->address) != 0) return f_status_set_error(f_file_read_error);
// now save how much of our allocated buffer is actually used
// also make sure that we aren't making used space vanish
if (location.buffer_start + result > buffer->used) {
- buffer->used = location.buffer_start + (result / file_information->byte_size);
+ buffer->used = location.buffer_start + (result / file->byte_size);
}
// append an EOS only when the total elements were set to 0
}
// make sure to communicate that we are done without a problem and the eof was reached
- if (feof(file_information->file)) {
+ if (feof(file->address)) {
return f_none_on_eof;
}
#endif // _di_f_file_read_
#ifndef _di_f_file_read_fifo_
- f_return_status f_file_read_fifo(f_file *file_information, f_string_dynamic *buffer) {
+ f_return_status f_file_read_fifo(f_file *file, f_string_dynamic *buffer) {
#ifndef _di_level_0_parameter_checking_
- if (file_information == 0) return f_status_set_error(f_invalid_parameter);
+ if (file == 0) return f_status_set_error(f_invalid_parameter);
if (buffer->used >= buffer->size) return f_status_set_error(f_invalid_parameter);
#endif // _di_level_0_parameter_checking_
- if (file_information->file == 0) return f_status_set_error(f_file_not_open);
+ if (file->address == 0) return f_status_set_error(f_file_not_open);
f_s_int result = 0;
// now do the actual read
- result = fread(buffer->string + buffer->used, file_information->byte_size, buffer->size - buffer->used - 1, file_information->file);
+ result = fread(buffer->string + buffer->used, file->byte_size, buffer->size - buffer->used - 1, file->address);
- if (file_information->file == 0) return f_status_set_error(f_file_read_error);
- if (ferror(file_information->file) != 0) return f_status_set_error(f_file_read_error);
+ if (file->address == 0) return f_status_set_error(f_file_read_error);
+ if (ferror(file->address) != 0) return f_status_set_error(f_file_read_error);
- buffer->used += (result / file_information->byte_size);
+ buffer->used += (result / file->byte_size);
// make sure to communicate that we are done without a problem and the eof was reached
- if (feof(file_information->file)) {
+ if (feof(file->address)) {
return f_none_on_eof;
}
#endif // _di_f_file_read_fifo_
#ifndef _di_f_file_stat_
- f_return_status f_file_stat(const f_string file, struct stat *file_stat) {
+ f_return_status f_file_stat(const f_string file_name, struct stat *file_stat) {
if (file_stat != 0) {
return f_none;
}
- f_s_int result = 0;
-
- result = stat(file, file_stat);
- if (result < 0) {
+ if (stat(file_name, file_stat) < 0) {
if (errno == ENAMETOOLONG || errno == EFAULT) {
- return f_status_set_error(f_invalid_parameter);
+ return f_status_set_error(f_invalid_name);
}
else if (errno == ENOMEM) {
return f_status_set_error(f_out_of_memory);
result = fstat(file_id, file_stat);
if (result < 0) {
if (errno == ENAMETOOLONG || errno == EFAULT) {
- return f_status_set_error(f_invalid_parameter);
+ return f_status_set_error(f_invalid_name);
}
else if (errno == ENOMEM) {
return f_status_set_error(f_out_of_memory);
// libc includes
#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#ifndef _di_f_file_
typedef struct {
- f_file_id id; // file descriptor
- size_t byte_size; // how many bytes to use on each read/write (for normal string handling this should be sizeof(f_string)
- FILE * file; // the file data type
- f_file_mode mode; // how the file is to be accessed (or is being accessed)
+ f_file_id id; // file descriptor.
+ size_t byte_size; // how many bytes to use on each read/write (for normal string handling this should be sizeof(f_string).
+ FILE * address; // a pointer to a file (generally opened).
+ f_file_mode mode; // how the file is to be accessed (or is being accessed).
} f_file;
#define f_file_initialize { 0, sizeof(char), 0, (f_file_mode) f_file_read_only }
#ifndef _di_f_macro_file_reset_position_
#define f_macro_file_reset_position(position, file) \
if (position.total_elements == 0) { \
- fseek(file.file, 0, SEEK_END); \
- position.total_elements = ftell(file.file); \
- fseek(file.file, 0, SEEK_SET); \
+ fseek(file.address, 0, SEEK_END); \
+ position.total_elements = ftell(file.address); \
+ fseek(file.address, 0, SEEK_SET); \
}
#endif // _di_f_macro_file_reset_position_
#ifndef _di_f_file_open_
/**
* open a particular file and save its stream.
- * filename = name of the file.
+ * file name = name of the file.
*/
- extern f_return_status f_file_open(f_file *file_information, const f_string filename);
+ extern f_return_status f_file_open(f_file *file, const f_string filename);
#endif // _di_f_file_open_
#ifndef _di_f_file_close_
/**
* close file.
*/
- extern f_return_status f_file_close(f_file *file_information);
+ extern f_return_status f_file_close(f_file *file);
#endif // _di_f_file_close_
+/**
+ * Check if a file exists.
+ *
+ * @param file_name
+ * The file name.
+ *
+ * @return
+ * f_true if file exists.
+ * f_false if file does not exist.
+ * f_invalid_parameter (with error bit) if a parameter is invalid.
+ * f_invalid_name (with error bit) if the filename is too long.
+ * f_out_of_memory (with error bit) if out of memory.
+ * f_overflow (with error bit) on overflow error.
+ * f_invalid_directory (with error bit) on invalid directory.
+ * f_access_denied (with error bit) on access denied.
+ * f_loop (with error bit) on loop error.
+ * f_false (with error bit) on unknown/unhandled errors.
+ */
+#ifndef _di_f_file_exists_
+ extern f_return_status f_file_exists(const f_string file_name);
+#endif // _di_f_file_exists_
+
+/**
+ * Check if a file exists at a given directory.
+ *
+ * @param directory_file_descriptor
+ * The file descriptor of the directory.
+ * @param file_name
+ * The file name.
+ * @param flags
+ * Additional flags to pass, such as AT_EACCESS or AT_SYMLINK_NOFOLLOW.
+ *
+ * @return
+ * f_true if file exists.
+ * f_false if file does not exist.
+ * f_invalid_parameter (with error bit) if a parameter is invalid.
+ * f_invalid_name (with error bit) if the filename is too long.
+ * f_out_of_memory (with error bit) if out of memory.
+ * f_overflow (with error bit) on overflow error.
+ * f_invalid_directory (with error bit) on invalid directory.
+ * f_access_denied (with error bit) on access denied.
+ * f_loop (with error bit) on loop error.
+ * f_false (with error bit) on unknown/unhandled errors.
+ */
+#ifndef _di_f_file_exists_at_
+ extern f_return_status f_file_exists_at(const int directory_file_descriptor, const f_string file_name, const int flags);
+#endif // _di_f_file_exists_at_
+
#ifndef _di_f_file_flush_
/**
* flush file.
*/
- extern f_return_status f_file_flush(f_file *file_information);
+ extern f_return_status f_file_flush(f_file *file);
#endif // _di_f_file_flush_
#ifndef _di_f_file_read_
/**
* read a given amount of data from the buffer, will auto-seek to where.
*/
- extern f_return_status f_file_read(f_file *file_information, f_string_dynamic *buffer, const f_file_position location);
+ extern f_return_status f_file_read(f_file *file, f_string_dynamic *buffer, const f_file_position location);
#endif // _di_f_file_read_
#ifndef _di_f_file_read_fifo_
/**
* read a given amount of data from the buffer, will not auto seek.
*/
- extern f_return_status f_file_read_fifo(f_file *file_information, f_string_dynamic *buffer);
+ extern f_return_status f_file_read_fifo(f_file *file, f_string_dynamic *buffer);
#endif // _di_f_file_read_fifo_
#ifndef _di_f_file_stat_
/**
* read file statistics.
*/
- extern f_return_status f_file_stat(const f_string file, struct stat *file_stat);
+ extern f_return_status f_file_stat(const f_string file_name, struct stat *file_stat);
#endif // _di_f_file_stat_
#ifndef _di_f_file_stat_by_id_
#ifndef _di_f_status_invalid_
f_invalid,
+ f_invalid_name,
f_invalid_parameter,
f_invalid_syntax,
f_invalid_data,
f_invalid_file,
f_invalid_directory,
+ f_invalid_descriptor,
f_invalid_socket,
f_invalid_device,
f_invalid_link,
}
// now print the trailing newline, this is done _after_ ending the colors to avoid color wrapping issues that can happen when a color code follows a newline
- fprintf(file, "\n");
+ fprintf(file, "%c", f_string_eol);
return f_none;
}
if (position.total_elements < 0) return f_status_set_error(f_invalid_parameter);
#endif // _di_level_1_parameter_checking_
- if (file.file == 0) return f_status_set_warning(f_file_not_open);
+ if (file.address == 0) return f_status_set_warning(f_file_not_open);
f_status status = f_none;
f_string_length size = 0;
if (buffer == 0) return f_status_set_error(f_invalid_parameter);
#endif // _di_level_1_parameter_checking_
- if (file.file == 0) return f_status_set_warning(f_file_not_open);
+ if (file.address == 0) return f_status_set_warning(f_file_not_open);
f_status status = f_none;
f_string_length size = 0;
#ifndef _di_fl_file_write_
f_return_status fl_file_write(f_file file, const f_string_dynamic buffer) {
- if (file.file == 0) return f_status_set_error(f_file_not_open);
+ if (file.address == 0) return f_status_set_error(f_file_not_open);
f_status status = f_none;
size_t size = 0;
- size = fwrite(buffer.string, file.byte_size, buffer.used, file.file);
+ size = fwrite(buffer.string, file.byte_size, buffer.used, file.address);
if (size < buffer.used * file.byte_size) {
return f_status_set_error(f_file_write_error);
if (position.start < position.stop) return f_status_set_error(f_invalid_parameter);
#endif // _di_level_1_parameter_checking_
- if (file.file == 0) return f_file_not_open;
+ if (file.address == 0) return f_file_not_open;
f_status status = f_none;
size_t size = 0;
f_string_length total = buffer.used - (position.stop - position.start + 1);
- size = fwrite(buffer.string + position.start, file.byte_size, total, file.file);
+ size = fwrite(buffer.string + position.start, file.byte_size, total, file.address);
if (size < total * file.byte_size) {
return f_status_set_error(f_file_write_error);
#endif // _di_fl_fss_identify_
#ifndef _di_fl_fss_identify_file_
- f_return_status fl_fss_identify_file(f_file *file_information, f_fss_header *header) {
+ f_return_status fl_fss_identify_file(f_file *file, f_fss_header *header) {
#ifndef _di_level_1_parameter_checking_
- if (file_information == 0) return f_status_set_error(f_invalid_parameter);
+ if (file == 0) return f_status_set_error(f_invalid_parameter);
if (header == 0) return f_status_set_error(f_invalid_parameter);
- if (file_information->file == 0) return f_status_set_error(f_file_not_open);
- if (ferror(file_information->file) != 0) return f_status_set_error(f_file_error);
+ if (file->address == 0) return f_status_set_error(f_file_not_open);
+ if (ferror(file->address) != 0) return f_status_set_error(f_file_error);
#endif // _di_level_1_parameter_checking_
- clearerr(file_information->file);
+ clearerr(file->address);
f_status status = f_none;
f_string_dynamic buffer = f_string_dynamic_initialize;
// make sure we are in the proper location in the file
{
- f_s_int seek_result = f_file_seek_from_beginning(file_information->file, 0);
+ f_s_int seek_result = f_file_seek_from_beginning(file->address, 0);
if (seek_result != 0) return f_status_set_error(f_file_seek_error);
}
}
// 2: buffer the file
- status = f_file_read(file_information, &buffer, location);
+ status = f_file_read(file, &buffer, location);
if (f_status_is_error(status)) {
return status;
/**
* Identify FSS type from a file.
*
- * @param file_information
+ * @param file
* The file information.
* @param header
* The header data to populate with results of this function.
* @see fl_fss_identify()
*/
#ifndef _di_fl_fss_identify_file_
- extern f_return_status fl_fss_identify_file(f_file *file_information, f_fss_header *header);
+ extern f_return_status fl_fss_identify_file(f_file *file, f_fss_header *header);
#endif // _di_fl_fss_identify_file_
/**
case f_invalid:
*string = fl_status_string_invalid;
break;
+ case f_invalid_name:
+ *string = fl_status_string_invalid_name;
+ break;
case f_invalid_parameter:
*string = fl_status_string_invalid_parameter;
break;
case f_invalid_directory:
*string = fl_status_string_invalid_directory;
break;
+ case f_invalid_descriptor:
+ *string = fl_status_string_invalid_descriptor;
+ break;
case f_invalid_socket:
*string = fl_status_string_invalid_socket;
break;
#define fl_status_string_invalid "f_invalid"
#define fl_status_string_invalid_length 10
+ #define fl_status_string_invalid_name "f_invalid_name"
+ #define fl_status_string_invalid_name_length 15
+
#define fl_status_string_invalid_parameter "f_invalid_parameter"
#define fl_status_string_invalid_parameter_length 20
#define fl_status_string_invalid_directory "f_invalid_directory"
#define fl_status_string_invalid_directory_length 20
+ #define fl_status_string_invalid_descriptor "f_invalid_descriptor"
+ #define fl_status_string_invalid_descriptor_length 21
+
#define fl_status_string_invalid_socket "f_invalid_socket"
#define fl_status_string_invalid_socket_length 17
return f_none;
}
+ if (fl_string_compare(string, fl_status_string_invalid_name, length, fl_status_string_invalid_name_length) == f_equal_to) {
+ *code = f_invalid_name;
+ return f_none;
+ }
+
if (fl_string_compare(string, fl_status_string_invalid_parameter, length, fl_status_string_invalid_parameter_length) == f_equal_to) {
*code = f_invalid_parameter;
return f_none;
return f_none;
}
+ if (fl_string_compare(string, fl_status_string_invalid_descriptor, length, fl_status_string_invalid_descriptor_length) == f_equal_to) {
+ *code = f_invalid_descriptor;
+ return f_none;
+ }
+
if (fl_string_compare(string, fl_status_string_invalid_socket, length, fl_status_string_invalid_socket_length) == f_equal_to) {
*code = f_invalid_socket;
return f_none;
}
else {
if (file_position.total_elements == 0) {
- fseek(file.file, 0, SEEK_END);
- file_position.total_elements = ftell(file.file);
- fseek(file.file, 0, SEEK_SET);
+ fseek(file.address, 0, SEEK_END);
+ file_position.total_elements = ftell(file.address);
+ fseek(file.address, 0, SEEK_SET);
}
status = fl_file_read(file, file_position, &local_buffer);
if (data->process_pipe) {
f_file file = f_file_initialize;
- file.file = f_pipe;
+ file.address = f_pipe;
status = fl_file_read_fifo(file, &data->buffer);
}
if (data->file_position.total_elements == 0) {
- fseek(file.file, 0, SEEK_END);
+ fseek(file.address, 0, SEEK_END);
- data->file_position.total_elements = ftell(file.file);
+ data->file_position.total_elements = ftell(file.address);
// skip past empty files
if (data->file_position.total_elements == 0) {
continue;
}
- fseek(file.file, 0, SEEK_SET);
+ fseek(file.address, 0, SEEK_SET);
}
status = fl_file_read(file, data->file_position, &data->buffer);
f_file file = f_file_initialize;
f_string_dynamic input = f_string_dynamic_initialize;
- file.file = f_pipe;
+ file.address = f_pipe;
status = fl_file_read_fifo(file, &input);
if (data->process_pipe) {
f_file file = f_file_initialize;
- file.file = f_pipe;
+ file.address = f_pipe;
status = fl_file_read_fifo(file, &data->buffer);
}
if (data->file_position.total_elements == 0) {
- fseek(file.file, 0, SEEK_END);
+ fseek(file.address, 0, SEEK_END);
- data->file_position.total_elements = ftell(file.file);
+ data->file_position.total_elements = ftell(file.address);
// skip past empty files
if (data->file_position.total_elements == 0) {
continue;
}
- fseek(file.file, 0, SEEK_SET);
+ fseek(file.address, 0, SEEK_SET);
}
status = fl_file_read(file, data->file_position, &data->buffer);
f_file file = f_file_initialize;
f_string_dynamic input = f_string_dynamic_initialize;
- file.file = f_pipe;
+ file.address = f_pipe;
status = fl_file_read_fifo(file, &input);
if (data->process_pipe) {
f_file file = f_file_initialize;
- file.file = f_pipe;
+ file.address = f_pipe;
status = fl_file_read_fifo(file, &data->buffer);
}
if (data->file_position.total_elements == 0) {
- fseek(file.file, 0, SEEK_END);
+ fseek(file.address, 0, SEEK_END);
- data->file_position.total_elements = ftell(file.file);
+ data->file_position.total_elements = ftell(file.address);
// skip past empty files
if (data->file_position.total_elements == 0) {
continue;
}
- fseek(file.file, 0, SEEK_SET);
+ fseek(file.address, 0, SEEK_SET);
}
status = fl_file_read(file, data->file_position, &data->buffer);
f_file file = f_file_initialize;
f_string_dynamic input = f_string_dynamic_initialize;
- file.file = f_pipe;
+ file.address = f_pipe;
status = fl_file_read_fifo(file, &input);
f_macro_string_dynamic_delete(status, rule.directory); \
} \
if (status == f_none) { \
- f_macro_string_dynamic_delete(status, rule.file); \
+ f_macro_string_dynamic_delete(status, rule.address); \
} \
if (status == f_none) { \
rule.require = 0; \
f_macro_string_dynamic_destroy(status, rule.directory); \
} \
if (status == f_none) { \
- f_macro_string_dynamic_destroy(status, rule.file); \
+ f_macro_string_dynamic_destroy(status, rule.address); \
} \
if (status == f_none) { \
rule.require = 0; \