/* fprintf FILE */
@@ -65,7 +67,6 @@ static const int version_major = 1;
static const int version_minor = 1;
static const size_t granularity = 1024;
-static const int max_read = 0x1000;
static const char *html_index = "index.html";
static const char *xml_sitemap = "sitemap.xml";
static const char *rss_newsfeed = "newsfeed.rss";
@@ -315,7 +316,7 @@ static void usage(void) {
"under certain conditions; see gpl.txt.\n\n");
}
-/* entry-point (shouldn't have a prototype) */
+/* Entry-point (shouldn't have a prototype.) */
int main(int argc, char **argv) {
int ac, ret;
int is_help = 0, is_invalid = 0;
@@ -375,7 +376,7 @@ int main(int argc, char **argv) {
if(is_help || !directory) {
usage();
- return is_help && !is_invalid ? EXIT_SUCCESS : EXIT_FAILURE;
+ return is_help || !is_invalid ? EXIT_SUCCESS : EXIT_FAILURE;
}
fprintf(stderr, "Changing directory to <%s>.\n", directory);
diff --git a/web/MakeIndex.link b/web/MakeIndex.link
new file mode 100644
index 0000000..2ce23fd
--- /dev/null
+++ b/web/MakeIndex.link
@@ -0,0 +1 @@
+https://github.com/neil-edelman/MakeIndex
diff --git a/web/MakeIndex.link.d b/web/MakeIndex.link.d
new file mode 100644
index 0000000..ab6b935
--- /dev/null
+++ b/web/MakeIndex.link.d
@@ -0,0 +1 @@
+The source repository is on GitHub.
diff --git a/web/Parser.html b/web/Parser.html
new file mode 100644
index 0000000..421931e
--- /dev/null
+++ b/web/Parser.html
@@ -0,0 +1,248 @@
+
+
+
+
+
+
+
+Parser
+
+
+
+
+
+Parser
+
+
+
+
+Copyright 2008, 2012 Neil Edelman, distributed under the terms of the
+GNU General Public License, see copying.txt
+
+
+Parsing of strings. '~' on a line by itself is recognised in ".newsfile.rss"
+and ".sitemap.xml" as a <head>~<body>~<tail>; there should be two of them.
+
+
+Parsed in ".index.html",
+
+
+ -
+@(content) prints content.d, or, if it is missing, index.d;
+
+ -
+@(files){} repeats for all the files in the directory the contents of the
+argument;
+
+ -
+@(htmlcontent);
+
+ -
+@(pwd){} prints the directory, the argument is the separator;
+eg, @(pwd){/};
+
+ -
+@(root){}, like @(pwd), except up instead of down;
+
+ -
+@(now) prints the date and the time in UTC.
+
+
+
+Further parsed in @(files) in ".index.html",
+
+
+ -
+@(filealt) prints Dir or File;
+
+ -
+@(filedesc);
+
+ -
+@(filehref) prints the filename or the .link;
+
+ -
+@(fileicon) prints it's .d.jpeg, or if it is not there, dir.jpeg or
+file.jpeg;
+
+ -
+@(filename) prints the file name;
+
+ -
+@(filesize) prints the file size, if it exits;
+
+ -
+@(now) prints the date and the time in UTC.
+
+
+
+Parsed in ".newsfeed.rss",
+
+
+ -
+@(date) prints the date on the news file;
+
+ -
+@(news) prints the contents of the file (as a text file);
+
+ -
+@(newsname) prints the filename of the news story;
+
+ -
+@(now) prints the date and the time in UTC;
+
+ -
+@(title) prints the second line in the .news.
+
+
+
+ - minimum standard
+ - C89/90
+ - author
+ - Neil
+ - version
+ - 1.1; 2017-03 fixed pedantic warnings; command-line improvements
+ - since
+ - 0.6; 2008-03-21
+
+
+
+Declarations
+
+
+
struct Parser
+
struct Parser
+
+See Parser.
+
+
+
+
+
+
+
struct Files
+
struct Files
+
+Dependancy on Files.
+
+
+
+
+
+
+
typedef int (*ParserWidget)(struct Files *const files, FILE *const fp)
+
typedef int (*ParserWidget)(struct Files *const files, FILE *const fp)
+
+All ParserWidgets are in Widget.c.
+
+
+
+
+
+
+Function Summary
+
+
+Return Type | Function Name | Argument List |
+
+ struct Parser * |
+ Parser |
+ char *const str |
+
+
+ void |
+ Parser_ |
+ struct Parser **const p_ptr |
+
+
+ void |
+ ParserRewind |
+ struct Parser *p |
+
+
+ int |
+ ParserParse |
+ struct Parser *p, struct Files *const f, int invisible,
+ FILE *fp |
+
+
+
+
+Function Detail
+
+
+
Parser
+
struct Parser * Parser (char *const str)
+
+ - return
+ - Creates a parser for the string, str.
+
+
+
+
+
Parser_
+
void Parser_ (struct Parser **const p_ptr)
+
+ - parameter: p_ptr
+ - A pointer to the Parser that's to be destucted.
+
+
+
+
+
ParserRewind
+
void ParserRewind (struct Parser *p)
+
+Resets the parser, p.
+
+
+
+
+
+
+
ParserParse
+
int ParserParse (struct Parser *p, struct Files *const f, int invisible,
+ FILE *fp)
+
+Parse, called recursively.
+
+
+ - parameter: f
+ - Called in the handler to ParserWidgets.
+ - parameter: invisible
+ - No output.
+ - parameter: fp
+ - Output.
+ - fixme
+ - This fn needs rewriting; messy.
+ - fixme
+ - Invisible, hack.
+
+
+
+
+
+
diff --git a/web/Parser.html.d b/web/Parser.html.d
new file mode 100644
index 0000000..2566a12
--- /dev/null
+++ b/web/Parser.html.d
@@ -0,0 +1,2 @@
+Auto-generated file that tells you how to do a .index.html,
+etc.
diff --git a/web/Recursor.html b/web/Recursor.html
new file mode 100644
index 0000000..6f8a8cc
--- /dev/null
+++ b/web/Recursor.html
@@ -0,0 +1,201 @@
+
+
+
+
+
+
+
+Recursor
+
+
+
+
+
+Recursor
+
+
+
+
+Copyright 2008, 2012 Neil Edelman, distributed under the terms of the
+GNU General Public License, see copying.txt
+
+
+Recursor is the main part of MakeIndex, a content management system that
+generates static content, (mostly index.html,) on all the directories rooted
+at the directory specified by --directory or -d. It is based on a template
+file, .index.html and .newsfeed.rss, which are changeable. Also included
+are files to summarise the directory structure for a xml site map,
+compatible with Google, and any .news for an rss feed.
+
+
+There should be an <example> directory that has a bunch of files in it. Run
+bin/MakeIndex -d example/; it should make a webpage out of the directory
+structure and .index.html, open example/index.html after running to see.
+
+
+ -
+If the .index.html file exists in the <directory>, prints <index.html>
+recursively; overwrites any index.html on all the directories rooted at
+<directory>;
+
+ -
+if the .sitemap.xml file exists in <directory>, prints (and overwrites) an
+index called sitemap.xml;
+
+ -
+if the .newsfeed.rss file exists in <directory>, prints (and overwrites)
+to newsfeed.rss all the .news files (if there are any.)
+
+
+
+ -
+Treats .d as a description of the file without the .d;
+if this is an empty text-file or a zero-byte file, it skips over this file.
+
+ -
+treats index.d as a description of the directory;
+
+ -
+treats content.d as an in-depth description of the directory,
+replacing <index.d> when in the directory;
+
+ -
+treats .d.jpg as a image that will go with the description;
+
+ -
+treats .news as a newsworthy item; the format of this file is ISO 8601
+date (YYYY-MM-DD,) next line title;
+
+ -
+treats .link as a link with the href in the file.
+
+
+
+.index.html, .sitemap.xml, .newsfeed.rss, see Parser for recognised
+symbols. Assumes '..' is the parent directory, '.' is the current directory,
+and '/' is the directory separator; works for UNIX, MacOS, and Windows. If
+this is not the case, the constants are in Files.c.
+
+
+ - minimum standard
+ - POSIX.1
+ - author
+ - Neil
+ - version
+ - 2018-03 Removed version numbers.
+ - since
+ - 1.1; 2017-03 Fixed pedantic warnings; command-line improvements.
+ 1.0; 2016-09-19 Added umask.
+ 0.8; 2013-07 Case-insensitive sort.
+ 0.7; 2012 sth.dsth.d handled properly.
+ 0.6; 2008-03-27 Made something out of an earlier work.
+ - fixme
+ - Don't have <directory> be an argument; just do it in the current.
+ - fixme
+ - Borrow Cdoc parser for the .d files.
+ - fixme
+ - Encoding is an issue; especially the newsfeed, which requires 7-bit.
+ - fixme
+ - It's not robust; eg @(files)@(files){Don't do this.}.
+ - fixme
+ - Simplify the command line arguments.
+
+
+
+Declarations
+
+
+
struct Recursor
+
struct Recursor
+
+See Recursor.
+
+
+
+
+
+
+Function Summary
+
+
+Return Type | Function Name | Argument List |
+
+ struct Recursor * |
+ Recursor |
+ const char *idx, const char *map, const char *news |
+
+
+ void |
+ Recursor_ |
+ void |
+
+
+ int |
+ RecursorGo |
+ void |
+
+
+
+
+Function Detail
+
+
+
Recursor
+
struct Recursor * Recursor (const char *idx, const char *map, const char *news)
+
+ - parameter: idx
+ - file name of the prototype index file, eg, ".index.html".
+ - parameter: map
+ - file name of the prototype map file, eg, ".sitmap.xml".
+ - parameter: news
+ - file name of the prototype news file, eg, ".newsfeed.rss".
+
+
+
+
+
Recursor_
+
void Recursor_ (void)
+
+Destructor.
+
+
+
+
+
+
+
RecursorGo
+
int RecursorGo (void)
+
+Actually does the recursion.
+
+
+
+
+
+
+
+
diff --git a/web/Recursor.html.d b/web/Recursor.html.d
new file mode 100644
index 0000000..88f92db
--- /dev/null
+++ b/web/Recursor.html.d
@@ -0,0 +1 @@
+Auto-generated documentation for the main programme.
diff --git a/web/content.d b/web/content.d
new file mode 100644
index 0000000..7ea392b
--- /dev/null
+++ b/web/content.d
@@ -0,0 +1,7 @@
+MakeIndex is a content management system that generates static
+content. Notably, I use it to make this page. It does some other
+stuff, too, like summarise the directory structure in an xml
+site map that is compatible with Google, and any .news in
+an rss feed. The source code is POSIX.1, so in
+Windows, one needs to compile it with DJGPP, MinGW,
+etc, and probably not MSVC.
diff --git a/web/index.d b/web/index.d
new file mode 100644
index 0000000..8812efb
--- /dev/null
+++ b/web/index.d
@@ -0,0 +1 @@
+Static content management system.