aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cli.c
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-09-14 00:03:03 +0900
committernsfisis <nsfisis@gmail.com>2025-09-14 00:03:03 +0900
commitec63d7d6d2f123239ba436ffcb2638f27f3b7d59 (patch)
tree12f079ae35713839037cf374680c180ac9a8df73 /src/cli.c
parent4ef1add4c20d4b44aa43d0f3a102ee173b7a5e5b (diff)
downloadducc-ec63d7d6d2f123239ba436ffcb2638f27f3b7d59.tar.gz
ducc-ec63d7d6d2f123239ba436ffcb2638f27f3b7d59.tar.zst
ducc-ec63d7d6d2f123239ba436ffcb2638f27f3b7d59.zip
feat: use Nix-provided glibc headers
Diffstat (limited to 'src/cli.c')
-rw-r--r--src/cli.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/cli.c b/src/cli.c
index 7388370..9b62614 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -14,6 +14,8 @@ CliArgs* parse_cli_args(int argc, char** argv) {
bool opt_c = false;
bool opt_E = false;
bool opt_MMD = false;
+ StrArray include_dirs;
+ strings_init(&include_dirs);
for (int i = 1; i < argc; ++i) {
if (argv[i][0] != '-') {
@@ -29,6 +31,19 @@ CliArgs* parse_cli_args(int argc, char** argv) {
// ignore
} else if (c == 'M' && argv[i][2] == '\0') {
// ignore -M
+ } else if (c == 'I') {
+ const char* dir = NULL;
+ if (argv[i][2] != '\0') {
+ // -Ipath format
+ dir = argv[i] + 2;
+ } else if (argc > i + 1) {
+ // -I path format
+ dir = argv[i + 1];
+ ++i;
+ } else {
+ fatal_error("-I requires directory");
+ }
+ strings_push(&include_dirs, dir);
} else if (c == 'o') {
if (argc <= i + 1) {
fatal_error("-o requires filename");
@@ -63,6 +78,7 @@ CliArgs* parse_cli_args(int argc, char** argv) {
a->totally_deligate_to_gcc = false;
a->gcc_command = NULL;
a->generate_deps = opt_MMD;
+ a->include_dirs = include_dirs;
if (!a->only_compile && str_ends_with(a->input_filename, ".o")) {
a->totally_deligate_to_gcc = true;