added string replace fct
authorJean-Philippe Orsini <jeanfi@gmail.com>
Mon, 7 May 2012 23:20:56 +0000 (23:20 +0000)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Mon, 7 May 2012 23:20:56 +0000 (23:20 +0000)
12 files changed:
po/fr.po
po/ppastats.pot
src/Makefile.am
src/Makefile.in
src/html.c
src/str.c [new file with mode: 0644]
src/str.h [new file with mode: 0644]
tests/Makefile.am
tests/Makefile.in
www/Makefile.am
www/Makefile.in
www/pkg.tpl [new file with mode: 0644]

index 7e6d31f..83070bc 100644 (file)
--- a/po/fr.po
+++ b/po/fr.po
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: ppastats 0.0.x\n"
 "Report-Msgid-Bugs-To: jeanfi@gmail.com\n"
 msgstr ""
 "Project-Id-Version: ppastats 0.0.x\n"
 "Report-Msgid-Bugs-To: jeanfi@gmail.com\n"
-"POT-Creation-Date: 2012-05-07 14:22+0200\n"
+"POT-Creation-Date: 2012-05-07 23:24+0200\n"
 "PO-Revision-Date: 2012-05-05 23:45+0200\n"
 "Last-Translator:  <jeanfi@gmail.com>\n"
 "Language-Team: French\n"
 "PO-Revision-Date: 2012-05-05 23:45+0200\n"
 "Last-Translator:  <jeanfi@gmail.com>\n"
 "Language-Team: French\n"
@@ -31,17 +31,17 @@ msgstr ""
 msgid "exceed cache capacity"
 msgstr ""
 
 msgid "exceed cache capacity"
 msgstr ""
 
-#: src/html.c:407 src/html.c:436
+#: src/html.c:408 src/html.c:437
 #, c-format
 msgid "failed to open: %s"
 msgstr ""
 
 #, c-format
 msgid "failed to open: %s"
 msgstr ""
 
-#: src/html.c:470 src/html.c:490 src/html.c:503
+#: src/html.c:478 src/html.c:505 src/html.c:518
 #, c-format
 msgid "generating %s"
 msgstr ""
 
 #, c-format
 msgid "generating %s"
 msgstr ""
 
-#: src/html.c:566
+#: src/html.c:581
 #, c-format
 msgid "copying %s %s"
 msgstr ""
 #, c-format
 msgid "copying %s %s"
 msgstr ""
@@ -73,7 +73,7 @@ msgstr ""
 msgid "cleanup CURL"
 msgstr ""
 
 msgid "cleanup CURL"
 msgstr ""
 
-#: src/main.c:103
+#: src/main.c:102
 #, fuzzy, c-format
 msgid ""
 "Copyright (C) %s jeanfi@gmail.com\n"
 #, fuzzy, c-format
 msgid ""
 "Copyright (C) %s jeanfi@gmail.com\n"
@@ -90,60 +90,66 @@ msgstr ""
 "Ce logiciel n'est accompagné d’ABSOLUMENT AUCUNE GARANTIE, dans les limites\n"
 "autorisées par la loi applicable.\n"
 
 "Ce logiciel n'est accompagné d’ABSOLUMENT AUCUNE GARANTIE, dans les limites\n"
 "autorisées par la loi applicable.\n"
 
-#: src/main.c:113
+#: src/main.c:112
 #, c-format
 msgid "Usage: %s [OPTION]... PPA_OWNER PPA_NAME\n"
 msgstr "Utilisation: %s [OPTION]... PPA_OWNER PPA_NAME\n"
 
 #, c-format
 msgid "Usage: %s [OPTION]... PPA_OWNER PPA_NAME\n"
 msgstr "Utilisation: %s [OPTION]... PPA_OWNER PPA_NAME\n"
 
-#: src/main.c:116
+#: src/main.c:115
 msgid "ppastats is a command application for generating PPA statistics.\n"
 msgstr ""
 
 msgid "ppastats is a command application for generating PPA statistics.\n"
 msgstr ""
 
