Introduction
Introduction Statistics Contact Development Disclaimer Help
sort table with types and extensions alphabetically by extension - gopher-valid…
git clone git://git.codemadness.org/gopher-validator
Log
Files
Refs
README
LICENSE
---
commit d2d0e95268db4d42a56e0b8967af42b146a3a7e3
parent d9abe6e45e708f965778fba7a66e56300fc0b814
Author: Hiltjo Posthuma <[email protected]>
Date: Fri, 18 Feb 2022 14:27:16 +0100
sort table with types and extensions alphabetically by extension
Diffstat:
M gopher-validator.c | 77 ++++++++++++++++-------------…
1 file changed, 40 insertions(+), 37 deletions(-)
---
diff --git a/gopher-validator.c b/gopher-validator.c
@@ -36,54 +36,57 @@ struct visited {
};
/* check valid types with extension in path */
-struct {
- const char *ext;
- const char *allow;
-} types [] = {
+struct gophertype {
+ const char *ext; /* filename extension */
+ const char *allow; /* allowed types for this extension */
+};
+
+/* must be sorted alphabetically by extension */
+struct gophertype types[] = {
+ { .ext = "asc", "0" },
+ { .ext = "avi", "9" },
+ { .ext = "bz2", "9" },
+ { .ext = "c", "0" },
+ { .ext = "dcgi", "17" },
+ { .ext = "doc", "9" },
+ { .ext = "exe", "9" },
+ { .ext = "gif", "gI" },
+ { .ext = "go", "0" },
+ { .ext = "gph", "1" },
+ { .ext = "gz", "9" },
+ { .ext = "h", "0" },
+ { .ext = "htm", "0h" },
+ { .ext = "html", "0h" },
+ { .ext = "iso", "9" },
+ { .ext = "jpeg", "I" },
+ { .ext = "jpg", "I" },
+ { .ext = "json", "0" },
+ { .ext = "lzma", "9" },
+ { .ext = "m3u", "0" },
+ { .ext = "md", "0" },
{ .ext = "md5", "0" },
{ .ext = "md5sum", "0" },
+ { .ext = "mkv", "9" },
+ { .ext = "mp3", "9" },
+ { .ext = "mp4", "9" },
+ { .ext = "ogg", "9" },
+ { .ext = "ogv", "9" },
+ { .ext = "pdf", "9" },
+ { .ext = "png", "I" },
+ { .ext = "rss", "0" },
+ { .ext = "sh", "0" },
{ .ext = "sha1", "0" },
{ .ext = "sha1sum", "0" },
{ .ext = "sha256", "0" },
{ .ext = "sha256sum", "0" },
{ .ext = "sha512", "0" },
{ .ext = "sha512sum", "0" },
- { .ext = "asc", "0" },
- { .ext = "rss", "0" },
- { .ext = "xml", "0" },
- { .ext = "txt", "0" },
- { .ext = "json", "0" },
- { .ext = "md", "0" },
- { .ext = "c", "0" },
- { .ext = "h", "0" },
- { .ext = "sh", "0" },
- { .ext = "go", "0" },
{ .ext = "srt", "0" },
- { .ext = "m3u", "0" },
- { .ext = "htm", "0h" },
- { .ext = "html", "0h" },
- { .ext = "gph", "1" },
- { .ext = "dcgi", "17" },
- { .ext = "gif", "gI" },
- { .ext = "jpg", "I" },
- { .ext = "jpeg", "I" },
- { .ext = "png", "I" },
- { .ext = "doc", "9" },
- { .ext = "pdf", "9" },
- { .ext = "iso", "9" },
- { .ext = "exe", "9" },
- { .ext = "gz", "9" },
{ .ext = "tgz", "9" },
- { .ext = "bz2", "9" },
- { .ext = "xz", "9" },
- { .ext = "lzma", "9" },
+ { .ext = "txt", "0" },
{ .ext = "wav", "9" },
- { .ext = "mp3", "9" },
- { .ext = "ogg", "9" },
- { .ext = "avi", "9" },
- { .ext = "mp4", "9" },
- { .ext = "mkv", "9" },
- { .ext = "ogv", "9" },
+ { .ext = "xml", "0" },
+ { .ext = "xz", "9" },
};
int exitcode = 0;
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.