coan 4.2.4
|
![]() |
Modules | |
Macro-generated code | |
Files | |
file | io.c |
Functions | |
static bool | readon (void) |
static void | make_tempfile (void) |
static void | replace_infile (void) |
static void | make_backup_name (const char *filename) |
static void | backup_infile (void) |
static void | delete_infile (void) |
static void | open_output (void) |
static void backup_infile | ( | void | ) | [static] |
Backup the current input source file when the backup
option is in force. The current source file is renamed with a generated backup filename.
Definition at line 317 of file io.c.
References bail(), GET_PUBLIC, GET_STATE, GRIPE_CANT_RENAME_FILE, and make_backup_name().
Referenced by close_io().
static void delete_infile | ( | void | ) | [static] |
Delete the current input source file, preparatory to replacing it with the corresponding output file.
Definition at line 100 of file io.c.
References bail(), GET_PUBLIC, and GRIPE_CANT_DELETE_FILE.
Referenced by close_io().
static void make_backup_name | ( | const char * | filename | ) | [static] |
Generate a backup name for the current input source file, when the --replace
and --backup
options are in force.
The backup filename is committed to static storage.
filename | The name of the source file to be backed up. |
Definition at line 289 of file io.c.
References bail(), GET_PUBLIC, GET_STATE, GRIPE_FILENAME_TOO_LONG, SET_STATE, and zallocate().
Referenced by backup_infile().
static void make_tempfile | ( | void | ) | [static] |
Generate a temporary file for output, when the --replace
option is in force.
The temporary file is created in the same location as the input source file for ready identification in the event of a crash.
Definition at line 253 of file io.c.
References bail(), fs_tempname(), GET_PUBLIC, GET_STATE, GRIPE_NO_TEMPFILE, PATH_DELIM, SET_STATE, and zallocate().
Referenced by open_output().
static void open_output | ( | void | ) | [static] |
Open an output stream for the current input file. The output stream is stdout
unless input source files are to be replaced with output. Otherwise the output stream is opened on a temporary output file.
Definition at line 331 of file io.c.
References GET_PUBLIC, GET_STATE, make_tempfile(), open_file(), and SET_PUBLIC.
Referenced by open_io().
static bool readon | ( | void | ) | [static] |
Read a source line from the current input stream into the line buffer.
Definition at line 204 of file io.c.
References bail(), GET_PUBLIC, GET_STATE, GRIPE_CANT_READ_INPUT, LINE_END, line_len(), reallocate(), SET_PUBLIC, and SET_STATE.
Referenced by extend_line().
static void replace_infile | ( | void | ) | [static] |
Replace the current input source file with the temporary output file, when the --replace
option is in force.
The input source file has either been deleted or renamed to a backup when this function is called, depending on whether the --backup
option is in force.
Definition at line 277 of file io.c.
References bail(), GET_PUBLIC, GET_STATE, and GRIPE_CANT_RENAME_FILE.
Referenced by close_io().