63 int error = snprintf(
buffer, buffer_length,
66 "<link rel=\"stylesheet\" title=\"Standard\" "
67 "type=\"text/css\" href=\"resource:internal.css\">\n"
69 if (error < 0 || error >= buffer_length)
102 int error = snprintf(
buffer, buffer_length,
103 "%s\n%s\n%s\n%s\n%s\n",
105 "span.name { display: none; }\n" :
"",
107 "span.type { display: none; }\n" :
"",
109 "span.size { display: none; }\n" :
"",
111 "span.date { display: none; }\n" :
"",
113 "span.time { display: none; }\n" :
"");
114 if (error < 0 || error >= buffer_length)
145 const char *stylesheet;
157 error = snprintf(
buffer, buffer_length,
159 "<title>%s</title>\n"
162 "\tbackground-color: #%06"PRIx32
";\n"
167 "<body id=\"dirlist\" class=\"ns-even-bg ns-even-fg ns-border\">\n"
168 "<h1 class=\"ns-border\">%s</h1>\n",
172 if (error < 0 || error >= buffer_length)
205 int error = snprintf(
buffer, buffer_length,
206 "<p><a href=\"%s\">%s</a></p>",
208 if (error < 0 || error >= buffer_length)
239 int error = snprintf(
buffer, buffer_length,
242 "\t<span class=\"name\">%s</span>\n"
243 "\t<span class=\"type\">%s</span>\n"
244 "\t<span class=\"size\">%s</span>"
245 "<span class=\"size\"></span>\n"
246 "\t<span class=\"date\">%s</span>\n"
247 "\t<span class=\"time\">%s</span>\n"
252 if (error < 0 || error >= buffer_length)
290 const char *mimetype,
long long size,
char *date,
char *time,
291 char *
buffer,
int buffer_length)
294 char size_string[100];
299 strncpy(size_string,
"",
sizeof size_string);
302 snprintf(size_string,
sizeof size_string,
"%d",
306 error = snprintf(
buffer, buffer_length,
307 "<a href=\"%s\" class=\"%s %s\">\n"
308 "\t<span class=\"name ns-border\">%s</span>\n"
309 "\t<span class=\"type ns-border\">%s</span>\n"
310 "\t<span class=\"size ns-border\">%s</span>"
311 "<span class=\"size ns-border\">%s</span>\n"
312 "\t<span class=\"date ns-border\">%s</span>\n"
313 "\t<span class=\"time ns-border\">%s</span>\n"
315 even ?
"even ns-even-bg" :
"odd ns-odd-bg",
317 name, mimetype, size_string, unit, date, time);
318 if (error < 0 || error >= buffer_length)
346 int error = snprintf(
buffer, buffer_length,
350 if (error < 0 || error >= buffer_length)
370 while (*bytesize > 1024 * 4) {
391 return (
int)bytesize;
405 const char* units[] = {
"Bytes",
"kBytes",
"MBytes",
"GBytes" };
static osspriteop_area * buffer
The buffer characteristics.
bool dirlist_generate_row(bool even, bool directory, nsurl *url, char *name, const char *mimetype, long long size, char *date, char *time, char *buffer, int buffer_length)
Generates the part of an HTML directory listing page that displays a row in the directory contents ta...
bool dirlist_generate_bottom(char *buffer, int buffer_length)
Generates the bottom part of an HTML directory listing page.
static char * dirlist_filesize_unit(unsigned long bytesize)
Obtain display units for filesize after conversion to B/kB/MB/GB, as appropriate.
bool dirlist_generate_title(const char *title, char *buffer, int buffer_length)
Generates the part of an HTML directory listing page that contains the title.
bool dirlist_generate_parent_link(const char *parent, char *buffer, int buffer_length)
Generates the part of an HTML directory listing page that links to the parent directory.
bool dirlist_generate_top(char *buffer, int buffer_length)
Generates the top part of an HTML directory listing page.
bool dirlist_generate_hide_columns(int flags, char *buffer, int buffer_length)
Generates the part of an HTML directory listing page that can suppress particular columns.
static int dirlist_filesize_calculate(unsigned long *bytesize)
Obtain display value and units for filesize after conversion to B/kB/MB/GB, as appropriate.
static int dirlist_filesize_value(unsigned long bytesize)
Obtain display value for filesize after conversion to B/kB/MB/GB, as appropriate.
bool dirlist_generate_headings(char *buffer, int buffer_length)
Generates the part of an HTML directory listing page that displays the column headings.
interface to generate HTML content for displaying directory listings.
#define DIRLIST_NO_TYPE_COLUMN
#define DIRLIST_NO_DATE_COLUMN
#define DIRLIST_NO_SIZE_COLUMN
#define DIRLIST_NO_TIME_COLUMN
#define DIRLIST_NO_NAME_COLUMN
nserror
Enumeration of error codes.
Netsurf additional integer type formatting macros.
const char * messages_get(const char *key)
Fast lookup of a message by key from the standard Messages hash.
Localised message support (interface).
colour nscolours[NSCOLOUR__COUNT]
NetSurf UI colour table.
nserror nscolour_get_stylesheet(const char **stylesheet_out)
Get a pointer to a stylesheet for nscolours.
NetSurf UI colours (interface).
NetSurf URL handling (interface).
const char * nsurl_access(const nsurl *url)
Access a NetSurf URL object as a string.
struct nsurl nsurl
NetSurf URL object.
plotter style interfaces, generic styles and style colour helpers.
#define colour_rb_swap(c)
Interface to utility string handling.
Interface to system colour values.