File:  [Public] / libwww / Library / src / HTHome.html
Revision 2.14: download - view: text, annotated - select for diffs
Thu May 14 02:10:33 1998 UTC (26 years ago) by frystyk
Branches: MAIN
CVS tags: Release-5-2, Release-5-1m, HEAD
Changing old pub/WWW links

<HTML>
<HEAD>
  <!-- Changed by: Henrik Frystyk Nielsen, 16-Jul-1996 -->
  <TITLE>W3C Sample Code Library libwww Home Page Management</TITLE>
</HEAD>
<BODY>
<H1>
  Home Page Management
</H1>
<PRE>
/*
**	(c) COPYRIGHT MIT 1995.
**	Please first read the full copyright statement in the file COPYRIGH.
*/
</PRE>
<P>
This module provides some "<I>make life easier</I>" functions in order to
get the application going. The functionality of this module was originally
in <A HREF="HTAccess.html">HTAccess</A>, but now it has been moved here as
a part of the <A HREF="WWWApp.html">application interface</A> where the
application <EM>may</EM> use it if desired.
<P>
This module is implemented by <A HREF="HTHome.c">HTHome.c</A>, and it is
a part of the <A HREF="http://www.w3.org/Library/"> W3C Sample Code
Library</A>.
<PRE>
#ifndef HTHOME_H
#define HTHOME_H
#include "WWWLib.h"
</PRE>
<P>
The <I>home page </I>is special in that this is is the first page to visit
when &nbsp;a client application starts up. Note that a home page is a generic
URL and hence can be any resouce - not only resources on the local file system.
<H2>
  Personal Home Page
</H2>
<PRE>#define LOGICAL_DEFAULT 	"WWW_HOME"    /* Defined to be the home page */

#ifndef PERSONAL_DEFAULT
#define PERSONAL_DEFAULT 	"WWW/default.html"	/* in home directory */
#endif

/* If the home page isn't found, use this file: */
#ifndef LAST_RESORT
#define LAST_RESORT		"http://www.w3.org/"
#endif
</PRE>
<H2>
  Home Page for Remote Access
</H2>
<P>
Some Web applications can also be run remotely - for example as a telnet
login shell. The Line Mode Browser is an example of such an application.&nbsp;In
that case, the home page is often more generic than a personal home page.
<PRE>
/* If one telnets to an access point it will look in this file for home page */
#ifndef REMOTE_POINTER
#define REMOTE_POINTER 		 "/etc/www-remote.url"	    /* can't be file */
#endif

/* and if that fails it will use this. */
#ifndef REMOTE_ADDRESS
#define REMOTE_ADDRESS  	"http://www.w3.org/"	    /* can't be file */
#endif

#ifndef LOCAL_DEFAULT_FILE
#define LOCAL_DEFAULT_FILE 	"/usr/local/lib/WWW/default.html"
#endif
</PRE>
<H2>
  Get an Anchor for the Home Page
</H2>
<P>
Getting an anchor for the <I>home page</I> involves looking for the (environment)
variables described in the section above. As this is something that almost
all client applications must do then we provide some simple methods that
do the work for you.
<PRE>
extern HTParentAnchor * HTHomeAnchor (void);
</PRE>
<H2>
  <A NAME="temp">Create a New Anchor for Temporary Local Files</A>
</H2>
<P>
When the user starts writing a new document, the client application should
create a new anchor which can contain the document while it is created. This
can also be the location for backups and for security "auto-save" functionality.
This functions creates a new anchor with a URL pointing to the temporary
location defined by this user profile and returns that anchor.
<PRE>
extern HTParentAnchor * HTTmpAnchor (HTUserProfile * up);
</PRE>
<H2>
  Get The Current Directory in URL form
</H2>
<P>
Creates a local file URL that can be used as a relative name when calling
expanding other URLs relative to the current location in the local file system
tree where the application is running. The code for this routine originates
from the Line Mode Browser and was moved here by <EM>howcome@w3.org</EM>
in order for all clients to take advantage.
<PRE>
#define HTFindRelatedName	HTGetCurrentDirectoryURL
extern char *  HTGetCurrentDirectoryURL (void);
</PRE>
<H2>
  <A NAME="Trace">Handle Library Trace Messages</A>
</H2>
<P>
Standard interface to libwww <A HREF="HTUtils.html#Debug">TRACE messages</A>.
Pass this function a string of characters and it will set up the appropriate
TRACE flags. The shortnames for the trace messages are not as intuitive as
they could be :-(. The string must be null terminated
<PRE>
extern int HTSetTraceMessageMask (const char * shortnames);
</PRE>
<PRE>
#endif /* HTHOME_H */
</PRE>
<P>
  <HR>
<ADDRESS>
  @(#) $Id: HTHome.html,v 2.14 1998/05/14 02:10:33 frystyk Exp $
</ADDRESS>
</BODY></HTML>

Webmaster