-#: src/main.c:119
+#: src/main.c:117
 msgid ""
 "Prints number of downloads for each published packages of a PPA or "
 "generates\n"
 "an HTML page containing a graph representation."
 msgstr ""
 
 msgid ""
 "Prints number of downloads for each published packages of a PPA or "
 "generates\n"
 "an HTML page containing a graph representation."
 msgstr ""
 
-#: src/main.c:123
+#: src/main.c:121
 msgid "Options:"
 msgstr "Options:"
 
 msgid "Options:"
 msgstr "Options:"
 
-#: src/main.c:125
-msgid ""
-"  -h, --help          display this help and exit\n"
-"  -v, --version       display version information and exit"
+#: src/main.c:122
+#, fuzzy
+msgid "  -h, --help          display this help and exit"
+msgstr ""
+"  -h, --help          afficher cette aide et quitter\n"
+"  -v, --version       afficher les informations de version et quitter"
+
+#: src/main.c:123
+#, fuzzy
+msgid "  -v, --version       display version information and exit"
 msgstr ""
 "  -h, --help          afficher cette aide et quitter\n"
 "  -v, --version       afficher les informations de version et quitter"
 
 msgstr ""
 "  -h, --help          afficher cette aide et quitter\n"
 "  -v, --version       afficher les informations de version et quitter"
 
-#: src/main.c:131
-msgid "  -o, --output-dir=[PATH]  generates HTML pages into 'PATH'."
+#: src/main.c:127
+msgid "  -o, --output-dir=[PATH]  generates HTML pages into 'PATH'"
 msgstr ""
 
 msgstr ""
 
-#: src/main.c:134
+#: src/main.c:130
 msgid ""
 "  -s, --status=[STATUS]    retrieves only package of the given status\n"
 "                           (possible values are: Pending, Published,\n"
 msgid ""
 "  -s, --status=[STATUS]    retrieves only package of the given status\n"
 "                           (possible values are: Pending, Published,\n"
-"                           Superseded, Deleted or Obsolete)."
+"                           Superseded, Deleted or Obsolete)"
 msgstr ""
 
 msgstr ""
 
-#: src/main.c:139
+#: src/main.c:135
 msgid " -S, --skip-js-css         skip installation of js and css files"
 msgstr ""
 
 msgid " -S, --skip-js-css         skip installation of js and css files"
 msgstr ""
 
-#: src/main.c:142
+#: src/main.c:138
 #, c-format
 msgid "Report bugs to: %s\n"
 msgstr ""
 
 #, c-format
 msgid "Report bugs to: %s\n"
 msgstr ""
 
-#: src/main.c:144
+#: src/main.c:140
 #, c-format
 msgid "%s home page: <%s>\n"
 msgstr ""
 
 #, c-format
 msgid "%s home page: <%s>\n"
 msgstr ""
 
-#: src/main.c:194
+#: src/main.c:190
 #, c-format
 msgid "Try `%s --help' for more information.\n"
 msgstr ""
 #, c-format
 msgid "Try `%s --help' for more information.\n"
 msgstr ""
index 7be056b..14dc0ee 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: ppastats 0.0.x\n"
 "Report-Msgid-Bugs-To: jeanfi@gmail.com\n"
 msgstr ""
 "Project-Id-Version: ppastats 0.0.x\n"
 "Report-Msgid-Bugs-To: jeanfi@gmail.com\n"
-"POT-Creation-Date: 2012-05-07 14:22+0200\n"
+"POT-Creation-Date: 2012-05-07 23:24+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -31,17 +31,17 @@ msgstr ""
 msgid "exceed cache capacity"
 msgstr ""
 
 msgid "exceed cache capacity"
 msgstr ""
 
-#: src/html.c:407 src/html.c:436
+#: src/html.c:408 src/html.c:437
 #, c-format
 msgid "failed to open: %s"
 msgstr ""
 
 #, c-format
 msgid "failed to open: %s"
 msgstr ""
 
