htdig: Quick and ugly patch for SSI support


jivko@ijs.com
Tue, 24 Nov 1998 15:23:24 -0800


Hi,

As I was trying to add some rotating banners to the htsearch output and
because Apache does not parse CGI scripts' output for SSI tags I had to
make some changes to htsearch so that it would run the SSI scripts instead.

Before I did that I checked in the mailing list archives and although I did
not find solution to the problem I discovered that other people were trying
to do deal with the same problem.

The code is real ugly but does the job if one is careful. I am posting it
here in case anyone would want to give it a try and hope that it would not
end up in the official release of htdig the way it is :-)))

(To make use of it simply replace Display::displayParsedFile() in
Display.cc with the code below)

Jivko

===========================================
Display::displayParsedFile(char *filename)
{
    FILE *fl = fopen(filename, "r");
    char buffer[1000];
    char *chp;
    char c_cmd[1000];

    while (fl && fgets(buffer, sizeof(buffer), fl))
    {
        // 11/23/98: Jivko patches the code to kind of support SSI
        if(memcmp(buffer,"<!--#exec cgi=",14)==0)
        {
          chp=strchr(buffer+14,' '); // find the end of the script's name
          if(chp)
          {
              *chp=0;
              sprintf(c_cmd,"./%s",buffer+14);
              fflush(NULL);
              system(c_cmd);
          }
        }
        else
        expandVariables(buffer);
    }
    if (fl)
        fclose(fl);
}

----------------------------------------------------------------------
To unsubscribe from the htdig mailing list, send a message to
htdig-request@sdsu.edu containing the single word "unsubscribe" in
the body of the message.



This archive was generated by hypermail 2.0b3 on Sat Jan 02 1999 - 16:28:52 PST