A Real-time Weather Station
by Richard M. Smith

Listing One
[configuration]
console=local           ; Use the local console
filesystem=local        ; Use the local file system
configdir=\config       ; Where the .INI files live
bindir=\bin             ; Where the programs live

[logging]
logdir=\logfiles            ; Logging directory
logflags=0x0000_0003        ; Logging flags
logflush=no                 ; Don't flush the log file each write

[drivers]
eth-drv.drv                 ; Ethernet driver

[start]
microweb.dll

Listing Two
/* WWWHELLO.C - World Wide Web "Hello world" program */
/* Copyright (C) 1996 Phar Lap Software, Inc. */

#define IMPORT __declspec(dllimport)
#define EXPORT __declspec(dllexport)

/* Standard C includes */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <malloc.h>
#include <time.h>
#include <sys\stat.h>

/* Other includes */
#include <windows.h>
#include <pltypes.h>
#include <httpserv.h>
#include <html.h>
#include <htmlform.h>
#include <htmlpage.h>
#include <htmlnew.h>

/*  Table of HTML debug pages which are generated on the fly  */
BOOL __cdecl index_htm(REQ_INPUTS *pInp, REQ_OUTPUTS *pOutp);
PAGE_ENT hello_page_table[] =
{
"",     (void *)index_htm,  "",
"index.htm",    (void *)index_htm,  "",
NULL
};

/* jump vector */
WEBSERVE_JMPV JMPV_NAME =
{
   JMPV_COUNT,
    NULL,
    NULL,
    hello_page_table
};

/* index_htm - Main HTML page for the "Hello world" program */
BOOL __cdecl index_htm(REQ_INPUTS *pInp, REQ_OUTPUTS *pOutp)
{
    static int hits = 0;
    char buff[512];
    /* Open an empty HTML document */
    if(!hpg_CreatePage(pOutp))
        return FALSE;
    /* Start off with the HTML header */
    html_tag("<title>");
    html_text("\"The World's Simplest Web Server\"");
    html_tag("</title>\n");
    html_tag("<h3>");
    html_text("\"The World's Simplest Web Server\"");
    html_tag("</h3>\n");
    html_tag("<hr>\n");
    html_tag("</head>\n");
    html_tag("<body>\n");
    /* Now provide some information about this page and the server */
    html_tag("<b>");
    html_text("Hello world....");
    html_tag("</b>");
    html_tag("<br>\n");
    html_tag("<pre>\n");
    html_text("Hits for this page:  %d\n", ++hits);
    _strtime(buff);
    html_text("Current time:        %s\n", buff);
    _strdate(buff);
    html_text("Current date:        %s\n", buff);
    html_tag("</pre>\n");
    /* All done -- return with the HTML page */
    html_tag("<hr>\n");
    return hpg_DoneNotCachedPage(pOutp);
}

Listing Three
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; 
charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage 2.0">
<title>Daily Weather Readings</title>
</head>
<body bgcolor="#FFFFFF">

<h3>
Daily Weather Readings for 
<!-- #field location -->
</h3>

<h4>
<!-- #field date -->
<!-- #field attime -->
<!-- #field time -->
</h4>
<hr>
<p>
<!-- #field table -->
</p>
<table border="0" cellpadding="5">
<tr>
<td>
<form action="../../" method="GET">
<p><input type="submit" value="Home"></p>
</form>
</td>
<td>
<!-- #field units_button -->
</td>
</tr>
</table>

</body>
</html>

Listing Four
[eth-ne2k]
port=auto                      ; I/O port number (or auto)
irq=11                         ; IRQ (or auto)
ethernetaddr=00:00:00:00:00:00 ; 6 byte Ethernet address
ipaddr=192.107.36.250          ; IP address (or bootp or rarp)
subnetmask=255.255.255.0       ; Subnet mask (or bootp)

Listing Five
[Winsock]
numsockets=50                  ; Number of active TCP sockets 
gatewayaddr=192.107.36.11      ; Gateway IP address
bootp=no                       ; Use Bootp protocol for IP addresses
dnsserveraddr=192.107.36.9     ; DNS server IP address
dnsretries=default             ; Number of DNS retries
dnsretrywait=default           ; Wait time for DNS retry

Listing Six
[MicroWeb]
plugindir=\bin      ; Where the plugins live
htmldir=\html       ; HTML directory

[plugins]
admin=admin         ; Web server admin
fcache=fcache       ; File Cacher
security=security   ; Security plugin
ftpserv=ftp         ; FTP server
onldebug=debug      ; Online debugger
kybint3=debug       ; INT3 breakpoint from keyboard
fingserv=finger     ; Finger server
ping=ping           ; Ping
tcpip=tcpip         ; TCP/IP
htmltest=htmltest   ; HTML test
intbench=bench      ; Benchmark plugin
wsdrv.drv=wsdrv     ; Davis weather station I/O driver
weather=weather     ; Internet Weather Station software

[Website info]
host_name=      "Unknown"
title=          "MicroWeb Server"
organization=   "Phar Lap Software, Inc."
address1=       "60 Aberdeen Ave."
address2=
city=           "Cambridge"
state=          "MA"
zip=            "02138"
country=        "USA"
phone=          "(617) 661-1510"
fax=            "(617) 876-2972"
webmaster_email=    "tech-support@pharlap.com"
info_email=     "sales@pharlap.com"
www_url=        "http://www.pharlap.com"
ftp_url=        "ftp://ftp.pharlap.com"
computer_model= "PC Compatible"
stock_ticker_symbol=
copyright=      "(C) 1997 Phar Lap Software, Inc."
last_updated=   "Feb. 11, 1997"
longitude=      "71 07 37 W"
latitude=       "42 23 58 N"

[formats]
units=English       ; English units
timeformat=12ampm   ; 12 hour AM/PM time format

[Mime Types]
 .avi=video/avi
 .doc=application/msword
 .gif=image/gif
 .htm=text/html
 .html=text/html
 .jpg=image/jpeg 
 .ps=application/postscript
 .rtf=application/rtf
 .tif=image/tiff
 .txt=text/plain
 .wav=audio/wav
 .zip=application/zip
 .ocx=application/x-oleobject




5