-#: src/html.c:470 src/html.c:490 src/html.c:503
+#: src/html.c:478 src/html.c:505 src/html.c:518
 #, c-format
 msgid "generating %s"
 msgstr ""
 
 #, c-format
 msgid "generating %s"
 msgstr ""
 
-#: src/html.c:566
+#: src/html.c:581
 #, c-format
 msgid "copying %s %s"
 msgstr ""
 #, c-format
 msgid "copying %s %s"
 msgstr ""
@@ -73,7 +73,7 @@ msgstr ""
 msgid "cleanup CURL"
 msgstr ""
 
 msgid "cleanup CURL"
 msgstr ""
 
-#: src/main.c:103
+#: src/main.c:102
 #, c-format
 msgid ""
 "Copyright (C) %s jeanfi@gmail.com\n"
 #, c-format
 msgid ""
 "Copyright (C) %s jeanfi@gmail.com\n"
@@ -83,58 +83,60 @@ msgid ""
 "There is NO WARRANTY, to the extent permitted by law.\n"
 msgstr ""
 
 "There is NO WARRANTY, to the extent permitted by law.\n"
 msgstr ""
 
-#: src/main.c:113
+#: src/main.c:112
 #, c-format
 msgid "Usage: %s [OPTION]... PPA_OWNER PPA_NAME\n"
 msgstr ""
 
 #, c-format
 msgid "Usage: %s [OPTION]... PPA_OWNER PPA_NAME\n"
 msgstr ""
 
-#: src/main.c:116
+#: src/main.c:115
 msgid "ppastats is a command application for generating PPA statistics.\n"
 msgstr ""
 
 msgid "ppastats is a command application for generating PPA statistics.\n"
 msgstr ""
 
-#: src/main.c:119
+#: src/main.c:117
 msgid ""
 "Prints number of downloads for each published packages of a PPA or "
 "generates\n"
 "an HTML page containing a graph representation."
 msgstr ""
 
 msgid ""
 "Prints number of downloads for each published packages of a PPA or "
 "generates\n"
 "an HTML page containing a graph representation."
 msgstr ""
 
-#: src/main.c:123
+#: src/main.c:121
 msgid "Options:"
 msgstr ""
 
 msgid "Options:"
 msgstr ""
 
-#: src/main.c:125
-msgid ""
-"  -h, --help          display this help and exit\n"
-"  -v, --version       display version information and exit"
+#: src/main.c:122
+msgid "  -h, --help          display this help and exit"
+msgstr ""
+
+#: src/main.c:123
+msgid "  -v, --version       display version information and exit"
 msgstr ""
 
 msgstr ""
 
-#: src/main.c:131
-msgid "  -o, --output-dir=[PATH]  generates HTML pages into 'PATH'."
+#: src/main.c:127
+msgid "  -o, --output-dir=[PATH]  generates HTML pages into 'PATH'"
 msgstr ""
 
 msgstr ""
 
-#: src/main.c:134
+#: src/main.c:130
 msgid ""
 "  -s, --status=[STATUS]    retrieves only package of the given status\n"
 "                           (possible values are: Pending, Published,\n"
 msgid ""
 "  -s, --status=[STATUS]    retrieves only package of the given status\n"
 "                           (possible values are: Pending, Published,\n"
-"                           Superseded, Deleted or Obsolete)."
+"                           Superseded, Deleted or Obsolete)"
 msgstr ""
 
 msgstr ""
 
-#: src/main.c:139
+#: src/main.c:135
 msgid " -S, --skip-js-css         skip installation of js and css files"
 msgstr ""
 
 msgid " -S, --skip-js-css         skip installation of js and css files"
 msgstr ""
 
-#: src/main.c:142
+#: src/main.c:138
 #, c-format
 msgid "Report bugs to: %s\n"
 msgstr ""
 
 #, c-format
 msgid "Report bugs to: %s\n"
 msgstr ""
 
