diff options
author | Mukund Sivaraman <muks@banu.com> | 2010-01-18 19:05:31 +0530 |
---|---|---|
committer | Mukund Sivaraman <muks@banu.com> | 2010-01-18 19:05:31 +0530 |
commit | edea7e37d08e3045f4e7932ed74e09b5b8dc5c5c (patch) | |
tree | 99bb68e4527f015b8834dce40e604bba4c9e8049 /src | |
parent | f3fe3d8e79a9962aa7cd28d0e80f4991c4ab7cad (diff) | |
download | tinyproxy-edea7e37d08e3045f4e7932ed74e09b5b8dc5c5c.tar.gz tinyproxy-edea7e37d08e3045f4e7932ed74e09b5b8dc5c5c.zip |
Show authors and documenters when license is requested
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 14 | ||||
-rw-r--r-- | src/authors.c | 41 | ||||
-rw-r--r-- | src/authors.h | 30 | ||||
-rw-r--r-- | src/authors.xsl | 64 | ||||
-rw-r--r-- | src/main.c | 26 |
5 files changed, 174 insertions, 1 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 0b6d45d..8358ef1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -24,6 +24,7 @@ AM_CPPFLAGS = \ tinyproxy_SOURCES = \ acl.c acl.h \ anonymous.c anonymous.h \ + authors.c authors.h \ buffer.c buffer.h \ child.c child.h \ common.h \ @@ -51,3 +52,16 @@ EXTRA_tinyproxy_SOURCES = filter.c filter.h \ transparent-proxy.c transparent-proxy.h tinyproxy_DEPENDENCIES = @ADDITIONAL_OBJECTS@ tinyproxy_LDADD = @ADDITIONAL_OBJECTS@ + +EXTRA_DIST = \ + authors.xsl + +authors.c: $(top_srcdir)/authors.xml $(srcdir)/authors.xsl +if HAVE_XSLTPROC + $(AM_V_GEN) $(XSLTPROC) $(srcdir)/authors.xsl $< > $(@) || rm -f $(@) +else + @echo "*** xsltproc is required to regenerate $(@) ***"; exit 1; +endif + +BUILT_SOURCES = \ + authors.c diff --git a/src/authors.c b/src/authors.c new file mode 100644 index 0000000..988a160 --- /dev/null +++ b/src/authors.c @@ -0,0 +1,41 @@ + +/* NOTE: This file is auto-generated from authors.xml, do not edit it. */ + +#include "authors.h" + +static const char * const authors[] = +{ + "Andrew Stribblehill", + "David Shanks", + "Jeremy Hinegardner", + "Kim Holviala", + "Mathew Mrosko", + "Matthew Dempsky", + "Michael Adam", + "Mukund Sivaraman", + "Robert James Kaes", + "Steven Young", + NULL +}; + +static const char * const documenters[] = +{ + "Marc Silver", + "Michael Adam", + "Mukund Sivaraman", + "Robert James Kaes", + "Steven Young", + NULL +}; + +const char * const * +authors_get_authors (void) +{ + return authors; +} + +const char * const * +authors_get_documenters (void) +{ + return documenters; +} diff --git a/src/authors.h b/src/authors.h new file mode 100644 index 0000000..10e5110 --- /dev/null +++ b/src/authors.h @@ -0,0 +1,30 @@ +/* tinyproxy - A fast light-weight HTTP proxy + * Copyright (C) 2010 Mukund Sivaraman <muks@banu.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __AUTHORS_H__ +#define __AUTHORS_H__ + +#include "common.h" + +const char * const * +authors_get_authors (void); + +const char * const * +authors_get_documenters (void); + +#endif /* __AUTHORS_H__ */ diff --git a/src/authors.xsl b/src/authors.xsl new file mode 100644 index 0000000..338bf15 --- /dev/null +++ b/src/authors.xsl @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + + Simple XSL transformation to create a header file from + authors.xml. This file was adapted from GIMP. + +--> + +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:dc="http://purl.org/dc/elements/1.1/"> + + <xsl:output method="text" /> + + <xsl:template name="recent-contributor"> + <xsl:param name="role" /> + <xsl:apply-templates select="dc:contributor[contains(@role, $role) and number(@last-active) > 1.6]" /> + </xsl:template> + + <xsl:template match="/dc:authors"> +<xsl:text> +/* NOTE: This file is auto-generated from authors.xml, do not edit it. */ + +#include "authors.h" + +static const char * const authors[] = +{ +</xsl:text> + <xsl:call-template name="recent-contributor"> + <xsl:with-param name="role" select="'author'"/> + </xsl:call-template> +<xsl:text> NULL +}; +</xsl:text> + +<xsl:text> +static const char * const documenters[] = +{ +</xsl:text> + <xsl:call-template name="recent-contributor"> + <xsl:with-param name="role" select="'documenter'"/> + </xsl:call-template> +<xsl:text> NULL +}; + +const char * const * +authors_get_authors (void) +{ + return authors; +} + +const char * const * +authors_get_documenters (void) +{ + return documenters; +} +</xsl:text> + </xsl:template> + + <xsl:template match="dc:contributor"> "<xsl:apply-templates />", +</xsl:template> + +</xsl:stylesheet> @@ -32,6 +32,7 @@ #include "main.h" #include "anonymous.h" +#include "authors.h" #include "buffer.h" #include "conf.h" #include "daemon.h" @@ -92,9 +93,13 @@ display_version (void) static void display_license (void) { + const char * const *authors; + const char * const *documenters; + display_version (); printf ("\ +\n\ Copyright 1998 Steven Young (sdyoung@well.com)\n\ Copyright 1998-2002 Robert James Kaes (rjkaes@users.sourceforge.net)\n\ Copyright 1999 George Talusan (gstalusan@uwaterloo.ca)\n\ @@ -114,7 +119,26 @@ display_license (void) \n\ You should have received a copy of the GNU General Public License\n\ along with this program; if not, write to the Free Software\n\ - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.\n"); + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.\n\ +\n"); + + authors = authors_get_authors (); + + printf ("\nAUTHORS:\n"); + while (*authors) { + printf (" %s\n", *authors); + authors++; + } + + documenters = authors_get_documenters (); + + printf ("\nDOCUMENTERS:\n"); + while (*documenters) { + printf (" %s\n", *documenters); + documenters++; + } + + printf ("\n"); } /* |