PostgreSQL Source Code git master
|
#include "postgres.h"
#include <ctype.h>
#include <sys/stat.h>
#include <pwd.h>
#include <unistd.h>
#include "pg_config_paths.h"
Go to the source code of this file.
Macros | |
#define | IS_PATH_VAR_SEP(ch) ((ch) == ':') |
#define | skip_drive(path) (path) |
Enumerations | |
enum | canonicalize_state { ABSOLUTE_PATH_INIT , ABSOLUTE_WITH_N_DEPTH , RELATIVE_PATH_INIT , RELATIVE_WITH_N_DEPTH , RELATIVE_WITH_PARENT_REF } |
Functions | |
static void | make_relative_path (char *ret_path, const char *target_path, const char *bin_path, const char *my_exec_path) |
static char * | trim_directory (char *path) |
static void | trim_trailing_separator (char *path) |
static char * | append_subdir_to_path (char *path, char *subdir) |
bool | has_drive_prefix (const char *path) |
char * | first_dir_separator (const char *filename) |
char * | first_path_var_separator (const char *pathlist) |
char * | last_dir_separator (const char *filename) |
void | make_native_path (char *filename) |
void | cleanup_path (char *path) |
void | join_path_components (char *ret_path, const char *head, const char *tail) |
void | canonicalize_path (char *path) |
bool | path_contains_parent_reference (const char *path) |
bool | path_is_relative_and_below_cwd (const char *path) |
bool | path_is_prefix_of_path (const char *path1, const char *path2) |
const char * | get_progname (const char *argv0) |
static int | dir_strcmp (const char *s1, const char *s2) |
char * | make_absolute_path (const char *path) |
void | get_share_path (const char *my_exec_path, char *ret_path) |
void | get_etc_path (const char *my_exec_path, char *ret_path) |
void | get_include_path (const char *my_exec_path, char *ret_path) |
void | get_pkginclude_path (const char *my_exec_path, char *ret_path) |
void | get_includeserver_path (const char *my_exec_path, char *ret_path) |
void | get_lib_path (const char *my_exec_path, char *ret_path) |
void | get_pkglib_path (const char *my_exec_path, char *ret_path) |
void | get_locale_path (const char *my_exec_path, char *ret_path) |
void | get_doc_path (const char *my_exec_path, char *ret_path) |
void | get_html_path (const char *my_exec_path, char *ret_path) |
void | get_man_path (const char *my_exec_path, char *ret_path) |
bool | get_home_path (char *ret_path) |
void | get_parent_directory (char *path) |
enum canonicalize_state |
Enumerator | |
---|---|
ABSOLUTE_PATH_INIT | |
ABSOLUTE_WITH_N_DEPTH | |
RELATIVE_PATH_INIT | |
RELATIVE_WITH_N_DEPTH | |
RELATIVE_WITH_PARENT_REF |
Definition at line 243 of file path.c.
|
static |
Definition at line 1062 of file path.c.
References len.
Referenced by canonicalize_path().
void canonicalize_path | ( | char * | path | ) |
Definition at line 265 of file path.c.
References ABSOLUTE_PATH_INIT, ABSOLUTE_WITH_N_DEPTH, append_subdir_to_path(), Assert, RELATIVE_PATH_INIT, RELATIVE_WITH_N_DEPTH, RELATIVE_WITH_PARENT_REF, skip_drive, trim_directory(), and trim_trailing_separator().
Referenced by AbsoluteConfigLocation(), add_tablespace_mapping(), adjust_data_dir(), check_canonical_path(), check_required_directory(), convert_and_check_filename(), create_script_for_old_cluster_deletion(), create_xlog_or_symlink(), CreateTableSpace(), do_copy(), exec_command_edit(), exec_command_write(), find_in_dynamic_libpath(), find_my_exec(), find_other_exec(), get_tablespace_mapping(), GetConfFilesInDir(), main(), make_absolute_path(), make_relative_path(), member_verify_header(), normalize_exec_path(), parseCommandLine(), process_file(), scan_for_existing_tablespaces(), setup(), setup_bin_paths(), setup_pgdata(), SplitDirectoriesString(), tablespace_list_append(), and test_canonicalize_path().
void cleanup_path | ( | char * | path | ) |
Definition at line 187 of file path.c.
References MAXPGPATH.
Referenced by get_configdata().
|
static |
Definition at line 613 of file path.c.
References IS_DIR_SEP, pg_tolower(), s1, and s2.
Referenced by make_relative_path().
char * first_dir_separator | ( | const char * | filename | ) |
Definition at line 105 of file path.c.
References filename, IS_DIR_SEP, skip_drive, and unconstify.
Referenced by check_restricted_library_name(), check_valid_extension_name(), check_valid_version_name(), expand_dynamic_library_name(), find_in_dynamic_libpath(), find_my_exec(), load_libraries(), and substitute_libpath_macro().
char * first_path_var_separator | ( | const char * | pathlist | ) |
Definition at line 122 of file path.c.
References IS_PATH_VAR_SEP, and unconstify.
Referenced by find_in_dynamic_libpath(), and find_my_exec().
void get_doc_path | ( | const char * | my_exec_path, |
char * | ret_path | ||
) |
Definition at line 897 of file path.c.
References make_relative_path(), and my_exec_path.
Referenced by get_configdata().
void get_etc_path | ( | const char * | my_exec_path, |
char * | ret_path | ||
) |
Definition at line 834 of file path.c.
References make_relative_path(), and my_exec_path.
Referenced by get_configdata(), process_psqlrc(), and set_pglocale_pgservice().
bool get_home_path | ( | char * | ret_path | ) |
Definition at line 928 of file path.c.
References buf, MAXPGPATH, snprintf, and strlcpy().
Referenced by expand_tilde(), initializeInput(), and process_psqlrc().
void get_html_path | ( | const char * | my_exec_path, |
char * | ret_path | ||
) |
Definition at line 906 of file path.c.
References make_relative_path(), and my_exec_path.
Referenced by get_configdata().
void get_include_path | ( | const char * | my_exec_path, |
char * | ret_path | ||
) |
Definition at line 843 of file path.c.
References make_relative_path(), and my_exec_path.
Referenced by get_configdata(), and main().
void get_includeserver_path | ( | const char * | my_exec_path, |
char * | ret_path | ||
) |
Definition at line 861 of file path.c.
References make_relative_path(), and my_exec_path.
Referenced by get_configdata().
void get_lib_path | ( | const char * | my_exec_path, |
char * | ret_path | ||
) |
Definition at line 870 of file path.c.
References make_relative_path(), and my_exec_path.
Referenced by get_configdata().
void get_locale_path | ( | const char * | my_exec_path, |
char * | ret_path | ||
) |
Definition at line 888 of file path.c.
References make_relative_path(), and my_exec_path.
Referenced by get_configdata(), pg_bindtextdomain(), and set_pglocale_pgservice().
void get_man_path | ( | const char * | my_exec_path, |
char * | ret_path | ||
) |
Definition at line 915 of file path.c.
References make_relative_path(), and my_exec_path.
Referenced by get_configdata().
void get_parent_directory | ( | char * | path | ) |
Definition at line 991 of file path.c.
References trim_directory().
Referenced by AbsoluteConfigLocation(), dbase_redo(), destroy_tablespace_directories(), fsync_parent_path(), main(), and process_file().
void get_pkginclude_path | ( | const char * | my_exec_path, |
char * | ret_path | ||
) |
Definition at line 852 of file path.c.
References make_relative_path(), and my_exec_path.
Referenced by get_configdata(), and main().
void get_pkglib_path | ( | const char * | my_exec_path, |
char * | ret_path | ||
) |
Definition at line 879 of file path.c.
References make_relative_path(), and my_exec_path.
Referenced by get_configdata(), getInstallationPaths(), and InitStandaloneProcess().
const char * get_progname | ( | const char * | argv0 | ) |
Definition at line 575 of file path.c.
References argv0, EXE, fprintf, last_dir_separator(), pg_strcasecmp(), progname, and skip_drive.
Referenced by get_opts(), handle_help_version_opts(), main(), parseCommandLine(), pg_logging_init(), and regression_main().
void get_share_path | ( | const char * | my_exec_path, |
char * | ret_path | ||
) |
Definition at line 825 of file path.c.
References make_relative_path(), and my_exec_path.
Referenced by get_configdata(), get_extension_control_directory(), get_extension_control_filename(), get_extension_script_directory(), get_tsearch_config_filename(), ParseTzFile(), pg_TZDIR(), and setup_bin_paths().
bool has_drive_prefix | ( | const char * | path | ) |
void join_path_components | ( | char * | ret_path, |
const char * | head, | ||
const char * | tail | ||
) |
Definition at line 220 of file path.c.
References MAXPGPATH, skip_drive, snprintf, and strlcpy().
Referenced by AbsoluteConfigLocation(), find_my_exec(), GetConfFilesInDir(), main(), make_relative_path(), and process_file().
char * last_dir_separator | ( | const char * | filename | ) |
Definition at line 140 of file path.c.
References filename, IS_DIR_SEP, skip_drive, and unconstify.
Referenced by check_file_excluded(), ECPGconnect(), find_other_exec(), get_progname(), main(), sendDir(), setup(), setup_bin_paths(), and should_allow_existing_directory().
char * make_absolute_path | ( | const char * | path | ) |
Definition at line 730 of file path.c.
References _, buf, canonicalize_path(), elog, ereport, errcode(), errmsg(), ERROR, fprintf, free, is_absolute_path, malloc, MAXPGPATH, and sprintf.
Referenced by regression_main(), SelectConfigFiles(), and SetDataDir().
void make_native_path | ( | char * | filename | ) |
Definition at line 168 of file path.c.
References filename.
Referenced by BuildRestoreCommand(), main(), and shell_archive_file().
|
static |
Definition at line 661 of file path.c.
References bin_path, canonicalize_path(), dir_strcmp(), i, IS_DIR_SEP, join_path_components(), MAXPGPATH, my_exec_path, strlcpy(), trim_directory(), and trim_trailing_separator().
Referenced by get_doc_path(), get_etc_path(), get_html_path(), get_include_path(), get_includeserver_path(), get_lib_path(), get_locale_path(), get_man_path(), get_pkginclude_path(), get_pkglib_path(), and get_share_path().
bool path_contains_parent_reference | ( | const char * | path | ) |
Definition at line 500 of file path.c.
References skip_drive.
Referenced by path_is_relative_and_below_cwd().
bool path_is_prefix_of_path | ( | const char * | path1, |
const char * | path2 | ||
) |
Definition at line 560 of file path.c.
References IS_DIR_SEP.
Referenced by convert_and_check_filename(), create_script_for_old_cluster_deletion(), CreateTableSpace(), and parseCommandLine().
bool path_is_relative_and_below_cwd | ( | const char * | path | ) |
Definition at line 527 of file path.c.
References is_absolute_path, IS_DIR_SEP, and path_contains_parent_reference().
Referenced by convert_and_check_filename().
|
static |
Definition at line 1008 of file path.c.
References IS_DIR_SEP, and skip_drive.
Referenced by canonicalize_path(), get_parent_directory(), and make_relative_path().
|
static |
Definition at line 1040 of file path.c.
References IS_DIR_SEP, and skip_drive.
Referenced by canonicalize_path(), and make_relative_path().