-#: src/main.c:144
+#: src/main.c:140
 #, c-format
 msgid "%s home page: <%s>\n"
 msgstr ""
 
 #, c-format
 msgid "%s home page: <%s>\n"
 msgstr ""
 
-#: src/main.c:194
+#: src/main.c:190
 #, c-format
 msgid "Try `%s --help' for more information.\n"
 msgstr ""
 #, c-format
 msgid "Try `%s --help' for more information.\n"
 msgstr ""
index 03bb962..be2d881 100644 (file)
@@ -18,7 +18,8 @@ ppastats_SOURCES = \
        lp_json.h lp_json.c\
        lp_ws.h lp_ws.c\
        main.c\
        lp_json.h lp_json.c\
        lp_ws.h lp_ws.c\
        main.c\
-       ppastats.h ppastats.c
+       ppastats.h ppastats.c\
+       str.h str.c
 
 dist_man_MANS = ppastats.1
 
 
 dist_man_MANS = ppastats.1
 
index 3dfb16b..0fbe8d1 100644 (file)
@@ -55,7 +55,8 @@ am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
 PROGRAMS = $(bin_PROGRAMS)
 am_ppastats_OBJECTS = cache.$(OBJEXT) html.$(OBJEXT) io.$(OBJEXT) \
        list.$(OBJEXT) log.$(OBJEXT) lp.$(OBJEXT) lp_json.$(OBJEXT) \
 PROGRAMS = $(bin_PROGRAMS)
 am_ppastats_OBJECTS = cache.$(OBJEXT) html.$(OBJEXT) io.$(OBJEXT) \
        list.$(OBJEXT) log.$(OBJEXT) lp.$(OBJEXT) lp_json.$(OBJEXT) \
-       lp_ws.$(OBJEXT) main.$(OBJEXT) ppastats.$(OBJEXT)
+       lp_ws.$(OBJEXT) main.$(OBJEXT) ppastats.$(OBJEXT) \
+       str.$(OBJEXT)
 ppastats_OBJECTS = $(am_ppastats_OBJECTS)
 ppastats_LDADD = $(LDADD)
 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
 ppastats_OBJECTS = $(am_ppastats_OBJECTS)
 ppastats_LDADD = $(LDADD)
 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
@@ -236,7 +237,8 @@ ppastats_SOURCES = \
        lp_json.h lp_json.c\
        lp_ws.h lp_ws.c\
        main.c\
        lp_json.h lp_json.c\
        lp_ws.h lp_ws.c\
        main.c\
-       ppastats.h ppastats.c
+       ppastats.h ppastats.c\
+       str.h str.c
 
 dist_man_MANS = ppastats.1
 all: all-am
 
 dist_man_MANS = ppastats.1
 all: all-am
@@ -330,6 +332,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lp_ws.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppastats.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lp_ws.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppastats.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str.Po@am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@   $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
 
 .c.o:
 @am__fastdepCC_TRUE@   $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
index f4e2790..b2e9e34 100644 (file)
 
 static char *footer;
 static char *ppa_body;
 
 static char *footer;
 static char *ppa_body;
-
-#define HTML_PKG_TEMPLATE \
-"      <h1><span id=\"pkg_name\">N/A</span></h1>\n\
-       <div id=\"charts\">\n\
-               <div id=\"chart\"></div>\n\
-               <div id=\"chart_distro\"></div>\n\
-       </div>\n\
-       <div id=\"details\">\n\
-               <em>PPA</em>: \n\
-               <a href=\"index.html\">\n\
-               <span id=\"ppa_owner\">N/A</span>/\n\
-               <span id=\"ppa_name\">N/A</span>\n\
-               </a>\n\
-\n\
-               <div id=\"distros\"><em>Distros:</em></div>\n\
-               <div id=\"versions\"><em>Versions:</em></div>\n\
-       </div>"
+static char *pkg_body;
 
 #define HTML_VERSION_TEMPLATE \
 "<html>\n\
 
 #define HTML_VERSION_TEMPLATE \
 "<html>\n\
@@ -173,6 +157,20 @@ static const char *get_ppa_body()
        return ppa_body;
 }
 
        return ppa_body;
 }
 
