Show authors and documenters when license is requested

This commit is contained in:
Mukund Sivaraman 2010-01-18 19:05:31 +05:30
parent f3fe3d8e79
commit edea7e37d0
5 changed files with 174 additions and 1 deletions

View File

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

41
src/authors.c Normal file
View File

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

30
src/authors.h Normal file
View File

@ -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__ */

64
src/authors.xsl Normal file
View File

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

View File

@ -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");
}
/*