45 if (p && *p++ ==
'.' && *p++ ==
'\0')
52 if (p && *p++ ==
'.' && *p++ ==
'.' && *p++ ==
'\0')
61 char buf[ BUFSIZ ], **pp;
63 sprintf(buf,
"%s%s%s",
dir, *
dir ?
"/" :
"", component);
65 if (strcmp(*pp, buf) == 0)
67 if (lstat(buf, &st) == 0
68 && (st.st_mode & S_IFMT) == S_IFLNK) {
71 fatalerr(
"out of .. dirs, increase MAXDIRS\n");
75 if (
dir && component) { }
87 register char *end, *from, *to, **cp;
90 boolean component_copied;
100 for (from = end = path; *end; end++)
124 if (cp != components)
134 component_copied =
FALSE;
136 if (component_copied)
138 component_copied =
TRUE;
139 for (from = *cp; *from;)
149 strcpy(path, newpath);
164 fatalerr(
"out of space: increase MAXFILES\n");
167 if (incstring ==
NULL)
194 if (ip->
i_list[ i ] == newfile) {
195 i = strlen(newfile->
i_file);
198 newfile->
i_file[i-1] ==
'c' &&
199 newfile->
i_file[i-2] ==
'.')) {
204 warning(
"%s includes %s more than once!\n",
235 static char path[ BUFSIZ ];
236 register char **pp, *p;
239 boolean found =
FALSE;
256 if (!found && (dot || *include ==
'/')) {
258 if (stat(include, &st) == 0 && (st.st_mode & S_IFREG)) {
260 if (stat(include, &st) == 0 && S_ISREG(st.st_mode)) {
277 strncpy(path, include,
sizeof(path) - 1);
278 path[
sizeof(path)-1] =
'\0';
280 strncpy(path,
file, (p -
file) + 1);
281 path[(p-
file) + 1] =
'\0';
282 strncpy(path + (p -
file) + 1, include,
sizeof(path) - (p -
file + 1));
286 if (stat(path, &st) == 0 && (st.st_mode & S_IFREG)) {
288 if (stat(path, &st) == 0 && S_ISREG(st.st_mode)) {
302 int retlen =
snprintf(path, BUFSIZ,
"%s/%s", *pp, include);
303 if (retlen <= 0 || BUFSIZ < retlen) {
304 warning1(
"\t%s/%s too long\n", *pp, include);
309 if (stat(path, &st) == 0 && (st.st_mode & S_IFREG)) {
311 if (stat(path, &st) == 0 && S_ISREG(st.st_mode)) {
void undefine_all(struct inclist *)
void warning1(char *,...)
void fatalerr(char *,...)
void included_by(register struct inclist *ip, register struct inclist *newfile)
boolean isdot(register char *p)
void remove_dotdot(char *path)
boolean issymbolic(register char *dir, register char *component)
struct inclist * inclistp
struct inclist * newinclude(register char *newfile, register char *incstring)
boolean isdotdot(register char *p)
struct inclist * inc_path(char *file, char *include, boolean dot)