Re: [htdig] bug in template_map ? and alternative to changehost


Claas Hilbrecht (Claas.Hilbrecht@linum.com)
Wed, 3 Feb 1999 12:49:08 +0100


After playing around with the tips from the list I finally managed it. I
think there are several problems that caused my inital problems (file
permission, wrong names etc).

Thanks a lot for the help.

I've changed htsearch a little bit to display the host part of the url based
on "HTTP_HOST". Maybe someoneelse need this too:

In Display.cc in function void Display::displayMatch() I replaced

vars.Add("URL", new String(url));

with

    {
      char *ptr;
      char buff[4096];
      
      strcpy(buff, "Unbekannte URL");
      ptr = strstr(url, "http://");
      if(ptr)
        {
          ptr = strchr(url+sizeof("http://"), '/');
          if(ptr)
            {
              char *hostname;
              int len;

              hostname = getenv("HTTP_HOST");
              if(hostname)
                {
                  strcpy(buff, "http://");
                  strcat(buff, hostname);
                }
              else
                strcpy(buff, "http://www.linum.com");

              len = strlen(buff) + strlen(ptr);
              if(len >= (sizeof(buff)-1))
                strcpy(buff, "URL zu lang für die Anzeige.");
              else
                strcat(buff, ptr);
            }
        }
      ptr = buff;
      
      vars.Add("URL", new String(ptr));
    }

Mit freundlichem Gruss
Claas Hilbrecht

Linum Software GmbH
http://www.linum.com
Tel: 05561-971070
Fax: 05561-971071
------------------------------------
To unsubscribe from the htdig mailing list, send a message to
htdig@htdig.org containing the single word "unsubscribe" in
the SUBJECT of the message.



This archive was generated by hypermail 2.0b3 on Wed Feb 10 1999 - 17:09:05 PST