File: HTDirBrw.html

package info (click to toggle)
cern-httpd 3.0A-1
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 5,392 kB
  • ctags: 6,554
  • sloc: ansic: 37,902; makefile: 1,746; perl: 535; csh: 167; sh: 143
file content (151 lines) | stat: -rw-r--r-- 4,648 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<HTML>
<HEAD>
<TITLE>Directory Browsing</TITLE>
</HEAD>
<BODY>
<H1>Directory Browsing</H1>
<PRE>#ifndef HTDIRBRW_H
#define HTDIRBRW_H

#include "HTFTP.h"
</PRE>

This module is a part of the <A HREF="Overview.html">CERN Common WWW Library</A>.
 
<H2>Controlling globals</H2>
These flags control how directories and files are represented as hypertext,
and are typically set by the application from command line options, etc.

<H3>Access Level of Directory Listing</H3>
<PRE>
extern int HTDirAccess;		                   /* Directory access level */
#define HT_DIR_FORBID 		0	             /* Altogether forbidden */
#define HT_DIR_SELECTIVE	1	     /* If HT_DIR_ENABLE_FILE exists */
#define HT_DIR_OK		2	          /* Any accesible directory */
#define HT_DIR_ENABLE_FILE	".www_browsable"    /* If exists, can browse */
</PRE>

<H3>Show a README file in the Listings?</H3>
<PRE>
extern int HTDirReadme;			 /* List a file in the dir listings? */
#define HT_DIR_README_NONE	0	                               /* No */
#define HT_DIR_README_TOP	1	                       /* Yes, first */
#define HT_DIR_README_BOTTOM	2	                  /* Yes, at the end */
#define HT_DIR_README_FILE	"README"
</PRE>

<H3>Show additional info in the Listings?</H3>

This might be the welcome message when using FTP etc.

<PRE>
extern int HTDirInfo;
#define HT_DIR_INFO_NONE	0	                               /* No */
#define HT_DIR_INFO_TOP		1	                       /* Yes, first */
#define HT_DIR_INFO_BOTTOM	2	                  /* Yes, at the end */
</PRE>

<H3>What Should the Listings Look Like?</H3>
Make a full mask by adding/oring the following flags: 

<PRE>
extern unsigned int HTDirShowMask;
typedef enum _HTDirShow {
    HT_DIR_SHOW_ICON  = 0x1,		                /* Show icons yes/no */
    HT_DIR_SHOW_MODE  = 0x2,		          /* Show permissions yes/no */
    HT_DIR_SHOW_NLINK = 0x4,		      /* Show number of links yes/no */
    HT_DIR_SHOW_OWNER = 0x8,		           /* Show owner name yes/no */
    HT_DIR_SHOW_GROUP = 0x10,			   /* Show group name yes/no */
    HT_DIR_SHOW_SIZE  = 0x20,	          /* Show file size using K, M and G */
    HT_DIR_SHOW_DATE  = 0x40,		                 /* Show date yes/no */
    HT_DIR_SHOW_HID   = 0x80,		         /* Show hidden files yes/no */
    HT_DIR_SHOW_SLINK = 0x200,      /* Show Symbolic links in italics yes/no */
    HT_DIR_ICON_ANCHOR= 0x400,	           /* Use icon OR filename as anchor */
    HT_DIR_SHOW_CASE  = 0x800,	      /* Sort case sensitive when string key */
    HT_DIR_KEY_SIZE   = 0x1000,	       	       /* Those are the sorting keys */
    HT_DIR_KEY_DATE   = 0x2000,
    HT_DIR_KEY_NAME   = 0x4000
    /* HT_DIR_KEY_TYPE   = 0x8000 not implemented yet!!! */
} HTDirShow;
</PRE>

<H3>How long can filenames be</H3>
The filename column varies within the boundaries specified as global
variables in HTDirBrw.c; filenames greated than
<CODE>HTDirMaxFileLength</CODE> will be truncated:
<PRE>
extern int HTDirMaxFileLength;
extern int HTDirMinFileLength;
</PRE>

<H3>Show byte count for small files</H3>
By default the size for files smaller than 1K will be shown as 1K.
If the global variable <CODE>HTDirShowBytes</CODE> is set to true,
they will be shown as bytes.
<PRE>
extern BOOL HTDirShowBytes;
</PRE>

<H3>Descriptions</H3>

The <CODE>HTDirDescriptions</CODE> flag, if true, causes
<CODE>Description</CODE> field to be added as the last column in the
listing.  File descriptions are queried from the <A
HREF="HTDescript.html"><CODE>HTDescript</CODE> module</A>.  The
maximum length of this field is specified by
<CODE>HTDirMaxDescrLength</CODE>.
<PRE>
extern BOOL HTDirDescriptions;
extern int HTDirMaxDescrLength;
</PRE>

<H3>Functions for directory browsing on local UNIX system</H3>

<PRE>
extern int HTBrowseDirectory PARAMS((
		HTRequest *  	req,
		char *		directory));
</PRE>

<H3>Functions for directory browsing from other sources</H3>

This is a pseudo stat file structure used for all other systems:

<PRE>
typedef struct _dir_file_info {
    char *		f_name;
    long 		f_mode;
    int			f_nlink;
    char *		f_uid;
    char *		f_gid;
    unsigned long	f_size;
    time_t		f_mtime;
} dir_file_info;
</PRE>

<H2>Where do FTP Directory Listings get input?</H2>
This function fills out the EntryInfo file structure and should return:

<UL>
<LI>HT_INTERRUPTED if Interrupted
<LI>0 if EOF
<LI>1 if succes and more to read
</UL>

<PRE>
typedef int (*HTDirLineInput) PARAMS((HTNetInfo *, dir_file_info *));
</PRE>

<PRE>
extern int HTFTPBrowseDirectory PARAMS((
		HTRequest * 	req,
		char *		directory,
		HTDirLineInput  input));
</PRE>

<PRE>
#endif /* HTDIRBRW */
</PRE>
end
</BODY>
</HTML>