int
mkdir_recursively(const string& path)
{ int err;
size_t pos = 0; // For absolute pathnames, that starts with leading '/' // use appropriate initial value. if (path.length() != 0and path[0] == '/') pos++;
while (true) {
pos = path.find('/', pos);
string p = path.substr(0, pos); struct stat st;
err = stat(p.c_str(), &st); if (err != 0) {
err = mkdir(p.c_str(), 0770); if (err != 0) {
fprintf(stderr, "can't create directory %s (%s)\n",
path.c_str(), strerror(errno)); return errno;
}
} elseif (!S_ISDIR(st.st_mode)) {
fprintf(stderr, "can't create directory %s because %s is a file.\n",
path.c_str(), p.c_str()); return1;
}
pos++; if (p == path) { return0;
}
}
}
int
copy_file(const string& src, const string& dst)
{ int err;
int
strip_file(const string& path)
{ // Default strip command to run is "strip" unless overridden by the ATREE_STRIP env var. constchar* strip_cmd = getenv("ATREE_STRIP"); if (!strip_cmd || !strip_cmd[0]) {
strip_cmd = "strip";
}
pid_t pid = fork(); if (pid == -1) { // Fork failed. errno should be set. return -1;
} elseif (pid == 0) { // Exec in the child. Only returns if execve failed.
int num_args = 0; constchar *s = strip_cmd; while (*s) { while (*s == ' ') ++s; if (*s && *s != ' ') {
++num_args; while (*s && *s != ' ') ++s;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.