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