aboutsummaryrefslogtreecommitdiff
path: root/fcgi-cgi.c
diff options
context:
space:
mode:
authorStefan Bühler <stbuehler@web.de>2010-05-07 22:50:48 +0200
committerStefan Bühler <stbuehler@web.de>2010-05-07 22:50:48 +0200
commitadaf8af1ff273c61f84de7d51960165676d6eaaf (patch)
treee17dc5874cb009349444fe48b0bcc27eb86a9ad4 /fcgi-cgi.c
parentb094a9ad168cf3a4eb99f0a73d9b3d720ca93652 (diff)
downloadfcgi-cgi-adaf8af1ff273c61f84de7d51960165676d6eaaf.tar.gz
fcgi-cgi-adaf8af1ff273c61f84de7d51960165676d6eaaf.zip
Add option handling, bump version number to 0.1.5, add man-pagev0.1.5
Diffstat (limited to 'fcgi-cgi.c')
-rw-r--r--fcgi-cgi.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/fcgi-cgi.c b/fcgi-cgi.c
index fc44a7f..f946028 100644
--- a/fcgi-cgi.c
+++ b/fcgi-cgi.c
@@ -23,6 +23,8 @@
#define __STR(x) #x
#define ERROR(...) g_printerr("fcgi-cgi.c:" G_STRINGIFY(__LINE__) ": " __VA_ARGS__)
+#define PACKAGE_DESC (PACKAGE_NAME " v" PACKAGE_VERSION " - forks and watches multiple instances of a program in the same environment")
+
struct fcgi_cgi_server;
typedef struct fcgi_cgi_server fcgi_cgi_server;
@@ -557,10 +559,25 @@ static const GOptionEntry entries[] = {
};
int main(int argc, char **argv) {
+ GOptionContext *context;
+ GError *error = NULL;
struct ev_loop *loop;
fcgi_cgi_server* srv;
- UNUSED(argc);
- UNUSED(argv);
+
+ context = g_option_context_new("<application> [app arguments]");
+ g_option_context_add_main_entries(context, entries, NULL);
+ g_option_context_set_summary(context, PACKAGE_DESC);
+
+ if (!g_option_context_parse (context, &argc, &argv, &error)) {
+ g_printerr("Option parsing failed: %s\n", error->message);
+ return -1;
+ }
+
+ if (opts.show_version) {
+ g_printerr(PACKAGE_DESC);
+ g_printerr("\nBuild-Date: " __DATE__ " " __TIME__ "\n");
+ return 0;
+ }
loop = ev_default_loop(0);
srv = fcgi_cgi_server_create(loop, 0, opts.maxconns);