diff --git a/cmd.php b/cmd.php
new file mode 100644
index 0000000..d288193
--- /dev/null
+++ b/cmd.php
@@ -0,0 +1,62 @@
+ // Preamble>
+ $pageName = "CVAR Documentation for " . $program;
+ $focused = "none"; // Dock icon name to gets a border
+ require("parts/preamble.php"); // Load most of document
+?>
+
+
+ have ('cmd');
+
+ function printRow ($name, $description)
+ {
+ echo '
' . $name . ' | ' . $description . ' |
';
+ }
+
+ function printArray ($cmd_list, $program)
+ {
+ tableBoxHeader ('black', tableHeadColor);
+ tableTitle ("cmds available in " . $program, 2, tableHeadColor);
+
+ printRow ('name', 'description');
+
+ $description = '';
+ while (list (, $cmd) = each ($cmd_list)) {
+ $pos = strpos ($cmd, ' :');
+ if ($pos > 0) {
+ if ($description) {
+ printRow ($name, $description);
+ $description = '';
+ }
+ $name = trim (substr ($cmd, 0, $pos - 1));
+ } else {
+ if ($description) {
+ $description = $description . '
' . trim ($cmd);
+ } else {
+ $description = trim ($cmd);
+ }
+ }
+ }
+ if ($description) {
+ printRow ($name, $description);
+ $description = '';
+ }
+
+ tableBoxFooter ();
+ }
+
+ function printCmdlist ($program)
+ {
+ $cmd_list = file ('doc/' . $program . '-cmd.txt');
+ printArray ($cmd_list, $program);
+ }
+
+ if (strchr ($program, '.') || strchr ($program, '/') || !is_file ('doc/' . $program . '-cmd.txt')) {
+ echo 'no such program.';
+ } else {
+ printCmdlist ($program);
+ }
+?>
+
+
+ require("parts/postamble.php"); // Finish this sucker up
+?>
diff --git a/documentation.php b/documentation.php
index b1a28f6..c4c69ab 100644
--- a/documentation.php
+++ b/documentation.php
@@ -4,10 +4,8 @@
require("parts/preamble.php"); // Load most of document
?>
-cvar documentation
-
- $cvar_doc_list = array (
+ $program_list = array (
"qf-client-3dfx",
"qf-client-ggi",
"qf-client-glx",
@@ -19,7 +17,12 @@
"qf-client-x11",
"qf-server"
);
- while (list (, $cdl) = each ($cvar_doc_list)) {
+?>
+cvar documentation
+
+
+ reset ($program_list);
+ while (list (, $cdl) = each ($program_list)) {
if (is_file ('doc/' . $cdl . '-cvar.txt')) {
echo '- ';
echo '' . $cdl . '';
@@ -28,6 +31,19 @@
}
?>
+command documentation
+
+
+ reset ($program_list);
+ while (list (, $cdl) = each ($program_list)) {
+ if (is_file ('doc/' . $cdl . '-cmd.txt')) {
+ echo '- ';
+ echo '' . $cdl . '';
+ echo '
';
+ }
+ }
+?>
+
require("parts/postamble.php"); // Finish this sucker up