File:  [Public] / libwww / Library / src / HTDescpt.html
Revision 2.13: download - view: text, annotated - select for diffs
Thu May 14 02:10:22 1998 UTC (26 years ago) by frystyk
Branches: MAIN
CVS tags: repeat-requests, before_webdav, Release-5-4-0, Release-5-3-1, Release-5-2-8, Release-5-2-6, Release-5-2, Release-5-1m, HEAD, Before-New-Trace-Messages, Amaya_2_4, Amaya-6-3, Amaya-6-1, Amaya-5-2, Amaya-4-3-2, Amaya-4-3-1, Amaya-4-3, Amaya-4-1-2, Amaya-4-1-0, Amaya-4-0-0, Amaya-3-2-1, Amaya-3-2, Amaya
Changing old pub/WWW links

<HTML>
<HEAD>
<TITLE>W3C Sample Code Library libwww File descriptions</TITLE>
<!-- Changed by: Henrik Frystyk Nielsen, 23-Mar-1996 -->
</HEAD>
<BODY>

<H1>File Descriptions</H1>

<PRE>
/*
**	(c) COPYRIGHT MIT 1995.
**	Please first read the full copyright statement in the file COPYRIGH.
*/
</PRE>

Descriptions appearing in <A HREF="HTDir.html">directory listings</A>
are produced by this module. This may be overridden by another module
for those who which descriptions to come from somewhere else. It's
only HTTP directory listings that contain a description field (if
enabled by the <A HREF="HTDir.html">Directory browsing module</A>.<P>

This module is implemented by <A HREF="HTDescpt.c">HTDescpt.c</A>, and
it is a part of the <A HREF="http://www.w3.org/Library/"> W3C
Sample Code Library</A>.

<PRE>
#ifndef HTDESCRIPT_H
#define HTDESCRIPT_H

</PRE>

<H2>Description File</H2>

This module gets descriptions from the file defined by global variable
<CODE>HTDescriptionFile</CODE> in the same directory as the directoy
to be listed. The default value is <CODE>.www_descript</CODE>:

<PRE>
extern char * HTDescriptionFile;
</PRE>

In the description file lines starting with a word starting with 'D'
are taken to be descriptions (this looks funny now, but this is to
make it easy to extend these description files to contain also other
information. An example of the format of the description file is:

<PRE>
/*
**	DESCRIBE  welcome.html	Our welcome page
**	DESCRIBE  map*.gif	Map as a GIF image
**	DESCRIBE  map*.ps	Map as a PostScript image
*/
</PRE>

<H2>HTML Titles</H2>

If description is not specified for a file that is of type
<CODE>text/html</CODE>, this module uses the HTML TITLE as the
description.  This feature can be turned off by setting the
<CODE>HTPeekTitles</CODE> variable to false.

<PRE>
extern BOOL HTPeekTitles;
</PRE>

<H2>Read Description File</H2>

The description file for a directory is read in only once by
<CODE>HTReadDescriptions()</CODE>, and the result returned by it is
given as an argument when finding out a description for a single file.

<PRE>
extern HTList * HTReadDescriptions (char * dirname);
</PRE>

<H2>Get Description For a File</H2>

Once description file has been read and the list of descriptions is
returned by <CODE>HTReadDescriptions()</CODE>, the function
<CODE>HTGetDescription()</CODE> can be used to get a description for a
given file:

<PRE>
extern char * HTGetDescription (HTList *	descriptions,
				       char *	dirname,
				       char *	filename,
				       HTFormat	format);
</PRE>

Directory name has to be present because this function may then take a
peek at the file itself (to get the HTML TITLE, for example).
If <CODE>format</CODE> is <CODE>WWW_HTML</CODE> and description is not
found, this module may be configured to use the HTML TITLE as the
description. <P>

<STRONG>No string returned by this function should be freed!</STRONG>


<H2>Freeing Descriptions</H2>

Once descriptions have been gotten, the description list returned by
<CODE>HTReadDescriptions()</CODE> must be freed by
<CODE>HTFreeDescriptions()</CODE>:
<PRE>
extern void HTFreeDescriptions (HTList * descriptions);
</PRE>

<PRE>
#endif /* !HTDESCRIPT_H */
</PRE>

<HR>
<ADDRESS>
@(#) $Id: HTDescpt.html,v 2.13 1998/05/14 02:10:22 frystyk Exp $
</ADDRESS>
</BODY>
</HTML>

Webmaster