cpp: search local dir only for quoted headers
[m6w6/ext-psi] / src / cpp.c
index 5ab649247d17a4a2f468d7411a825e2c9333541c..908c21f25d1384818fa0290cff88d989c869acb6 100644 (file)
--- a/src/cpp.c
+++ b/src/cpp.c
@@ -469,7 +469,7 @@ bool psi_cpp_include(struct psi_cpp *cpp, const struct psi_token *file, unsigned
        bool parsed = false;
        int f_len = strlen(file->text);
 
-       if (!(flags & PSI_CPP_INCLUDE_NEXT) || *file->text == '/') {
+       if (file->type == PSI_T_QUOTED_STRING && (!(flags & PSI_CPP_INCLUDE_NEXT) || *file->text == '/')) {
                /* first try as is, full or relative path */
                char temp[PATH_MAX], *path = temp;
 
@@ -499,7 +499,7 @@ bool psi_cpp_include(struct psi_cpp *cpp, const struct psi_token *file, unsigned
                        }
                }
 
-               if (!(flags & PSI_CPP_INCLUDE_NEXT) || !cpp->search) {
+               if (!(flags & PSI_CPP_INCLUDE_NEXT)) {
                        cpp->search = PSI_G(search_path);
                }