#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <sys/types.h>#include <sys/stat.h>#include <sys/param.h>#include <errno.h>#include "errors.h"#include "string_utils.h"#include "file_utils.h"

Go to the source code of this file.
Defines | |
| #define | DIR_SEPARATOR '/' |
| #define | DIR_SEPARATOR_STR "/" |
Functions/Subroutines | |
| char * | drop_path (char *s) |
| char * | directory_path (char *s) |
| char * | concat_path (char *d, char *f) |
| boolean | file_exists (char *path) |
| boolean | is_executable (char *path) |
| boolean | is_directory (char *path) |
| boolean | want_directory (char *path) |
| boolean | directory_is_writable (char *path) |
| char * | get_cwd (void) |
| void | file_utils_set_program_name (char *name) |
| static char * | get_executable_dir_from_path (char *name) |
| char * | get_executable_dir (void) |
| void | dump_file_to_stdout (char *filename) |
Variables | |
| int | errno |
| static char * | saved_orig_program_name |
| #define DIR_SEPARATOR '/' |
Definition at line 56 of file file_utils.c.
| #define DIR_SEPARATOR_STR "/" |
Definition at line 57 of file file_utils.c.
Referenced by concat_path(), get_executable_dir(), get_executable_dir_from_path(), and is_directory().
| char* concat_path | ( | char * | d, | |
| char * | f | |||
| ) |
Definition at line 107 of file file_utils.c.
References concat_strings(), DIR_SEPARATOR_STR, malloc, NULL, path, strcat(), strcmp(), strcpy, and strlen().
| boolean directory_is_writable | ( | char * | path | ) |
| char* directory_path | ( | char * | s | ) |
Definition at line 91 of file file_utils.c.
References is_dir_separator, MAXPATHLEN, NULL, path, substring_copy(), and tail.
Referenced by add_file_args(), find_toolroot(), print_relative_path(), print_search_path(), run_ld(), and set_library_paths().
| char* drop_path | ( | char * | s | ) |
Definition at line 72 of file file_utils.c.
References is_dir_separator, NULL, and tail.
Referenced by add_file_args(), add_implied_string(), construct_file_with_extension(), construct_given_name(), construct_name(), get_object_file(), if(), init_crt_paths(), init_given_crt_path(), init_stdc_plus_plus_path(), main(), Process_fbuse(), run_phase(), run_pixie(), save_cpp_output(), WFE_Set_Line_And_File(), and WGEN_Set_Line_And_File().
| void dump_file_to_stdout | ( | char * | filename | ) |
Definition at line 345 of file file_utils.c.
References buf, f, fclose(), file_exists(), fopen, fread, internal_error(), n, NULL, and write.
| boolean file_exists | ( | char * | path | ) |
Definition at line 126 of file file_utils.c.
Referenced by add_libgcc_s(), cgt_fini(), check_existence_of_phases(), check_output_name(), dump_file_to_stdout(), find_crt_path(), find_obj_path(), for(), get_command_line(), ipa_compile_init(), is_directory(), main(), print_magic_path(), read_repo_files(), and run_ld().
| void file_utils_set_program_name | ( | char * | name | ) |
Definition at line 232 of file file_utils.c.
References saved_orig_program_name.
Referenced by main().
| char* get_cwd | ( | void | ) |
Definition at line 219 of file file_utils.c.
References cwd, getcwd, getenv(), MAXPATHLEN, NULL, and string_copy().
Referenced by write_command_string_into_file().
| char* get_executable_dir | ( | void | ) |
Definition at line 300 of file file_utils.c.
References DIR_SEPARATOR_STR, get_executable_dir_from_path(), i, is_dir_separator, is_directory(), MAXPATHLEN, NULL, p, readlink(), saved_orig_program_name, strcpy, string_copy(), strlen(), and strncpy().
Referenced by add_file_args(), append_default_options(), get_binutils_lib_path(), print_relative_path(), print_search_path(), run_ld(), and set_library_paths().
| static char* get_executable_dir_from_path | ( | char * | name | ) | [static] |
Definition at line 239 of file file_utils.c.
References dir, DIR_SEPARATOR_STR, filename, get_suffix(), getenv(), is_dir_separator, is_directory(), is_executable(), MAXPATHLEN, NIL, NULL, p, path, snprintf(), strcat(), strcmp(), string_copy(), strtok(), and tmp.
Referenced by get_executable_dir().
| boolean is_directory | ( | char * | path | ) |
Definition at line 156 of file file_utils.c.
References buf, DIR_SEPARATOR_STR, FALSE, file_exists(), Func_Entry, Func_Exit, NIL, S_IFDIR, stat::st_mode, strcat(), strcpy, TRACE, and TRUE.
Referenced by add_inc_path(), add_to_obstack(), build_search_list(), change_phase_path(), do_spec_path(), find_files_in_directory(), get_executable_dir(), get_executable_dir_from_path(), init_temp_files(), process_command(), set_system_module_path(), spec_path(), substitute_phase_dirs(), and want_directory().
| boolean is_executable | ( | char * | path | ) |
Definition at line 138 of file file_utils.c.
References ENOENT, ENOTDIR, errno, FALSE, S_IXGRP, S_IXOTH, S_IXUSR, stat::st_mode, and stat.
Referenced by get_executable_dir_from_path().
| boolean want_directory | ( | char * | path | ) |
Definition at line 170 of file file_utils.c.
References fullwarn, is_directory(), TRUE, and warning.
| int errno |
char* saved_orig_program_name [static] |
Definition at line 61 of file file_utils.c.
Referenced by file_utils_set_program_name(), and get_executable_dir().
1.5.6