#include "fixlib.h"#include <sys/stat.h>#include <sys/wait.h>#include "server.h"#include "fixincl.x"

Go to the source code of this file.
Defines | |
| #define | VLEVEL(l) ((unsigned int) verbose_level >= (unsigned int) l) |
| #define | NOT_SILENT VLEVEL(VERB_FIXES) |
| #define | S_IRALL 0644 |
| #define | S_DIRALL 0755 |
Enumerations | |
| enum | te_verbose { VERB_SILENT = 0, VERB_FIXES, VERB_APPLIES, VERB_PROGRESS, VERB_TESTS, VERB_EVERYTHING, VERB_SILENT = 0, VERB_FIXES, VERB_APPLIES, VERB_PROGRESS, VERB_TESTS, VERB_EVERYTHING, VERB_SILENT = 0, VERB_FIXES, VERB_APPLIES, VERB_PROGRESS, VERB_TESTS, VERB_EVERYTHING } |
Functions/Subroutines | |
| static void | do_version (void) |
| void | initialize (int argc, char **argv) |
| char * | load_file (const char *fname) |
| static int | machine_matches (tFixDesc *p_fixd) |
| void | run_compiles (void) |
| static FILE * | create_file (void) |
| static int | test_test (tTestDesc *p_test, char *pz_test_file) |
| static int | egrep_test (char *pz_data, tTestDesc *p_test) |
| static int | quoted_file_exists (const char *pz_src_path, const char *pz_file_path, const char *pz_file) |
| static void | extract_quoted_files (char *pz_data, const char *pz_fixed_file, regmatch_t *p_re_match) |
| static int | internal_fix (int read_fd, tFixDesc *p_fixd) |
| static int | start_fixer (int read_fd, tFixDesc *p_fixd, char *pz_fix_file) |
| static t_bool | fix_applies (tFixDesc *p_fixd) |
| static void | write_replacement (tFixDesc *p_fixd) |
| static void | test_for_changes (int read_fd) |
| void | process (void) |
Variables | |
| static const char | program_id [] = "fixincl version 1.1" |
| static const char | z_std_preamble [] |
| int | find_base_len = 0 |
| te_verbose | verbose_level = VERB_PROGRESS |
| int | have_tty = 0 |
| pid_t | process_chain_head = (pid_t) -1 |
| char * | pz_curr_file |
| char * | pz_curr_data |
| char * | pz_temp_file |
| t_bool | curr_data_mapped |
| int | data_map_fd |
| size_t | data_map_size |
| size_t | ttl_data_size = 0 |
| const char | incl_quote_pat [] = "^[ \t]*#[ \t]*include[ \t]*\"[^/]" |
| tSCC | z_fork_err [] = "Error %d (%s) starting filter process for %s\n" |
| regex_t | incl_quote_re |
| #define VLEVEL | ( | l | ) | ((unsigned int) verbose_level >= (unsigned int) l) |
| enum te_verbose |
Definition at line 530 of file fixincl.c.
References ENOENT, errno, exit(), EXIT_FAILURE, fd, fdopen, find_base_len, fprintf(), MAXPATHLEN, mkdir(), NOT_SILENT, NUL, O_CREAT, O_TRUNC, O_WRONLY, open, pz_curr_file, S_DIRALL, S_IFDIR, S_IRALL, sprintf(), strchr, xstrerror(), and z_std_preamble.
| static int egrep_test | ( | char * | pz_data, | |
| tTestDesc * | p_test | |||
| ) | [static] |
Definition at line 652 of file fixincl.c.
References APPLY_FIX, fprintf(), test_desc::p_test_regex, test_desc::pz_test_text, and SKIP_FIX.
| static void extract_quoted_files | ( | char * | pz_data, | |
| const char * | pz_fixed_file, | |||
| regmatch_t * | p_re_match | |||
| ) | [static] |
Definition at line 722 of file fixincl.c.
References fprintf(), printf(), putc(), quoted_file_exists(), regmatch_t::rm_so, strrchr(), VERB_APPLIES, and VLEVEL.
Definition at line 1083 of file fixincl.c.
References APPLY_FIX, BOOL_FALSE, BOOL_TRUE, egrep_test(), fix_desc::fd_flags, FD_SHELL_SCRIPT, FD_SKIP_TEST, fix_desc::file_list, fix_desc::fix_name, fprintf(), fix_desc::p_test_desc, pz_curr_data, pz_curr_file, test_desc::pz_test_text, run_test(), strlen(), strstr(), fix_desc::test_ct, test_test(), TT_EGREP, TT_FUNCTION, TT_NEGREP, TT_TEST, test_desc::type, VERB_EVERYTHING, and VLEVEL.
| void initialize | ( | int | argc, | |
| char ** | argv | |||
| ) |
Definition at line 211 of file fixincl.c.
References atoi(), do_version(), errno, exit(), EXIT_FAILURE, find_base_len, fprintf(), fputs(), freopen, initialize_opts(), ISDIGIT, NUL, pz_temp_file, run_compiles(), SIGALRM, SIGIOT, signal(), SIGPIPE, SIGQUIT, strcmp(), strlen(), tempnam, VERB_APPLIES, VERB_EVERYTHING, VERB_FIXES, VERB_PROGRESS, VERB_SILENT, VERB_TESTS, verbose_level, xmalloc_set_program_name(), and xstrerror().
| static int internal_fix | ( | int | read_fd, | |
| tFixDesc * | p_fixd | |||
| ) | [static] |
Definition at line 782 of file fixincl.c.
References apply_fix(), close, dup2(), errno, exit(), EXIT_FAILURE, fd, fix_desc::fix_name, fork, fprintf(), pipe(), pz_curr_file, sleep(), STDIN_FILENO, STDOUT_FILENO, UNLOAD_DATA, xstrerror(), and z_fork_err.
| char* load_file | ( | const char * | fname | ) |
Definition at line 307 of file fixincl.c.
References BOOL_FALSE, BOOL_TRUE, curr_data_mapped, data_map_fd, data_map_size, errno, fclose(), fdopen, fp, fprintf(), getpagesize, load_file_data(), mmap(), NOT_SILENT, O_RDONLY, open, stat::st_size, ttl_data_size, and xstrerror().
| static int machine_matches | ( | tFixDesc * | p_fixd | ) | [static] |
Definition at line 361 of file fixincl.c.
References BOOL_FALSE, BOOL_TRUE, fix_desc::fd_flags, FD_MACH_IFNOT, FD_SKIP_TEST, free(), fix_desc::papz_machs, run_shell(), skip, sprintf(), strlen(), strstr(), tCC, and tSCC.
Definition at line 1295 of file fixincl.c.
References access, close, data_map_size, ENOENT, errno, exit(), EXIT_FAILURE, fix_desc::fd_flags, FD_REPLACEMENT, fflush(), fix_applies(), fix_desc::fix_name, fprintf(), getcwd, have_tty, load_file(), MAXPATHLEN, NOPROCESS, O_RDONLY, open, process_chain_head, pz_curr_data, pz_curr_file, R_OK, start_fixer(), test_for_changes(), unlink, UNLOAD_DATA, VERB_APPLIES, VERB_PROGRESS, VLEVEL, wait(), write_replacement(), and xstrerror().
| static int quoted_file_exists | ( | const char * | pz_src_path, | |
| const char * | pz_file_path, | |||
| const char * | pz_file | |||
| ) | [static] |
Definition at line 672 of file fixincl.c.
References ISGRAPH, MAXPATHLEN, S_ISREG, sprintf(), stat::st_mode, strlen(), and is::z.
Definition at line 453 of file fixincl.c.
References compile_re(), fix_desc::fix_name, incl_quote_pat, machine_matches(), memset, fix_desc::p_test_desc, test_desc::p_test_regex, fix_desc::papz_machs, test_desc::pz_test_text, fix_desc::test_ct, TT_EGREP, TT_NEGREP, test_desc::type, and XCNEWVEC.
| static int start_fixer | ( | int | read_fd, | |
| tFixDesc * | p_fixd, | |||
| char * | pz_fix_file | |||
| ) | [static] |
Definition at line 1010 of file fixincl.c.
References chain_open(), errno, exit(), EXIT_FAILURE, fd, fix_desc::fd_flags, FD_SHELL_SCRIPT, FD_SUBROUTINE, fix_desc::fix_name, fprintf(), free(), internal_fix(), fix_desc::patch_args, process_chain_head, sleep(), sprintf(), strlen(), tCC, tSCC, XNEWVEC, xstrerror(), and z_fork_err.
| static void test_for_changes | ( | int | read_fd | ) | [static] |
Definition at line 1224 of file fixincl.c.
References close, create_file(), EOF, extract_quoted_files(), fclose(), fdopen, fwrite, getc(), putc(), pz_curr_data, and pz_curr_file.
| static int test_test | ( | tTestDesc * | p_test, | |
| char * | pz_test_file | |||
| ) | [static] |
Definition at line 598 of file fixincl.c.
References APPLY_FIX, fprintf(), free(), test_desc::pz_test_text, run_shell(), SKIP_FIX, sprintf(), and tSCC.
Definition at line 1196 of file fixincl.c.
References create_file(), fclose(), fputc(), fwrite, NUL, fix_desc::patch_args, strlen(), and sz().
| int data_map_fd |
| int find_base_len = 0 |
| const char incl_quote_pat[] = "^[ \t]*#[ \t]*include[ \t]*\"[^/]" |
| pid_t process_chain_head = (pid_t) -1 |
const char program_id[] = "fixincl version 1.1" [static] |
| char* pz_curr_data |
| char* pz_curr_file |
| char* pz_temp_file |
| size_t ttl_data_size = 0 |
| te_verbose verbose_level = VERB_PROGRESS |
| tSCC z_fork_err[] = "Error %d (%s) starting filter process for %s\n" |
const char z_std_preamble[] [static] |
1.5.6