aboutsummaryrefslogtreecommitdiff
path: root/src/driver
diff options
context:
space:
mode:
Diffstat (limited to 'src/driver')
-rw-r--r--src/driver/Makefile.in2
-rw-r--r--src/driver/main.c25
-rw-r--r--src/driver/utils.c3
-rw-r--r--src/driver/utils.h1
4 files changed, 29 insertions, 2 deletions
diff --git a/src/driver/Makefile.in b/src/driver/Makefile.in
index 934a16e9..52ead916 100644
--- a/src/driver/Makefile.in
+++ b/src/driver/Makefile.in
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2009, Gabriel Dos Reis.
+# Copyright (C) 2007-2010, Gabriel Dos Reis.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
diff --git a/src/driver/main.c b/src/driver/main.c
index c1af3879..f5083ff5 100644
--- a/src/driver/main.c
+++ b/src/driver/main.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2008-2009, Gabriel Dos Reis.
+ Copyright (C) 2008-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -85,6 +85,25 @@ upgrade_environment(const char* sysdir) {
publish_systemdir(sysdir);
}
+/* Print configuration info. */
+static int
+print_configuration_info(openaxiom_command* command) {
+ int i;
+ for (i = 1; i < command->core.argc; ++i) {
+ if (strcmp(command->core.argv[i], "include") == 0)
+ printf(" -I\"%s\"/include", command->root_dir);
+ else if (strcmp(command->core.argv[i], "lib") == 0)
+ printf(" -L\"%s\"/lib -lOpenAxiom", command->root_dir);
+ else {
+ fprintf(stderr, "open-axiom: invalid request %s\n",
+ command->core.argv[i]);
+ return 1;
+ }
+ }
+ fflush(stdout);
+ return 0;
+}
+
int
main(int argc, char* argv[])
@@ -97,6 +116,10 @@ main(int argc, char* argv[])
switch (driver) {
case openaxiom_null_driver:
return 0; /* Bye. */
+
+ case openaxiom_config_driver:
+ return print_configuration_info(&command);
+
case openaxiom_core_driver:
case openaxiom_script_driver:
case openaxiom_compiler_driver:
diff --git a/src/driver/utils.c b/src/driver/utils.c
index 0936705f..ed85339d 100644
--- a/src/driver/utils.c
+++ b/src/driver/utils.c
@@ -120,6 +120,7 @@ openaxiom_build_rts_options(openaxiom_command* command,
openaxiom_driver driver)
{
switch (driver) {
+ case openaxiom_config_driver:
case openaxiom_sman_driver:
case openaxiom_execute_driver:
case openaxiom_unknown_driver:
@@ -232,6 +233,8 @@ openaxiom_preprocess_arguments(openaxiom_command* command,
driver = openaxiom_core_driver;
else if (strcmp(argv[i], "--server") == 0)
driver = openaxiom_sman_driver;
+ else if (strcmp(argv[i], "--config") == 0)
+ driver = openaxiom_config_driver;
else if (strcmp(argv[i], "--execute") == 0) {
driver = openaxiom_execute_driver;
break;
diff --git a/src/driver/utils.h b/src/driver/utils.h
index eebb1783..b47970da 100644
--- a/src/driver/utils.h
+++ b/src/driver/utils.h
@@ -50,6 +50,7 @@ extern "C" {
typedef enum openaxiom_driver {
openaxiom_unknown_driver, /* unknown driver */
openaxiom_null_driver, /* do nothing */
+ openaxiom_config_driver, /* print out configuration information */
openaxiom_sman_driver, /* start Superman as master process */
openaxiom_core_driver, /* start the core system as master process */
openaxiom_script_driver, /* start the core system in script mode. */