+static const char *get_pkg_body()
+{
+       const char *path;
+
+       if (!pkg_body) {
+               path = DEFAULT_WWW_DIR"/pkg.tpl";
+               pkg_body = file_get_content(path);
+
+               if (!pkg_body)
+                       log_err("Failed to read package template: %s", path);
+       }
+
+       return pkg_body;
+}
 
 static struct json_object *date_to_json(struct tm *tm)
 {
 
 static struct json_object *date_to_json(struct tm *tm)
 {
@@ -494,6 +492,13 @@ pkg_to_html(struct ppa_stats *ppa, struct package_stats *pkg, const char *dir)
 {
        char *path, *json_path, *script;
        json_object *json;
 {
        char *path, *json_path, *script;
        json_object *json;
+       const char *body;
+
+       body = get_pkg_body();
+       if (!body) {
+               log_err("Failed to create package page: %s", pkg->name);
+               return ;
+       }
 
        json_path = path_new(dir, pkg->name, ".json");
        json = pkg_to_json(ppa, pkg);
 
        json_path = path_new(dir, pkg->name, ".json");
        json = pkg_to_json(ppa, pkg);
@@ -512,7 +517,7 @@ pkg_to_html(struct ppa_stats *ppa, struct package_stats *pkg, const char *dir)
 
        log_debug(_("generating %s"), path);
 
 
        log_debug(_("generating %s"), path);
 
-       create_html(path, pkg->name, HTML_PKG_TEMPLATE, script);
+       create_html(path, pkg->name, body, script);
        free(path);
        free(script);
 }
        free(path);
        free(script);
 }
diff --git a/src/str.c b/src/str.c
new file mode 100644 (file)
index 0000000..bd53856
--- /dev/null
+++ b/src/str.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2011-2012 jeanfi@gmail.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
+ */
+
+#include <string.h>
+
+#include "str.h"
+
+char *strrep(char *str, const char *old, const char *new)
+{
+       char *p, *res;
+       int pos;
+
+       if (!str)
+               return NULL;
+
+       if (!*str || !old || !*old || !new || !strcmp(old, new))
+               return str;
+
+       p = strstr(str, old);
+
+       if (!p)
+               return str;
+
+       res = malloc(strlen(str) + (new ? strlen(new) : 0) - strlen(old) + 1);
+
+       pos = p - str;
+
+       strncpy(res, str, pos);
+       res[pos] = '\0';
+
+       if (new)
+               strcat(res + pos, new);
+
+       strcat(res, str + pos + strlen(old));
+
+       return res;
+}
+
diff --git a/src/str.h b/src/str.h
new file mode 100644 (file)
index 0000000..45839f0
--- /dev/null
+++ b/src/str.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2011-2012 jeanfi@gmail.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 _PPASTATS_STR_H_
+#define _PPASTATS_STR_H_
+
+/**
+ * Replaces the first occurence of the substring 'old' by 'new' in the
+ * string 'str'.
+ *
+ * Returns a new allocated string only if an occurence is found.
+ */
+char *strrep(char *str, const char *old, const char *new);
+
+#endif
index 9753322..466b5be 100644 (file)
@@ -2,4 +2,16 @@ check-local: checkpatch.pl
        find $(top_srcdir)/src -name \*.c -exec $(srcdir)/checkpatch.pl --show-types -q --no-tree  -emacs -f {} \;
        find $(top_srcdir)/src -name \*.h -exec $(srcdir)/checkpatch.pl --show-types -q --no-tree  -emacs -f {} \;
 
        find $(top_srcdir)/src -name \*.c -exec $(srcdir)/checkpatch.pl --show-types -q --no-tree  -emacs -f {} \;
        find $(top_srcdir)/src -name \*.h -exec $(srcdir)/checkpatch.pl --show-types -q --no-tree  -emacs -f {} \;
 
-EXTRA_DIST = checkpatch.pl 
+EXTRA_DIST = \
+       checkpatch.pl \
+       test_strrep.c
+
+check_PROGRAMS = test-strrep
+
+AM_CPPFLAGS = -pedantic -Werror
+
+test_strrep_SOURCES = \
+       test_strrep.c \
+       ../src/str.c
+
+TESTS = test-strrep
index 55ae8f6..e8761d2 100644 (file)
@@ -33,6 +33,8 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
+check_PROGRAMS = test-strrep$(EXEEXT)
+TESTS = test-strrep$(EXEEXT)
 subdir = tests
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 subdir = tests
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -48,8 +50,23 @@ mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
-SOURCES =
-DIST_SOURCES =
+am_test_strrep_OBJECTS = test_strrep.$(OBJEXT) str.$(OBJEXT)
+test_strrep_OBJECTS = $(am_test_strrep_OBJECTS)
+test_strrep_LDADD = $(LDADD)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(test_strrep_SOURCES)
+DIST_SOURCES = $(test_strrep_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors = \
+red=; grn=; lgn=; blu=; std=
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -172,10 +189,19 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-EXTRA_DIST = checkpatch.pl 
+EXTRA_DIST = \
+       checkpatch.pl \
+       test_strrep.c
+
+AM_CPPFLAGS = -pedantic -Werror
+test_strrep_SOURCES = \
+       test_strrep.c \
+       ../src/str.c
+
 all: all-am
 
 .SUFFIXES:
 all: all-am
 
 .SUFFIXES:
+.SUFFIXES: .c .o .obj
 $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
 $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
@@ -206,12 +232,194 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
+
+clean-checkPROGRAMS:
+       -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS)
+test-strrep$(EXEEXT): $(test_strrep_OBJECTS) $(test_strrep_DEPENDENCIES) $(EXTRA_test_strrep_DEPENDENCIES) 
+       @rm -f test-strrep$(EXEEXT)
+       $(LINK) $(test_strrep_OBJECTS) $(test_strrep_LDADD) $(LIBS)
+
+mostlyclean-compile:
+       -rm -f *.$(OBJEXT)
+
+distclean-compile:
+       -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_strrep.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@   $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@   $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+str.o: ../src/str.c
+@am__fastdepCC_TRUE@   $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT str.o -MD -MP -MF $(DEPDIR)/str.Tpo -c -o str.o `test -f '../src/str.c' || echo '$(srcdir)/'`../src/str.c
+@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/str.Tpo $(DEPDIR)/str.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='../src/str.c' object='str.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o str.o `test -f '../src/str.c' || echo '$(srcdir)/'`../src/str.c
+
+str.obj: ../src/str.c
+@am__fastdepCC_TRUE@   $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT str.obj -MD -MP -MF $(DEPDIR)/str.Tpo -c -o str.obj `if test -f '../src/str.c'; then $(CYGPATH_W) '../src/str.c'; else $(CYGPATH_W) '$(srcdir)/../src/str.c'; fi`
+@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/str.Tpo $(DEPDIR)/str.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='../src/str.c' object='str.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o str.obj `if test -f '../src/str.c'; then $(CYGPATH_W) '../src/str.c'; else $(CYGPATH_W) '$(srcdir)/../src/str.c'; fi`
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
 tags: TAGS
 tags: TAGS
-TAGS:
 
 
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       set x; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       shift; \
+       if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         if test $$# -gt 0; then \
+           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+             "$$@" $$unique; \
+         else \
+           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+             $$unique; \
+         fi; \
+       fi
 ctags: CTAGS
 ctags: CTAGS
-CTAGS:
-
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       test -z "$(CTAGS_ARGS)$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && $(am__cd) $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+check-TESTS: $(TESTS)
+       @failed=0; all=0; xfail=0; xpass=0; skip=0; \
+       srcdir=$(srcdir); export srcdir; \
+       list=' $(TESTS) '; \
+       $(am__tty_colors); \
+       if test -n "$$list"; then \
+         for tst in $$list; do \
+           if test -f ./$$tst; then dir=./; \
+           elif test -f $$tst; then dir=; \
+           else dir="$(srcdir)/"; fi; \
+           if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+             all=`expr $$all + 1`; \
+             case " $(XFAIL_TESTS) " in \
+             *[\ \     ]$$tst[\ \      ]*) \
+               xpass=`expr $$xpass + 1`; \
+               failed=`expr $$failed + 1`; \
+               col=$$red; res=XPASS; \
+             ;; \
+             *) \
+               col=$$grn; res=PASS; \
+             ;; \
+             esac; \
+           elif test $$? -ne 77; then \
+             all=`expr $$all + 1`; \
+             case " $(XFAIL_TESTS) " in \
+             *[\ \     ]$$tst[\ \      ]*) \
+               xfail=`expr $$xfail + 1`; \
+               col=$$lgn; res=XFAIL; \
+             ;; \
+             *) \
+               failed=`expr $$failed + 1`; \
+               col=$$red; res=FAIL; \
+             ;; \
+             esac; \
+           else \
+             skip=`expr $$skip + 1`; \
+             col=$$blu; res=SKIP; \
+           fi; \
+           echo "$${col}$$res$${std}: $$tst"; \
+         done; \
+         if test "$$all" -eq 1; then \
+           tests="test"; \
+           All=""; \
+         else \
+           tests="tests"; \
+           All="All "; \
+         fi; \
+         if test "$$failed" -eq 0; then \
+           if test "$$xfail" -eq 0; then \
+             banner="$$All$$all $$tests passed"; \
+           else \
+             if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
+             banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
+           fi; \
+         else \
+           if test "$$xpass" -eq 0; then \
+             banner="$$failed of $$all $$tests failed"; \
+           else \
+             if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
+             banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+           fi; \
+         fi; \
+         dashes="$$banner"; \
+         skipped=""; \
+         if test "$$skip" -ne 0; then \
+           if test "$$skip" -eq 1; then \
+             skipped="($$skip test was not run)"; \
+           else \
+             skipped="($$skip tests were not run)"; \
+           fi; \
+           test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+             dashes="$$skipped"; \
+         fi; \
+         report=""; \
+         if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+           report="Please report to $(PACKAGE_BUGREPORT)"; \
+           test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+             dashes="$$report"; \
+         fi; \
+         dashes=`echo "$$dashes" | sed s/./=/g`; \
+         if test "$$failed" -eq 0; then \
+           col="$$grn"; \
+         else \
+           col="$$red"; \
+         fi; \
+         echo "$${col}$$dashes$${std}"; \
+         echo "$${col}$$banner$${std}"; \
+         test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
+         test -z "$$report" || echo "$${col}$$report$${std}"; \
+         echo "$${col}$$dashes$${std}"; \
+         test "$$failed" -eq 0; \
+       else :; fi
 
 distdir: $(DISTFILES)
        @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 
 distdir: $(DISTFILES)
        @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
