#include "fixlib.h"#include <signal.h>#include "server.h"#include "fixincl.x"

Go to the source code of this file.
Defines | |
| #define | _ENV_(v, m, n, t) tCC* v = NULL; |
| #define | VLEVEL(l) ((unsigned int) verbose_level >= (unsigned int) l) |
| #define | NOT_SILENT VLEVEL(VERB_FIXES) |
| #define | _ENV_(v, m, n, t) |
| #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 | PARAMS ((void)) |
| static void | do_version () |
| void | initialize (int argc, char **argv) |
| char * | load_file (char *fname) const |
| static int machine_matches | PARAMS ((tFixDesc *)) |
| static int | machine_matches (tFixDesc *p_fixd) |
| void | run_compiles () |
| static FILE * | create_file () |
| static int test_test | PARAMS ((tTestDesc *, char *)) |
| static int | test_test (tTestDesc *p_test, char *pz_test_file) |
| static int egrep_test | PARAMS ((char *, tTestDesc *)) |
| static int | egrep_test (char *pz_data, tTestDesc *p_test) |
| static int quoted_file_exists | PARAMS ((const char *, const char *, const char *)) |
| static int | quoted_file_exists (char *pz_src_path, const char *pz_file_path, const char *pz_file) const |
| static void extract_quoted_files | PARAMS ((char *, const char *, regmatch_t *)) |
| static void | extract_quoted_files (char *pz_data, const char *pz_fixed_file, regmatch_t *p_re_match) |
| static int internal_fix | PARAMS ((int, tFixDesc *)) |
| static int | internal_fix (int read_fd, tFixDesc *p_fixd) |
| static int start_fixer | PARAMS ((int, tFixDesc *, char *)) |
| 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 | PARAMS ((int)) |
| static void | test_for_changes (int read_fd) |
| void | process () |
Variables | |
| static const char | program_id [] = "fixincl version 1.1" |
| static const char | z_std_preamble [] |
| ENV_TABLE 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 _ENV_ | ( | v, | |||
| m, | |||||
| n, | |||||
| t | ) |
| #define NOT_SILENT VLEVEL(VERB_FIXES) |
| #define S_DIRALL 0755 |
| #define S_IRALL 0644 |
| #define VLEVEL | ( | l | ) | ((unsigned int) verbose_level >= (unsigned int) l) |
Definition at line 73 of file fixincl.c.
Referenced by extract_quoted_files(), fix_applies(), and process().
| enum te_verbose |
Definition at line 563 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.
Definition at line 195 of file fixincl.c.
References exit(), program_id, puts(), run_compiles(), run_shell(), sprintf(), strcmp(), and system().
Referenced by initialize().
| static int egrep_test | ( | char * | pz_data, | |
| tTestDesc * | p_test | |||
| ) | [static] |
Definition at line 684 of file fixincl.c.
References APPLY_FIX, fprintf(), test_desc::p_test_regex, test_desc::pz_test_text, regexec, and SKIP_FIX.
Referenced by fix_applies().
| static void extract_quoted_files | ( | char * | pz_data, | |
| const char * | pz_fixed_file, | |||
| regmatch_t * | p_re_match | |||
| ) | [static] |
Definition at line 759 of file fixincl.c.
References fprintf(), printf(), putc(), quoted_file_exists(), regexec, regmatch_t::rm_so, strrchr(), VERB_APPLIES, and VLEVEL.
Referenced by test_for_changes().
Definition at line 1117 of file fixincl.c.
References APPLY_FIX, BOOL_FALSE, BOOL_TRUE, egrep_test(), FD_SHELL_SCRIPT, FD_SKIP_TEST, fprintf(), pz_curr_data, pz_curr_file, test_desc::pz_test_text, run_test(), strlen(), strstr(), test_test(), TT_EGREP, TT_FUNCTION, TT_NEGREP, TT_TEST, test_desc::type, VERB_EVERYTHING, and VLEVEL.
Referenced by process().
| void initialize | ( | int | argc, | |
| char** | argv | |||
| ) |
Definition at line 218 of file fixincl.c.
References atoi(), do_version(), ENV_TABLE, errno, exit(), EXIT_FAILURE, find_base_len, fprintf(), fputs(), freopen, 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 821 of file fixincl.c.
References apply_fix(), close, errno, exit(), EXIT_FAILURE, F_DUPFD, fcntl(), fd, fix_desc::fix_name, fork, fprintf(), pipe(), pz_curr_file, sleep(), STDIN_FILENO, STDOUT_FILENO, UNLOAD_DATA, xstrerror(), and z_fork_err.
Referenced by start_fixer().
| char* load_file | ( | char* | fname | ) | const |
Definition at line 335 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().
Referenced by process().
| static int machine_matches | ( | tFixDesc * | p_fixd | ) | [static] |
Definition at line 391 of file fixincl.c.
References BOOL_FALSE, BOOL_TRUE, FD_MACH_IFNOT, FD_SKIP_TEST, free(), run_shell(), skip, sprintf(), strlen(), strstr(), tCC, and tSCC.
Referenced by run_compiles().
| static void test_for_changes PARAMS | ( | (int) | ) | [static] |
| static int start_fixer PARAMS | ( | (int, tFixDesc *, char *) | ) | [static] |
| static int internal_fix PARAMS | ( | (int, tFixDesc *) | ) | [static] |
| static void extract_quoted_files PARAMS | ( | (char *, const char *, regmatch_t *) | ) | [static] |
| static int quoted_file_exists PARAMS | ( | (const char *, const char *, const char *) | ) | [static] |
| static int egrep_test PARAMS | ( | (char *, tTestDesc *) | ) | [static] |
| static int test_test PARAMS | ( | (tTestDesc *, char *) | ) | [static] |
| static int machine_matches PARAMS | ( | (tFixDesc *) | ) | [static] |
Definition at line 1331 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().
Referenced by WGEN_Expand_Expr().
| static int quoted_file_exists | ( | char * | pz_src_path, | |
| const char * | pz_file_path, | |||
| const char * | pz_file | |||
| ) | const [static] |
Definition at line 707 of file fixincl.c.
References ISGRAPH, MAXPATHLEN, S_ISREG, sprintf(), stat::st_mode, strlen(), and is::z.
Referenced by extract_quoted_files().
Definition at line 484 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 xmalloc().
Referenced by do_version(), and initialize().
| static int start_fixer | ( | int | read_fd, | |
| tFixDesc* | p_fixd, | |||
| char* | pz_fix_file | |||
| ) | [static] |
Definition at line 1042 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, xmalloc(), xstrerror(), and z_fork_err.
Referenced by process().
| static void test_for_changes | ( | int | read_fd | ) | [static] |
Definition at line 1259 of file fixincl.c.
References close, create_file(), EOF, extract_quoted_files(), fclose(), fdopen, fwrite, getc(), putc(), pz_curr_data, pz_curr_file, and regexec.
Referenced by process().
| static int test_test | ( | tTestDesc * | p_test, | |
| char* | pz_test_file | |||
| ) | [static] |
Definition at line 628 of file fixincl.c.
References APPLY_FIX, fprintf(), free(), run_shell(), SKIP_FIX, sprintf(), and tSCC.
Referenced by fix_applies().
| int data_map_fd |
| ENV_TABLE 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 |
Definition at line 79 of file fixincl.c.
Referenced by fix_applies(), process(), and test_for_changes().
| char* pz_curr_file |
Definition at line 78 of file fixincl.c.
Referenced by create_file(), fix_applies(), internal_fix(), process(), and test_for_changes().
| 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] |
Initial value:
"/* DO NOT EDIT THIS FILE.\n\n\ It has been auto-edited by fixincludes from:\n\n\ \t\"%s/%s\"\n\n\ This had to be done to correct non-standard usages in the\n\ original, manufacturer supplied header file. */\n\n"
Definition at line 46 of file fixincl.c.
Referenced by create_file().
1.5.6