/*************************************************************************** * reg_html.c * * Fri May 20 18:14:32 2005 * Copyright 2005 User * Email ****************************************************************************/ /* * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "globals.h" void new_ext_html(char *ext, char *gisbase, char **html, int major, int minor, int revision) { int pos1, pos2, pos3; int start, end; int insert_here; char *first_char; char *last_char; char item[MAXSTR]; int len; pos1 = find_pos("Drivers sections:", html, 0); /* first go to section on "Drivers" */ if (pos1 < 0) { /* we have a new version of the HTML docs that does not have a "Drivers" section anymore */ /* let's check for the special GEM comment */ pos1 = find_pos ("", html, 0); if (pos1 < 0) { /* sorry, I can't handle these HTML docs */ print_warning ("Unknown format of index.html. Unable to register HTML man pages.\n"); return; } } pos2 = find_pos("
", html, pos1); /* the horizontal ruler marks the end of the HTML text */ if (find_pos("

Installed extensions:

", html, pos1) == -1) { /* Extensions section does not yet exist: create it now */ insert_str("

Installed extensions:

\n", pos2, html); insert_str("\n", pos2 + 2, html); insert_str("

\n", pos2 + 3, html); } start = find_pos("

Installed extensions:

", html, pos1); end = find_pos("", html, start); insert_here = start + 2; /* check if this entry already exists and if so: bail out or overwrite, if force mode */ sprintf(item, "\">%s", ext); pos3 = find_pos(item, html, insert_here); if (pos3 != -1) { /* exists: */ print_warning("list item '%s' exists in index.html.\n", ext); if ((FORCE) && (UPGRADE)) { sprintf(item, "
  • %s (%i.%i.%i)\n", ext, ext, major, minor, revision); strcpy(html[pos3], item); } return; } /* now go through all links in the Extensions section and insert this one in the right alphabetical position */ pos3 = find_pos("
  • %s (%i.%i.%i)\n", ext, ext, major, minor, revision); insert_str(item, insert_here, html); } void delete_ext_html(char *ext, char *gisbase, char **html) { int pos1, pos2, pos3; int start, end; char item[MAXSTR]; int found; int i; pos1 = find_pos("Drivers sections:", html, 0); /* first go to section on "Drivers" */ if (pos1 < 0) { /* we have a new version of the HTML docs that does not have a "Drivers" section anymore */ /* let's check for the special GEM comment */ pos1 = find_pos ("", html, 0); if (pos1 < 0) { /* sorry, I can't handle these HTML docs */ print_warning ("Unknown format of index.html. Unable to de-register HTML man pages.\n"); return; } } pos2 = find_pos("
    ", html, pos1); /* the horizontal ruler marks the end of the HTML text */ if (find_pos("

    Installed extensions:

    ", html, pos1) == -1) { /* Extensions section does not exist: bail out! */ print_warning("no extensions section found in index.html.\n"); return; } start = find_pos("

    Installed extensions:

    ", html, pos1); end = find_pos("", html, start); /* check if the entry exists and if so delete */ found = 0; sprintf(item, "\">%s", ext); pos3 = find_pos(item, html, start); if (pos3 == -1) { /* does not exist: */ print_warning("extension '%s' not listed in index.html.\n", ext); return; } /* delete item, if it was found in the extensions section */ if (pos3 < end) { delete_str(pos3, html); } end--; /* end of extensions section is no one up! */ /* if no more entries left in the extensions list: delete the entire section */ pos3 = find_pos("