@@ -244,7 +452,8 @@ distdir: $(DISTFILES)
          fi; \
        done
 check-am: all-am
          fi; \
        done
 check-am: all-am
-       $(MAKE) $(AM_MAKEFLAGS) check-local
+       $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+       $(MAKE) $(AM_MAKEFLAGS) check-TESTS check-local
 check: check-am
 all-am: Makefile
 installdirs:
 check: check-am
 all-am: Makefile
 installdirs:
@@ -280,11 +489,13 @@ maintainer-clean-generic:
        @echo "it deletes files that may require special tools to rebuild."
 clean: clean-am
 
        @echo "it deletes files that may require special tools to rebuild."
 clean: clean-am
 
-clean-am: clean-generic mostlyclean-am
+clean-am: clean-checkPROGRAMS clean-generic mostlyclean-am
 
 distclean: distclean-am
 
 distclean: distclean-am
+       -rm -rf ./$(DEPDIR)
        -rm -f Makefile
        -rm -f Makefile
-distclean-am: clean-am distclean-generic
+distclean-am: clean-am distclean-compile distclean-generic \
+       distclean-tags
 
 dvi: dvi-am
 
 
 dvi: dvi-am
 
@@ -327,12 +538,13 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
+       -rm -rf ./$(DEPDIR)
        -rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
 mostlyclean: mostlyclean-am
 
        -rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
 mostlyclean: mostlyclean-am
 
