]> Joshua Wise's Git repositories - netwatch.git/blobdiff - net/http/fs.c
Hit paging to clean it up a bit. Add a reboot button.
[netwatch.git] / net / http / fs.c
index 9e6358d627632bbef54410f5047402402164764a..54c5bd95fbdb4104b6b5d11e917f4fc11b42c368 100644 (file)
 #include "fs.h"
 #include "fsdata.h"
 #include "fsdata.c"
+#include <io.h>
 
 /*-----------------------------------------------------------------------------------*/
 
-void fill_regs(struct fs_file *file)
+void handle_regs(struct fs_file *file)
 {
   static unsigned char buf[2048];
   
@@ -63,7 +64,14 @@ void fill_regs(struct fs_file *file)
     
   
   file->data = buf;
-  file->len = strlen(buf);
+  file->len = strlen(buf)-1;
+}
+
+void handle_reboot(struct fs_file *file)
+{
+  outb(0xCF9, 0x4);
+  file->data = "So long!";
+  file->len = 8;
 }
 
 
@@ -76,7 +84,12 @@ fs_open(const char *name, struct fs_file *file)
   /* /registers.html is CGI */
   if (!strcmp(name, "/registers.html"))
   {
-    fill_regs(file);
+    handle_regs(file);
+    return 1;
+  }
+  if (!strcmp(name, "/reboot"))
+  {
+    handle_reboot(file);
     return 1;
   }
 
@@ -85,7 +98,7 @@ fs_open(const char *name, struct fs_file *file)
       f = f->next) {
     if (!strcmp(name, (const char*)f->name)) {
       file->data = f->data;
-      file->len = f->len;
+      file->len = f->len-1;
       return 1;
     }
   }
This page took 0.023858 seconds and 4 git commands to generate.