Add option handling, bump version number to 0.1.5, add man-page

This commit is contained in:
Stefan Bühler 2010-05-07 22:50:48 +02:00
parent b094a9ad16
commit adaf8af1ff
5 changed files with 64 additions and 7 deletions

View File

@ -22,7 +22,7 @@ MACRO(ADD_TARGET_PROPERTIES _target _name _properties)
ENDMACRO(ADD_TARGET_PROPERTIES)
PROJECT(fcgi-cgi)
SET(PACKAGE_VERSION 0.1.0)
SET(PACKAGE_VERSION 0.1.5)
IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
@ -71,3 +71,11 @@ ADD_TARGET_PROPERTIES(fcgi-cgi LINK_FLAGS "${GLIB2_LDFLAGS}")
ADD_TARGET_PROPERTIES(fcgi-cgi COMPILE_FLAGS "${GLIB2_CFLAGS_OTHER}")
INSTALL(TARGETS fcgi-cgi DESTINATION bin)
# man page
SET(CMAKE_MAN_DIR "share/man" CACHE STRING
"Install location for man pages (relative to prefix).")
MARK_AS_ADVANCED(CMAKE_MAN_DIR)
INSTALL(FILES fcgi-cgi.1 DESTINATION ${CMAKE_MAN_DIR}/man1)

View File

@ -1,6 +1,5 @@
# fcgi-cgi.1
EXTRA_DIST=autogen.sh CMakeLists.txt config.h.cmake
#man1_MANS=fcgi-cgi.1
EXTRA_DIST=autogen.sh CMakeLists.txt config.h.cmake fcgi-cgi.1
man1_MANS=fcgi-cgi.1
AM_CFLAGS=$(GLIB_CFLAGS)
fcgi_cgi_LDADD=$(GLIB_LIBS)

View File

@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.63])
AC_INIT([fcgi-cgi], [0.1.0], [lighttpd@stbuehler.de])
AC_INIT([fcgi-cgi], [0.1.5], [lighttpd@stbuehler.de])
AC_CONFIG_SRCDIR([fcgi-cgi.c])
AC_CONFIG_HEADERS([config.h])

33
fcgi-cgi.1 Normal file
View File

@ -0,0 +1,33 @@
.TH fcgi-cgi 1 "May 7, 2010"
.
.SH NAME
.
fcgi-cgi \- a FastCGI application to run cgi applications
.
.SH OPTIONS
.
.TP 8
.B \-c <number>
Maximum number of connections (default 16)
.TP 8
.B \-v
Shows version information and exits
.
.SH DESCRIPTION
fcgi-cgi is a FastCGI application to run normal cgi applications. It doesn't
make CGI applications faster, but it allows you to run them on a different
host and with different user permissions (without the need for suexec).
.P
lighttpd2 won't have a mod_cgi, so you need this FastCGI wrapper to be
able to execute standard cgi applications like mailman and cgit.
.P
nginx recommends something similar, they implemented the wrapper in Perl:
http://wiki.nginx.org/NginxSimpleCGI
.P
For running you probably want spawn-fcgi (http://redmine.lighttpd.net/projects/spawn-fcgi)
.SH EXAMPLE
Example usage:
spawn-fcgi -n -s /tmp/fastcgi-cgi.sock -u www-default -U www-data -- /usr/bin/fcgi-cgi
.SH AUTHOR
fcgi-cgi was written by Stefan Bühler.

View File

@ -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);