[qfcc] Handle quote includes better

The path for the current file wasn't being set correctly at startup and
"error: success" never makes much sense.
This commit is contained in:
Bill Currie 2023-10-26 20:28:43 +09:00
parent ffb2514e75
commit 47c60f2bbf

View file

@ -51,6 +51,7 @@
#endif
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include "QF/dstring.h"
#include "QF/sys.h"
@ -567,6 +568,9 @@ cpp_find_file (const char *name, int quote, bool *is_system)
return path;
}
}
if (!errno) {
errno = ENOENT;
}
return 0;
}
@ -574,12 +578,12 @@ void
cpp_set_quote_file (const char *path)
{
if (!path) {
cpp_quote_start = pr.comp_dir;
cpp_quote_start = "";
return;
}
const char *e = strrchr (path, '/');
if (!e) {
cpp_quote_start = pr.comp_dir;
cpp_quote_start = "";
return;
}
cpp_quote_start = save_substring (path, e - path);