-mostlyclean-am: mostlyclean-generic
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
 
 pdf: pdf-am
 
 
 pdf: pdf-am
 
@@ -346,15 +558,17 @@ uninstall-am:
 
 .MAKE: check-am install-am install-strip
 
 
 .MAKE: check-am install-am install-strip
 
-.PHONY: all all-am check check-am check-local clean clean-generic \
-       distclean distclean-generic distdir dvi dvi-am html html-am \
-       info info-am install install-am install-data install-data-am \
-       install-dvi install-dvi-am install-exec install-exec-am \
-       install-html install-html-am install-info install-info-am \
-       install-man install-pdf install-pdf-am install-ps \
-       install-ps-am install-strip installcheck installcheck-am \
-       installdirs maintainer-clean maintainer-clean-generic \
-       mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \
+.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am check-local \
+       clean clean-checkPROGRAMS clean-generic ctags distclean \
+       distclean-compile distclean-generic distclean-tags distdir dvi \
+       dvi-am html html-am info info-am install install-am \
+       install-data install-data-am install-dvi install-dvi-am \
+       install-exec install-exec-am install-html install-html-am \
+       install-info install-info-am install-man install-pdf \
+       install-pdf-am install-ps install-ps-am install-strip \
+       installcheck installcheck-am installdirs maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-compile \
+       mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
        uninstall-am
 
 check-local: checkpatch.pl
        uninstall-am
 
 check-local: checkpatch.pl
