/* generate download path ----------------------------------------------------*/ static int gen_path(gtime_t time, gtime_t time_p, int seqnos, int seqnoe, const url_t *url, const char *sta, const char *dir, paths_t *paths) { char remot[1024],remot_p[1024],dir_t[1024]; int i; if (!*dir) dir=url->dir; if (!*dir) dir="."; if (strstr(url->path,"%N")) { for (i=seqnos;i<=seqnoe;i++) { genpath(url->path,sta,time,i,remot); genpath(dir ,sta,time,i,dir_t); if (time_p.time) { genpath(url->path,sta,time_p,i,remot_p); if (!strcmp(remot_p,remot)) continue; } if (!add_path(paths,remot,dir_t)) return 0; } } else { genpath(url->path,sta,time,0,remot); genpath(dir ,sta,time,0,dir_t); if (time_p.time) { genpath(url->path,sta,time_p,0,remot_p); if (!strcmp(remot_p,remot)) return 1; } if (!add_path(paths,remot,dir_t)) return 0; } return 1; }
/* * Generate dependencies for all files. */ int main(int argc, char **argv) { int len; const char *hpath; hpath = getenv("HPATH"); if (!hpath) { fputs("mkdep: HPATH not set in environment. " "Don't bypass the top level Makefile.\n", stderr); return 1; } add_path("."); /* for #include "..." */ while (++argv, --argc > 0) { if (strncmp(*argv, "-I", 2) == 0) { if (*((*argv)+2)) { add_path((*argv)+2); } else { ++argv; --argc; add_path(*argv); } } else if (strcmp(*argv, "--") == 0) { break; } } add_path(hpath); /* must be last entry, for config files */ while (--argc > 0) { const char * filename = *++argv; const char * command = __depname; g_filename = 0; len = strlen(filename); memcpy(depname, filename, len+1); if (len > 2 && filename[len-2] == '.') { if (filename[len-1] == 'c' || filename[len-1] == 'S') { depname[len-1] = 'o'; g_filename = filename; command = ""; } } do_depend(filename, command); } if (len_precious) { *(str_precious+len_precious) = '\0'; printf(".PRECIOUS:%s\n", str_precious); } return 0; }
PluginRegistry::PluginRegistry () : m_impl (new Impl) { visual_log (VISUAL_LOG_DEBUG, "Initializing plugin registry"); // Add the standard plugin paths add_path (VISUAL_PLUGIN_PATH "/actor"); add_path (VISUAL_PLUGIN_PATH "/input"); add_path (VISUAL_PLUGIN_PATH "/morph"); add_path (VISUAL_PLUGIN_PATH "/transform"); #if !defined(VISUAL_OS_WIN32) || defined(VISUAL_WITH_CYGWIN) // Add homedirectory plugin paths char const* home_env = std::getenv ("HOME"); if (home_env) { std::string home_dir (home_env); add_path (home_dir + "/.libvisual/actor"); add_path (home_dir + "/.libvisual/input"); add_path (home_dir + "/.libvisual/morph"); add_path (home_dir + "/.libvisual/transform"); } #endif }
bool package_init(pass_opt_t* opt) { // package_add_paths for command line paths has already been done. Here, we // append the paths from an optional environment variable, and then the paths // that are relative to the compiler location on disk. package_add_paths(getenv("PONYPATH"), opt); if(!add_exec_dir(opt)) { errorf(opt->check.errors, NULL, "Error adding package paths relative to ponyc binary location"); return false; } // Finally we add OS specific paths. #ifdef PLATFORM_IS_POSIX_BASED add_path("/usr/local/lib", opt); add_path("/opt/local/lib", opt); #endif // Convert all the safe packages to their full paths. strlist_t* full_safe = NULL; strlist_t* safe = opt->safe_packages; while(safe != NULL) { const char* path; safe = strlist_pop(safe, &path); // Lookup (and hence normalise) path. path = find_path(NULL, path, NULL, NULL, opt); if(path == NULL) { strlist_free(full_safe); strlist_free(safe); opt->safe_packages = NULL; return false; } full_safe = strlist_push(full_safe, path); } opt->safe_packages = full_safe; if(opt->simple_builtin) package_add_magic_src("builtin", simple_builtin, opt); return true; }
char *path_simplifier(char *path) { int i; int len; t_path *path_list; i = 0; path_list = NULL; while (path[i]) { len = 0; while (path[i] && path[i] == '/') i++; while (path[i + len] && path[i + len] != '/') len++; add_path(&path_list, ft_strsub(path, i, len)); i += len; } remove_dot(&path_list); remove_dotdot(&path_list, path_list); free(path); path = rebuild_path(path_list); free_pathlist(path_list); return (path); }
/* Read ENV_VAR for a PATH_SEPARATOR-separated list of file names; and append all the names to the search path CHAIN. */ static void add_env_var_paths (const char *env_var, int chain) { char *p, *q, *path; GET_ENVIRONMENT (q, env_var); if (!q) return; for (p = q; *q; p = q + 1) { q = p; while (*q != 0 && *q != PATH_SEPARATOR) q++; if (p == q) path = xstrdup ("."); else { path = xmalloc (q - p + 1); memcpy (path, p, q - p); path[q - p] = '\0'; } add_path (path, chain, chain == SYSTEM, false); } }
/* * Determine whether we can simply reuse the file in the worktree. */ static int use_wt_file(const char *workdir, const char *name, struct object_id *oid) { struct strbuf buf = STRBUF_INIT; struct stat st; int use = 0; strbuf_addstr(&buf, workdir); add_path(&buf, buf.len, name); if (!lstat(buf.buf, &st) && !S_ISLNK(st.st_mode)) { struct object_id wt_oid; int fd = open(buf.buf, O_RDONLY); if (fd >= 0 && !index_fd(wt_oid.hash, fd, &st, OBJ_BLOB, name, 0)) { if (is_null_oid(oid)) { oidcpy(oid, &wt_oid); use = 1; } else if (!oidcmp(oid, &wt_oid)) use = 1; } } strbuf_release(&buf); return use; }
/* * GetStreamPaths */ void GetStreamPaths(PlannerInfo *root, RelOptInfo *baserel, Oid relid) { ForeignPath *path; Cost startup_cost; Cost total_cost; double rows; if (!IsContQueryProcess()) { PlannerInfo *parent = root; /* If the root query is continuous, we can read from streams */ while (parent->parent_root != NULL) parent = parent->parent_root; if (!parent->parse->isContinuous) { ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("\"%s\" is a stream", get_rel_name(relid)), errhint("Streams can only be read by a continuous view's FROM clause."))); } } rows = Min(100, continuous_query_batch_size * 0.25); startup_cost = baserel->baserestrictcost.startup; total_cost = startup_cost + (cpu_tuple_cost * rows); path = create_foreignscan_path(root, baserel, rows, startup_cost, total_cost, NIL, NULL, NULL, NIL); add_path(baserel, (Path *) path); }
void poll_monitor::scan(const string &path, poll_monitor_scan_callback fn) { struct stat fd_stat; if (!lstat_path(path, fd_stat)) return; if (follow_symlinks && S_ISLNK(fd_stat.st_mode)) { string link_path; if (read_link_path(path, link_path)) scan(link_path, fn); return; } if (!S_ISDIR(fd_stat.st_mode) && !accept_path(path)) return; if (!add_path(path, fd_stat, fn)) return; if (!recursive) return; if (!S_ISDIR(fd_stat.st_mode)) return; vector<string> children = get_directory_children(path); for (string &child : children) { if (child.compare(".") == 0 || child.compare("..") == 0) continue; scan(path + "/" + child, fn); } }
void Shape2D::add_rect(const Rectf &rect, const Angle &angle, bool reverse) { Path2D path; Pointf point_1(rect.left, rect.top); Pointf point_2(rect.right, rect.top); Pointf point_3(rect.right, rect.bottom); Pointf point_4(rect.left, rect.bottom); if (angle.to_radians() != 0.0f) { Pointf center = rect.get_center(); point_1.rotate(center, angle); point_2.rotate(center, angle); point_3.rotate(center, angle); point_4.rotate(center, angle); } path.add_line_to(point_1); path.add_line_to(point_2); path.add_line_to(point_3); path.add_line_to(point_4); if (reverse) path.reverse(); add_path(path); }
char *find_path(t_env *env, char *s) { int k; int l; char *p; char **str; k = 0; l = -1; if (s == NULL) return (NULL); while (E_EN[k] != NULL) { if (ft_strstr(E_EN[k], "PATH=") != NULL) { p = ft_strchr(E_EN[k], '='); p++; str = ft_strsplit(p, ':'); while (str[++l] != NULL) if (scan_dir(s, str[l])) return (add_path(str[l], s)); } k++; } return (NULL); }
void setup_path(void) { const char *old_path = getenv("PATH"); struct strbuf new_path = STRBUF_INIT; add_path(&new_path, git_exec_path()); add_path(&new_path, argv0_path); if (old_path) strbuf_addstr(&new_path, old_path); else strbuf_addstr(&new_path, "/usr/local/bin:/usr/bin:/bin"); setenv("PATH", new_path.buf, 1); strbuf_release(&new_path); }
int systest_init(void) { pjsua_logging_config log_cfg; pj_status_t status = PJ_SUCCESS; status = pjsua_create(); if (status != PJ_SUCCESS) { systest_perror("Sorry we've had error in pjsua_create(): ", status); return status; } pjsua_logging_config_default(&log_cfg); log_cfg.log_filename = pj_str(add_path(doc_path, LOG_OUT_PATH)); pjsua_config_default(&systest.ua_cfg); pjsua_media_config_default(&systest.media_cfg); systest.media_cfg.clock_rate = TEST_CLOCK_RATE; systest.media_cfg.snd_clock_rate = DEV_CLOCK_RATE; if (OVERRIDE_AUD_FRAME_PTIME) systest.media_cfg.audio_frame_ptime = OVERRIDE_AUD_FRAME_PTIME; systest.media_cfg.channel_count = CHANNEL_COUNT; systest.rec_id = REC_DEV_ID; systest.play_id = PLAY_DEV_ID; systest.media_cfg.ec_tail_len = 0; systest.media_cfg.snd_auto_close_time = 0; #if defined(OVERRIDE_AUDDEV_PLAY_LAT) && OVERRIDE_AUDDEV_PLAY_LAT!=0 systest.media_cfg.snd_play_latency = OVERRIDE_AUDDEV_PLAY_LAT; #endif #if defined(OVERRIDE_AUDDEV_REC_LAT) && OVERRIDE_AUDDEV_REC_LAT!=0 systest.media_cfg.snd_rec_latency = OVERRIDE_AUDDEV_REC_LAT; #endif status = pjsua_init(&systest.ua_cfg, &log_cfg, &systest.media_cfg); if (status != PJ_SUCCESS) { pjsua_destroy(); systest_perror("Sorry we've had error in pjsua_init(): ", status); return status; } status = pjsua_start(); if (status != PJ_SUCCESS) { pjsua_destroy(); systest_perror("Sorry we've had error in pjsua_start(): ", status); return status; } status = gui_init(&root_menu); if (status != 0) goto on_return; return 0; on_return: gui_destroy(); return status; }
/* Append the standard include chain defined in cppdefault.c. */ static void add_standard_paths (const char *sysroot, const char *iprefix, int cxx_stdinc) { const struct default_include *p; size_t len; if (iprefix && (len = cpp_GCC_INCLUDE_DIR_len) != 0) { /* Look for directories that start with the standard prefix. "Translate" them, i.e. replace /usr/local/lib/gcc... with IPREFIX and search them first. */ for (p = cpp_include_defaults; p->fname; p++) { if (!p->cplusplus || cxx_stdinc) { /* Should we be translating sysrooted dirs too? Assume that iprefix and sysroot are mutually exclusive, for now. */ if (sysroot && p->add_sysroot) continue; if (!strncmp (p->fname, cpp_GCC_INCLUDE_DIR, len)) { char *str = concat (iprefix, p->fname + len, NULL); add_path (str, SYSTEM, p->cxx_aware, false); } } } } for (p = cpp_include_defaults; p->fname; p++) { if (!p->cplusplus || cxx_stdinc) { char *str; /* Should this directory start with the sysroot? */ if (sysroot && p->add_sysroot) str = concat (sysroot, p->fname, NULL); else str = update_path (p->fname, p->component); add_path (str, SYSTEM, p->cxx_aware, false); } } }
void canvas::set_line_style(Uint16 width, const rgba& color) { line_style ls; ls.m_color = color; ls.m_width = width; m_line_styles.push_back(ls); m_current_line = m_line_styles.size(); add_path(false); }
void canvas::move_to(float x, float y) { if (x != m_current_x || y != m_current_y) { m_current_x = x; m_current_y = y; add_path(false); } }
static void env_mod_path (char *dirname, char **which_path) { if (dirname == 0 || dirname[0] == '\0') return; /* Call add_path with last arg 0 to indicate not to parse for separator characters. */ add_path (dirname, which_path, 0); }
//------------------------------------------------------------------------ template<class Ctrl> void render_ctrl(Ctrl& c) { unsigned i; for(i = 0; i < c.num_paths(); i++) { reset(); add_path(c, i); color(c.color(i)); render(); } }
void canvas::begin_fill(const rgba& color) { // default fill style is solid fill_style fs; fs.m_type = 0x00; fs.m_color = color; m_fill_styles.push_back(fs); m_current_fill = m_fill_styles.size(); add_path(true); }
void setup_path(void) { const char *old_path = getenv("PATH"); struct strbuf new_path; strbuf_init(&new_path, 0); add_path(&new_path, argv_exec_path); add_path(&new_path, getenv(EXEC_PATH_ENVIRONMENT)); add_path(&new_path, system_path(GIT_EXEC_PATH)); add_path(&new_path, argv0_path); if (old_path) strbuf_addstr(&new_path, old_path); else strbuf_addstr(&new_path, "/usr/local/bin:/usr/bin:/bin"); setenv("PATH", new_path.buf, 1); strbuf_release(&new_path); }
bool file_menu::make_directory(const std::string& subdir_name) { bool ret = ::make_directory(add_path(current_dir_, subdir_name)); if (ret == false) { // gui2::show_transient_message(disp_.video(), "", _("Creation of the directory failed.")); } else { last_selection_ = -1; update_file_lists(); chosen_file_ = current_dir_; } return ret; }
// Safely concatenate paths and add it to package search paths static bool add_relative_path(const char* path, const char* relpath, pass_opt_t* opt) { char buf[FILENAME_MAX]; if(strlen(path) + strlen(relpath) >= FILENAME_MAX) return false; strcpy(buf, path); strcat(buf, relpath); return add_path(buf, opt); }
bool package_init(pass_opt_t* opt) { if(!codegen_init(opt)) return false; // package_add_paths for command line paths has already been done. Here, we // append the paths from an optional environment variable, and then the paths // that are relative to the compiler location on disk. package_add_paths(getenv("PONYPATH")); add_exec_dir(); // Finally we add OS specific paths. #ifdef PLATFORM_IS_POSIX_BASED add_path("/usr/local/lib"); add_path("/opt/local/lib"); #endif // Convert all the safe packages to their full paths. strlist_t* full_safe = NULL; while(safe != NULL) { const char* path; safe = strlist_pop(safe, &path); // Lookup (and hence normalise) path. path = find_path(NULL, path, NULL); if(path == NULL) { strlist_free(full_safe); return false; } full_safe = strlist_push(full_safe, path); } safe = full_safe; return true; }
void canvas::curve_to(float cx, float cy, float ax, float ay) { if (m_current_path >= 0) { add_path(true); } m_current_x = ax; m_current_y = ay; m_paths[m_current_path].m_edges.push_back(edge(cx, cy, ax, ay)); flush_cache(); }
void render_all_paths(VertexSource& vs, const ColorStorage& colors, const PathId& path_id, unsigned num_paths) { for(unsigned i = 0; i < num_paths; i++) { reset(); add_path(vs, path_id[i]); color(colors[i]); render(); } }
void bcp_implementation::add_dependent_lib(const std::string& libname, const fs::path& p, const fileview& view) { // // if the boost library libname has source associated with it // then add the source to our list: // if(fs::exists(m_boost_path / "libs" / libname / "src")) { if(!m_dependencies.count(fs::path("libs") / libname / "src")) { if(scanner.count(libname) == 0) init_library_scanner(m_boost_path / "libs" / libname / "src", m_cvs_mode, libname); boost::cmatch what; if(regex_search(view.begin(), view.end(), what, scanner[libname])) { std::cout << "INFO: tracking source dependencies of library " << libname << " due to presence of \"" << what << "\" in file " << p << std::endl; //std::cout << "Full text match was: " << what << std::endl; m_dependencies[fs::path("libs") / libname / "src"] = p; // set up dependency tree add_path(fs::path("libs") / libname / "src"); if(fs::exists(m_boost_path / "libs" / libname / "build")) { if(!m_dependencies.count(fs::path("libs") / libname / "build")) { m_dependencies[fs::path("libs") / libname / "build"] = p; // set up dependency tree add_path(fs::path("libs") / libname / "build"); //m_dependencies[fs::path("boost-build.jam")] = p; //add_path(fs::path("boost-build.jam")); m_dependencies[fs::path("Jamroot")] = p; add_path(fs::path("Jamroot")); //m_dependencies[fs::path("tools/build")] = p; //add_path(fs::path("tools/build")); } } } } } }
int ct_path_set_add_path(struct ct_path_set *path_set, struct ct_path const *path, enum ct_path_set_error *error) { if (!error) { errno = EINVAL; return -1; } if (!path_set || !path) { errno = EINVAL; *error = ct_path_set_error_errno; return -1; } if (ct_path_equals_path(path, path_set->root_dir)) { *error = ct_path_set_error_path_equals_root_dir; return -1; } if (!ct_path_is_under_path(path, path_set->root_dir)) { *error = ct_path_set_error_not_under_root_dir; return -1; } if (path_set->count && ct_path_set_contains_path(path_set, path)) { *error = ct_path_set_error_duplicate_path; return -1; } int result = add_path(path_set, path); if (-1 == result) { *error = ct_path_set_error_errno; return -1; } struct ct_path *dir_path = ct_path_alloc_dir(path); if (!dir_path) { *error = ct_path_set_error_errno; return -1; } result = ct_path_set_add_path(path_set, dir_path, error); ct_path_free(dir_path); if (-1 == result) { switch (*error) { case ct_path_set_error_path_equals_root_dir: break; case ct_path_set_error_duplicate_path: break; default: return -1; } } return 0; }
void canvas::line_to(float x, float y) { if (m_current_path < 0) { add_path(true); } m_current_x = x; m_current_y = y; edge ed(x, y, x, y); m_paths[m_current_path].m_edges.push_back(ed); flush_cache(); }
t_JMC::t_JMC(const cd::t_p_graph& _p_graph, unsigned int _src) { m_primary_mesh = std::map<int, t_primary_mesh >(); std::vector< std::list< cd::t_xy<int> > > buf_path_array = get_path_array(_p_graph, _src); for(std::vector< std::list< cd::t_xy<int> > >::iterator it = buf_path_array.begin(); it != buf_path_array.end(); ++it) { add_path(*it); } }
void setup_path(void) { const char *old_path = getenv("PATH"); struct strbuf new_path = STRBUF_INIT; add_path(&new_path, git_exec_path()); if (old_path) strbuf_addstr(&new_path, old_path); else strbuf_addstr(&new_path, _PATH_DEFPATH); setenv("PATH", new_path.buf, 1); strbuf_release(&new_path); }