Annotation of libwww/Library/src/HTDir.html, revision 2.2

2.1       frystyk     1: <HTML>
                      2: <HEAD>
2.2     ! frystyk     3: <TITLE>W3C Reference Library libwww DIRECTORY BROWSING</TITLE>
2.1       frystyk     4: <!-- Changed by: Henrik Frystyk Nielsen,  2-Oct-1995 -->
                      5: </HEAD>
                      6: <BODY>
                      7: 
                      8: <H1>Directory Browsing</H1>
                      9: 
                     10: <PRE>
                     11: /*
                     12: **     (c) COPYRIGHT MIT 1995.
                     13: **     Please first read the full copyright statement in the file COPYRIGH.
                     14: */
                     15: </PRE>
                     16: 
                     17: The directory manager generates directory listings for FTP and HTTP
                     18: requests. This module contains the protocol independent code and it
                     19: produces the HTML object. It is only included if either the <A
                     20: HREF="HTFTP.html">FTP</A> or the <A HREF="HTFile.html">File</A> module
                     21: is included. <P>
                     22: 
                     23: This module is implemented by <A HREF="HTDir.c">HTDir.c</A>, and it is
                     24: a part of the <A HREF="http://www.w3.org/pub/WWW/Library/"> W3C
                     25: Reference Library</A>.
                     26: 
                     27: <PRE>
                     28: #ifndef HTDIR_H
                     29: #define HTDIR_H
                     30: #include "HTReq.h"
                     31: #include "HTIcons.h"
                     32: </PRE>
                     33: 
                     34: <H2>What Should the Listings Look Like?</H2>
                     35: 
                     36: If the <CODE>HT_DS_DES</CODE> is set then the <EM>Description</EM>
                     37: field is added as the last column in the listing.  File descriptions
                     38: are queried from the <A HREF="HTDescpt.html">HTDescript
                     39: module</A>. Make a full mask by adding/oring the following flags:
                     40: 
                     41: <PRE>
                     42: typedef enum _HTDirShow {
                     43:     HT_DS_SIZE  = 0x1,                 /* Show file size using K, M and G? */
                     44:     HT_DS_DATE  = 0x2,                 /* Show last modified date? */
                     45:     HT_DS_HID   = 0x4,                 /* Show hidden files? */
                     46:     HT_DS_DES  = 0x8,                  /* Show descriptions? */
                     47:     HT_DS_ICON  = 0x10,                        /* Show icons? */
                     48:     HT_DS_HOTI  = 0x20                 /* Are Icons hot or cold? */
                     49: } HTDirShow;
                     50: 
                     51: typedef enum _HTDirKey {
                     52:     HT_DK_NONE = 0,                    /* No sorting */
                     53:     HT_DK_CSEN = 1,                    /* Case sensitive */
                     54:     HT_DK_CINS  = 2                    /* Case insensitive */
                     55: } HTDirKey;
                     56: </PRE>
                     57: 
                     58: <H3>Length of Filenames and Descriptions</H3>
                     59: 
                     60: The module automatically ajusts the width of the directory listing as
                     61: a function of the file name. The width can flows dynamically between
                     62: an upper and a lower limit.  The maximum length of
                     63: this field is specified by
                     64: 
                     65: <PRE>
                     66: extern BOOL HTDir_setWidth (int minfile, int maxfile);
                     67: </PRE>
                     68: 
                     69: <H2>The Directory Object</H2>
                     70: 
                     71: The directory object handles the generation of a directory listing. It
                     72: is a bit like a stream in that it accept data, but it must be
                     73: formatted in a special way which makes the normal stream architecture
                     74: inadequate.
                     75: 
                     76: <H3>Width of File Names</H3>
                     77: 
                     78: The module automatically ajusts the width of the directory listing as
                     79: a function of the file name. The width can flows dynamically between
                     80: an upper and a lower limit.
                     81: 
                     82: <PRE>
                     83: extern BOOL HTDir_setWidth (int minfile, int maxfile);
                     84: </PRE>
                     85: 
                     86: <H3>Create a Directory Object</H3>
                     87: 
                     88: Creates a structured stream object and sets up the initial HTML stuff
                     89: Returns the dir object if OK, else NULL
                     90: 
                     91: <PRE>
                     92: typedef struct _HTDir HTDir;
                     93: 
                     94: extern HTDir * HTDir_new (HTRequest * request, HTDirShow show, HTDirKey key);
                     95: </PRE>
                     96: 
                     97: <H3>Add a Line to the List</H3>
                     98: 
                     99: This function accepts a directory line. "data" and "size", and
                    100: "description" can all be NULL. Returns YES if OK, else NO
                    101: 
                    102: <PRE>
                    103: extern BOOL HTDir_addElement   (HTDir *dir, char *name, char *date,
                    104:                                 char *size, HTFileMode mode);
                    105: </PRE>
                    106: 
                    107: <H3>Free a Directory Obejct</H3>
                    108: 
                    109: If we are sorting then do the sorting and put out the list,
                    110: else just append the end of the list.
                    111: 
                    112: <PRE>
                    113: extern BOOL HTDir_free (HTDir * dir);
                    114: </PRE>
                    115: 
                    116: <PRE>
                    117: #endif /* HTDIR */
                    118: </PRE>
                    119: End of declaration
                    120: </BODY>
                    121: </HTML>

Webmaster