index 1d08d7b..786daba 100644 (file)
@@ -8,6 +8,7 @@ defaultwww_DATA = \
        js/jquery.jqplot.min.js\
        css/ppastats.css\
        css/jquery.jqplot.min.css\
        js/jquery.jqplot.min.js\
        css/ppastats.css\
        css/jquery.jqplot.min.css\
+       pkg.tpl\
        ppa.tpl
 
 EXTRA_DIST=$(defaultwww_DATA)
        ppa.tpl
 
 EXTRA_DIST=$(defaultwww_DATA)
index 0c2cc3c..f70e3f8 100644 (file)
@@ -213,6 +213,7 @@ defaultwww_DATA = \
        js/jquery.jqplot.min.js\
        css/ppastats.css\
        css/jquery.jqplot.min.css\
        js/jquery.jqplot.min.js\
        css/ppastats.css\
        css/jquery.jqplot.min.css\
+       pkg.tpl\
        ppa.tpl
 
 EXTRA_DIST = $(defaultwww_DATA)
        ppa.tpl
 
 EXTRA_DIST = $(defaultwww_DATA)
diff --git a/www/pkg.tpl b/www/pkg.tpl
new file mode 100644 (file)
index 0000000..1070a18
--- /dev/null
@@ -0,0 +1,15 @@
+<h1><span id="pkg_name">N/A</span></h1>
+<div id="charts">
+  <div id="chart"></div>
+  <div id="chart_distro"></div>
+</div>
+<div id="details">
+  <em>PPA</em>: 
+  <a href="index.html">
+    <span id="ppa_owner">N/A</span>/
+    <span id="ppa_name">N/A</span>
+  </a>
+
+  <div id="distros"><em>Distros:</em></div>
+  <div id="versions"><em>Versions:</em></div>
+</div>"