On Feb 17, 1:18=A0am, Kees Nuyt <k.n...@[EMAIL PROTECTED]
> wrote:
> On Sat, 16 Feb 2008 13:31:17 -0800 (PST), happytoday
<ehabaziz2...@[EMAIL PROTECTED]
> wrote:
> >On Feb 16, 9:18=A0pm, Kees Nuyt <k.n...@[EMAIL PROTECTED]
> wrote:
> >> On Sat, 16 Feb 2008 10:55:43 -0600, Ted Davis
>
> >> Yes, it's hard to find a gawk with 2way pipes for
> >> MSWindows, but there is a cygwin gawk version that does.
>
> >> It is called gawki.exe :
> >> $ gawki --version
> >> GNU Awk 3.1.1
> >> Copyright (C) 1989, 1991-2002 Free Software Foundation.
>
> >> It also supports 2way pipes to TCP / UDP ports.
>
> >> Just for fun, here is the core of an awk script for gawki
> >> that implements a webserver ("Lakota"):
>
> >> =3D=3D=3D
> >> =A0 =A0 =A0 =A0 dtsvcstart =A0 =A0=3D strftime("%Y-%m-%d %H:%M:%S")
> >> =A0 =A0 =A0 =A0 LakotaVersion =3D "2.2"
>
> >> =A0 =A0 =A0 =A0 RC["200"] =3D "Ok"
>
> [snip code]
>
> >> =A0 =A0 =A0 =A0 } # while (KeepRunning)
> >> =3D=3D=3D
>
> >> I use it as an "emergency" webserver, when Apache is down
> >> for maintenance.
> >If you run this script under windows . What are the step did
> >you take to run them under windows ?
>
> Some zealots consider that off-topic in comp.lang.awk,
> but I'll bite the bullet for the sake of awk promotion ;)
>
> The code in my previous article is just the core.
> Here is some more code.
> It sure isn't the prettiest awk code around,
> but it's legible and it works for me.
>
> All stuff below assumes a directory tree like:
> dir =A0 =A0 =A0 =A0 =A0 (files)
> ------------ =A0----------------------
> %serverroot% =A0(lakota.cmd, lakota.awk)
> =A0 =A0 =A0 =A0 bin =A0 =A0 =A0 =A0(
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 2002-10-16 23:00 =A0
=A024=
0.640 gawki.exe
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 2003-08-09 23:00 =A0 =A0
3=
7.888 cygintl-2.dll
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 2004-07-05 23:00
=A01.015.=
128 cygiconv-2.dll
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 2005-07-02 23:00
=A01.295.=
582 cygwin1.dll )
> =A0 =A0 =A0 =A0 conf =A0 =A0 =A0 (lakota.conf)
> =A0 =A0 =A0 =A0 htdocs =A0 =A0 (index.html server*.html ....)
> =A0 =A0 =A0 =A0 logs
>
> Scripts:
> - lakota.cmd
> =A0 =A0 =A0 =A0 start script
> - conf/lakota.conf
> =A0 =A0 =A0 =A0 Contains server parameters, like DocumentRoot etc.
> - lakota.awk
> =A0 =A0 =A0 =A0 The server itself, basically:
> =A0 =A0 =A0 =A0 BEGIN{
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 init
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 serverloop
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 exit 0
> =A0 =A0 =A0 =A0 }
> =A0 =A0 =A0 =A0 function getpage(){
> =A0 =A0 =A0 =A0 } and a few more functions.
> =A0 =A0 =A0 =A0 getpage supports a few Server Side Includes (SSI)
> =A0 =A0 =A0 =A0 The SSI substitution is a little ugly :-)
>
> - htdocs/index.html
> - htdocs/server-status.html
> - htdocs/server-stop.html
> =A0 =A0 =A0 =A0 (Of course I use something else than **some_magic**)
>
> Notes:
> =A0 =A0 =A0 =A0 All .html pages should conform w3c XHTML 1.0 Strict
> =A0 =A0 =A0 =A0 This post has extra long line length, but
> =A0 =A0some lines may still be wrapped by usenet
>
> =3D=3D=3D=3D=3D=3D=3D=3D
> lakota.cmd
> =3D=3D=3D=3D=3D=3D=3D=3D
> =A0 =A0 =A0 =A0 if not exist logs mkdir logs
> =A0 =A0 =A0 =A0 pushd logs
> =A0 =A0 =A0 =A0 for %%v in (request.log) do if exist %%v del %%v
> =A0 =A0 =A0 =A0 popd
> =A0 =A0 =A0 =A0 bin\gawki.exe "{gsub(/\t/,\" =A0
\");gsub(/**the_magic**/,=
\"**some_magic**\");print}" lakota.awk >htdocs\lakota.awk
> =A0 =A0 =A0 =A0 bin\gawki.exe -f conf/httpd.conf -f lakota.awk
> =A0 =A0 =A0 =A0 type lakota.hit
> =A0 =A0 =A0 =A0 sleep 5
> :Z
>
> =3D=3D=3D=3D=3D=3D=3D=3D
> conf/httpd.conf
> =3D=3D=3D=3D=3D=3D=3D=3D
> #
> ## Lakota configuration file
> ## syntax is awk
> #
> BEGIN{
> =A0 =A0 =A0 =A0 Listen =A0 =A0 =A0 =A0 =A0=3D 80
> =A0 =A0 =A0 =A0 DocumentRoot =A0 =A0=3D "htdocs"
> =A0 =A0 =A0 =A0 DirectoryIndex =A0=3D "index.html"
> =A0 =A0 =A0 =A0 CustomLog =A0 =A0 =A0 =3D "logs/access.log"
> =A0 =A0 =A0 =A0 ErrorLog =A0 =A0 =A0 =A0=3D "logs/error.log"
> =A0 =A0 =A0 =A0 RequestLog =A0 =A0 =A0=3D "logs/request.log"
> =A0 =A0 =A0 =A0 ServerAdmin =A0 =A0 =3D "webmas...@[EMAIL PROTECTED]
"
>
> }
>
> =3D=3D=3D=3D=3D=3D=3D=3D
> lakota.awk
> =3D=3D=3D=3D=3D=3D=3D=3D
> #
> # %ServerRoot%/lakota.awk Microscopic Webserver
> # uses gawki.exe (gnu awk with IP protocol extensions)
> #
> # Copyright (C) 2007,2008 by Kees Nuyt
> #
> # version history:
> # [snipped]
> #
> #% is for debugging
> #
> BEGIN{
> =A0 =A0dtsvcstart =A0 =A0=3D strftime("%Y-%m-%d %H:%M:%S")
> =A0 =A0LakotaVersion =3D "2.2"
> =A0 =A0fSetHit =A0 =A0 =A0 =3D "lakota.hit"
> =A0 =A0RS =A0=3D "\x0D"
> =A0 =A0ORS =3D "\x0D\x0A"
> =A0 =A0if (!Listen) =A0 =A0 =A0 =A0 Listen =A0 =A0 =A0 =A0 =A0=3D 80
> =A0 =A0if (!DocumentRoot) =A0 DocumentRoot =A0 =A0=3D "htdocs"
> =A0 =A0if (!DirectoryIndex) DirectoryIndex =A0=3D "index.html"
> =A0 =A0if (!CustomLog) =A0 =A0 =A0CustomLog =A0 =A0 =A0 =3D
"logs/access.l=
og"
> =A0 =A0if (!ErrorLog) =A0 =A0 =A0 ErrorLog =A0 =A0 =A0 =A0=3D
"logs/error.=
log"
> =A0 =A0if (!RequestLog) =A0 =A0 RequestLog =A0 =A0 =A0=3D
"logs/request.lo=
g"
> =A0 =A0if (!ServerAdmin) =A0 =A0ServerAdmin =A0 =A0 =3D
"webmas...@[EMAIL PROTECTED]
"
> =A0 =A0doctype =A0 =A0 =A0=3D \
> "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"
ORS ORS
> =A0 =A0hits =A0 =A0 =A0 =A0 =3D 0
> =A0 =A0if ((getline <fSetHit) >0){ # LakotaSessionsHitsBytes
> =A0 =A0 =A0 sessions =A0 =A0=3D $1 + 1
> =A0 =A0 =A0 hits =A0 =A0 =A0 =A0=3D $2 + 0
> =A0 =A0 =A0 servedbytes =3D $3 + 0
> =A0 =A0}
> =A0 =A0close(fSetHit)
> =A0 =A0RC["200"] =A0 =A0=3D "Ok"
> =A0 =A0RC["203"] =A0 =A0=3D "Not found"
> =A0 =A0httpd =A0 =A0 =A0 =A0=3D "/inet/tcp/" Listen "/0/0"
> =A0 =A0printf("%s Lakota started\n",dtsvcstart)
> =A0 =A0printf("%s Lakota started\n",dtsvcstart) >>CustomLog
> =A0 =A0printf("%s port:%s; RS:%s; ORS:%s;\n",dtsvcstart,Listen,RS,ORS)
>>C=
ustomLog
> =A0 =A0headers =3D \
> =A0 =A0 =A0 "HTTP/1.1 %s %s" ORS \
> =A0 =A0 =A0 "Server: Lakota/" LakotaVersion ORS \
> =A0 =A0 =A0 "Set-Cookie: salutation=3D\"Lakota Webserver Says Hello\";
Max=
-Age=3D\"3600\"; Version=3D\"1\"" ORS \
> =A0 =A0 =A0 "Set-Cookie: onbehalfof=3D\"" ServerAdmin "\";
Max-Age=3D\"360=
0\"; Version=3D\"1\"" ORS \
> =A0 =A0 =A0 "Connection: close" ORS \
> =A0 =A0 =A0 "Cache-control: no-cache, no-store" ORS \
> =A0 =A0 =A0 "MIME-version: 1.0" ORS \
> =A0 =A0 =A0 "Content-type: text/html" ORS
> =A0 =A0KeepRunning =3D (1 =3D=3D 1) # true
> =A0 =A0while (KeepRunning){
> =A0 =A0 =A0 print strftime("%Y-%m-%d %H:%M:%S Listen ") Listen
> =A0 =A0 =A0 rqlines =3D 0
> =A0 =A0 =A0 while ((httpd |& getline) > 0){
> =A0 =A0 =A0 =A0 =A0request =3D $0
> =A0 =A0 =A0 =A0 =A0gsub(/[[:cntrl:]]+/,"",request) =A0 # strip all
control=
chars (0x0D 0x0A leftovers etc.)
> =A0 =A0 =A0 =A0 =A0gsub(/^[[:blank:]]+/,"",request) =A0 # strip leading
=
=A0whitespace
> =A0 =A0 =A0 =A0 =A0gsub(/[[:blank:]]+$/,"",request) =A0 # strip trailing
w=
hitespace
> =A0 =A0 =A0 =A0 =A0if (request ~ /^GET /){
> =A0 =A0 =A0 =A0 =A0 =A0 delete rq =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0
=A0 =
=A0 =A0 =A0 =A0 =A0 =A0 # gawk specific
> =A0 =A0 =A0 =A0 =A0 =A0 datetime =3D strftime("%Y-%m-%d %H:%M:%S")
> =A0 =A0 =A0 =A0 =A0 =A0 URL =3D substr(request,5,index(request," HTTP/")
-=
5)
> =A0 =A0 =A0 =A0 =A0 =A0 html =3D getpage(URL) =A0 =A0 =A0 =A0 =A0 =A0
=A0 =
=A0 =A0 =A0 =A0 =A0# sets status 200 or 203, may also change KeepRunning
> =A0 =A0 =A0 =A0 =A0 =A0 contlen =3D length(html)
> =A0 =A0 =A0 =A0 =A0 =A0 loghit(URL,hits,status,contlen)
> =A0 =A0 =A0 =A0 =A0} else if ((pc =3D index(request,":")) > 2){ =A0 #
eval=
request header, hit counts
> =A0 =A0 =A0 =A0 =A0 =A0 hdrnm =3D substr(request,1,pc - 1) =A0 =A0 =A0
=A0=
=A0# header name
> =A0 =A0 =A0 =A0 =A0 =A0 hdrvl =3D substr(request,pc + 1) =A0 =A0 =A0 =A0
=
=A0 =A0# header values
> =A0 =A0 =A0 =A0 =A0 =A0 rq[hdrnm] =3D hdrvl =A0 =A0 =A0 =A0 =A0 =A0 =A0
=
=A0 =A0 =A0 =A0 =A0 # for later use =A0in pagebuilder
> =A0 =A0 =A0 =A0 =A0 =A0 if (hdrnm in hit_hnm){
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0hit_hnm[hdrnm]++
> =A0 =A0 =A0 =A0 =A0 =A0 } else {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0hit_hnm[hdrnm] =3D 1
> =A0 =A0 =A0 =A0 =A0 =A0 }
> =A0 =A0 =A0 =A0 =A0 =A0 if ((hdrnm,hdrvl) in hit_hnm_hvl){
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0hit_hnm_hvl[hdrnm,hdrvl]++
> =A0 =A0 =A0 =A0 =A0 =A0 } else {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0hit_hnm_hvl[hdrnm,hdrvl] =3D 1
> =A0 =A0 =A0 =A0 =A0 =A0 }
> =A0 =A0 =A0 =A0 =A0}
> =A0 =A0 =A0 =A0 =A0printf("%s#%05d#%03d
%s\n",datetime,hits,++rqlines,requ=
est) >>RequestLog
> =A0 =A0 =A0 =A0 =A0if ($0 ~ /^[[:cntrl:][:blank:]]*$/){ =A0 # empty line
i=
s end of request
> =A0 =A0 =A0 =A0 =A0 =A0 printf("%s %s URL:%s:",datetime,status,URL)
> =A0 =A0 =A0 =A0 =A0 =A0 printf(headers,status,RC[status]) =A0 |& httpd
> =A0 =A0 =A0 =A0 =A0 =A0 printf("Content-Length: %d%s%s",\
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0contlen,ORS,ORS) =A0 =A0 =A0 =A0 =A0 =A0
=
=A0 =A0 |& httpd
> =A0 =A0 =A0 =A0 =A0 =A0 printf("%s",html) =A0 =A0 =A0 =A0 =A0 =A0 =A0
=A0 =
=A0 |& httpd
> =A0 =A0 =A0 =A0 =A0 =A0 break
> =A0 =A0 =A0 =A0 =A0}
> =A0 =A0 =A0 }
> =A0 =A0 =A0 printf("-- \n") >>RequestLog
> =A0 =A0 =A0 printf("\n")
> =A0 =A0 =A0 fflush("") =A0 =A0 =A0 =A0 # flush ALL output buffers
> =A0 =A0 =A0 close(httpd) =A0 =A0 =A0# keep-alive not honored
> =A0 =A0 =A0 printf( "%d %d %d
LakotaSessionsHitsBytes\n",sessions,hits,ser=
vedbytes) >fSetHit
> =A0 =A0 =A0 close(fSetHit)
> =A0 =A0}
> =A0 =A0datetime =3D strftime("%Y-%m-%d %H:%M:%S")
> =A0 =A0print datetime " stopped"
> =A0 =A0print datetime " Lakota stopped" >>CustomLog
> =A0 =A0print getstat() >>CustomLog
> =A0 =A0close(CustomLog)
> =A0 =A0close(RequestLog)
> =A0 =A0exit 0}
>
> #
> ##
> #
> function loghit(_URL,_hits,_stat,_len){
> =A0 =A0printf("%s %05d %s %5d %s\n",datetime,_hits,_stat,_len,_URL)
>>Cust=
omLog
> =A0 =A0if (!(_stat in resp)){
> =A0 =A0 =A0 resp[_stat] =3D 0
> =A0 =A0 =A0 fstresp[_stat] =3D datetime
> =A0 =A0}
> =A0 =A0resp[_stat]++
> =A0 =A0lstresp[_stat] =3D datetime
>
> =A0 =A0if (!(_URL in hit)){
> =A0 =A0 =A0 hit[_URL] =3D 0
> =A0 =A0 =A0 fsthit[_URL] =3D datetime
> =A0 =A0}
> =A0 =A0hit[_URL]++
> =A0 =A0lsthit[_URL] =3D datetime
>
> =A0 =A0hits++
> =A0 =A0servedbytes +=3D _len}
>
> #
> ##
> #
> function getstat( =A0 _resp,_hits,_idx,_idy){
> =A0 =A0_resp =3D ""
> =A0 =A0for (_idx in resp){
> =A0 =A0 =A0 _resp =3D _resp \
> =A0 =A0 =A0 sprintf("<tr><td>%s </td><td align=3D\"right\">%d
</td><td>%s =
</td><td>%s </td></tr>",\
> =A0 =A0 =A0 =A0 =A0_idx,resp[_idx],fstresp[_idx],lstresp[_idx])
> =A0 =A0}
> =A0 =A0_hits =3D ""
> =A0 =A0for (_idx in hit){
> =A0 =A0 =A0 _hits =3D _hits \
> =A0 =A0 =A0 sprintf("<tr><td>%s </td><td align=3D\"right\">%d
</td><td>%s =
</td><td>%s </td></tr>",\
> =A0 =A0 =A0 =A0 =A0_idx,hit[_idx],fsthit[_idx],lsthit[_idx])
> =A0 =A0}
> =A0 =A0_hdrs =3D ""
> =A0 =A0for (_idx in hit_hnm){
> =A0 =A0 =A0 for (_idy in hit_hnm_hvl){
> =A0 =A0 =A0 =A0 =A0split (_idy,tmp,SUBSEP)
> #% =A0 =A0 =A0 =A0 print _idy "\n"
> =A0 =A0 =A0 =A0 =A0if (tmp[1] =3D=3D _idx){
> =A0 =A0 =A0 =A0 =A0 =A0 _hdrs =3D _hdrs \
> =A0 =A0 =A0 =A0 =A0 =A0 sprintf("<tr><td>%s </td><td
align=3D\"right\">%d =
</td><td>%s </td></tr>",\
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0_idx,hit_hnm_hvl[_idy],tmp[2])
> =A0 =A0 =A0 =A0 =A0}
> =A0 =A0 =A0 }
> =A0 =A0}
> =A0 =A0return \
> "<table border=3D\"1\" summary=3D\" URL
statistics\"><tr><th>URL</th><th>h=
its</th><th>first</th><th>last</th></tr>"=AD\
> _hits "</table><br />" ORS \
> "<table border=3D\"1\" summary=3D\"Response
>
statistics\"><tr><th>response</th><th>hits</th><th>first</th><th>last</th>=
<=AD/tr>"\
> _resp "</table><br />" ORS \
> "<table border=3D\"1\" summary=3D\"Header
statistics\"><tr><th>header</th>=
<th>hits</th><th>value</th></tr>"\
> _hdrs "</table><br />" ORS}
>
> #
> ##
> #
> function getpage( =A0_fHTML,_html,_lines,_line){
> =A0 =A0_fHTML =3D URL
> =A0 =A0sub(/^\//,"",_fHTML)
> =A0 =A0if (_fHTML =3D=3D ""){
> =A0 =A0 =A0 _fHTML =3D DirectoryIndex
> =A0 =A0 =A0 URL =A0 =3D "/" _fHTML
> =A0 =A0}
> =A0 =A0_fHTML =3D DocumentRoot "/" _fHTML
> =A0 =A0_lines =3D 0
> =A0 =A0while (_lines < 1){
> =A0 =A0 =A0 _html =A0=3D ""
> #% =A0 =A0 =A0printf("read:%s:",_fHTML)
> =A0 =A0 =A0 ext =3D tolower(substr(_fHTML,length(_fHTML)-3,4))
> =A0 =A0 =A0 while ((getline _line <_fHTML) >0){
> =A0 =A0 =A0 =A0 =A0_lines++
> =A0 =A0 =A0 =A0 =A0_html =3D _html _line ORS
> =A0 =A0 =A0 }
> =A0 =A0 =A0 close(_fHTML)
> =A0 =A0 =A0 if (_lines =A0< 1){
> =A0 =A0 =A0 =A0 =A0_html =3D "<html><head><title>Not
found</title></head>"=
ORS \
> "<body><h1>Page " URL " not found on the server.</h1>" ORS \
> "<p><a href=3D\"/index.html\">back home</a> "\
> "<a href=3D\"mailto:<!--#server_admin -->\">info</a></p>" ORS \
> "</body></html>"
> =A0 =A0 =A0 =A0 =A0_lines =3D 2
> =A0 =A0 =A0 =A0 =A0status =3D "203"
> =A0 =A0 =A0 } else {
> =A0 =A0 =A0 =A0 =A0status =3D "200"
> =A0 =A0 =A0 }
> =A0 =A0}
> =A0 =A0if ((ext =3D=3D "html") || (status !=3D "200")){ =A0 =A0 =A0 =A0
# =
substitutions
> =A0 =A0 =A0 while (match(_html, /<!--#[^->]*-->/)){ =A0 =A0 =A0 =A0 #
SSI =
format =A0<!--#expression -->
> =A0 =A0 =A0 =A0 =A0rawexp =A0=3D substr(_html,RSTART, RLENGTH)
> #% =A0 =A0 =A0 =A0 print "%%%" rawexp "%%%"
> =A0 =A0 =A0 =A0 =A0express =3D tolower(substr(_html,RSTART + 5, RLENGTH
- =
8))
> =A0 =A0 =A0 =A0 =A0gsub(/[[:blank:]]+/," ",express) =A0 =A0 =A0 =A0 =A0
=
=A0 =A0 # multiple spaces to single, tabs to space
> =A0 =A0 =A0 =A0 =A0gsub(/^[[:blank:]]+/,"",express) =A0 =A0 =A0 =A0 =A0
=
=A0 =A0 # strip leading whitespace
> =A0 =A0 =A0 =A0 =A0gsub(/[[:blank:]]+$/,"",express) =A0 =A0 =A0 =A0 =A0
=
=A0 =A0 # strip trailing whitespace
> =A0 =A0 =A0 =A0 =A0if =A0 =A0 =A0 =A0(express =3D=3D "server_status"){
> =A0 =A0 =A0 =A0 =A0 =A0 gsub(rawexp,getstat(),_html)
> =A0 =A0 =A0 =A0 =A0} else if (express =3D=3D "**some_magic**"){
> =A0 =A0 =A0 =A0 =A0 =A0 KeepRunning =3D (1 =3D=3D 0) =A0 # false
> =A0 =A0 =A0 =A0 =A0 =A0 print datetime " Stop command processed."
> =A0 =A0 =A0 =A0 =A0 =A0 gsub(rawexp,"Stop command processed.",_html)
> =A0 =A0 =A0 =A0 =A0} else if (express =3D=3D "server_start"){
> =A0 =A0 =A0 =A0 =A0 =A0 gsub(rawexp,dtsvcstart,_html)
> =A0 =A0 =A0 =A0 =A0} else if (express =3D=3D "server_version"){
> =A0 =A0 =A0 =A0 =A0 =A0 gsub(rawexp,LakotaVersion,_html)
> =A0 =A0 =A0 =A0 =A0} else if (express =3D=3D "server_admin"){
> =A0 =A0 =A0 =A0 =A0 =A0 gsub(rawexp,ServerAdmin,_html)
> =A0 =A0 =A0 =A0 =A0} else if (express =3D=3D "current_time"){
> =A0 =A0 =A0 =A0 =A0 =A0 gsub(rawexp,datetime,_html)
> =A0 =A0 =A0 =A0 =A0} else if (express =3D=3D "hit_count"){
> =A0 =A0 =A0 =A0 =A0 =A0 gsub(rawexp,sprintf("%05d",hits + 1),_html)
> =A0 =A0 =A0 =A0 =A0} else if (express =3D=3D "url"){
> =A0 =A0 =A0 =A0 =A0 =A0 gsub(rawexp,URL,_html)
> =A0 =A0 =A0 =A0 =A0} else {
> =A0 =A0 =A0 =A0 =A0 =A0 gsub(rawexp,"Unknow SSI expression: "
express,_htm=
l)
> =A0 =A0 =A0 =A0 =A0}
> =A0 =A0 =A0 }
> =A0 =A0} else {
> #% =A0 =A0 =A0printf("add tags:")
> =A0 =A0 =A0 gsub(/^&/,"\\&",_html) =A0# replace ampersand with
ampersa=
nd a m p semicolon
> =A0 =A0 =A0 gsub(/</,"\\<",_html) =A0 =A0# replace =A0 less =A0
=A0with=
ampersand l t semicolon
> =A0 =A0 =A0 gsub(/>/,"\\>",_html) =A0 =A0# replace =A0greater =A0with
a=
mpersand g t semicolon
> =A0 =A0 =A0 _html =3D "<html>" ORS \
> "<head><title>" _fHTML \
> "</title></head>" ORS \
> "<body>" ORS \
> "<p><a href=3D\"/index.html\">home</a> <a
href=3D\"mailto:<!--#=
server_admin -->\">info</a></p>" ORS \
> "<pre>" _html "</pre></body></html>"
> =A0 =A0}
> =A0 =A0return doctype _html
>
> }
>
> =3D=3D=3D=3D=3D=3D=3D=3D
> htdocs/index.html
> =3D=3D=3D=3D=3D=3D=3D=3D
> <html>
> =A0<head>
> =A0 <title>Lakota webserver</title>
> =A0</head>
> =A0<body>
> =A0 <h1>I'm sorry,</h1>
> =A0 <h2>the website is unavailable</h2>
> =A0 <p>This is a <a title=3D"Lakota is a microscopic webserver
implemented=
in GNU awk. Click to show the source."
> =A0href=3D"lakota.awk">Lakota</a> smoke signal to tell you that<br />
> =A0 <b>Apache is down for maintenance</b> since <small><!--#server_start
-=
-></small>.</p>
> =A0 <p><small><a href=3D"mailto:<!--#server_admin
-->">info</a></small></p=
>
> =A0 <p>
> =A0 =A0<small>
> =A0 =A0 <!--#current_time -->
> =A0 =A0 <span style=3D"color: yellow; background-color: black;
font-weight=
: bold">
> =A0 =A0 =A0<!--#hit_count -->
> =A0 =A0 </span> (<!--#url -->)
> =A0 =A0</small>
> =A0 </p>
> =A0</body>
> </html>
>
> =3D=3D=3D=3D=3D=3D=3D=3D
> htdocs/server-status.html
> =3D=3D=3D=3D=3D=3D=3D=3D
> <html>
> =A0<head>
> =A0 <title>Lakota v<!--#server_version --> webserver</title>
> =A0</head>
> =A0<body>
> =A0 <h1>Lakota v<!--#server_version --> webserver status</h1>
> =A0 =A0<a href=3D"/index.html">home</a> <a
href=3D"/server-stop.html"=
>stop</a>
> =A0 =A0<div><!--#server_status --></div>
> =A0 <p>
> =A0 =A0<small>Running <!--#server_start --> thru <!--#current_time -->
=A0=
> =A0 =A0 <span style=3D"color: yellow; background-color: black;
font-weight=
: bold">
> =A0 =A0 =A0<!--#hit_count -->
> =A0 =A0 </span> (<!--#url -->)
> =A0 =A0</small>
> =A0 </p>
> =A0</body>
> </html>
>
> =3D=3D=3D=3D=3D=3D=3D=3D
> htdocs/server-stop.html
> =3D=3D=3D=3D=3D=3D=3D=3D
> <html>
> =A0<head>
> =A0 <title>Lakota webserver terminating</title>
> =A0</head>
> =A0<body>
> =A0 <h1><a title=3D"Lakota is a microscopic webserver implemented in GNU
a=
wk"
> =A0href=3D"mailto:<!--#server_admin -->">LAKOTA</a>will terminate.</h1>
> =A0 =A0<div><!--#server_status --></div>
> =A0 =A0<div><!--#**some_magic** --></div>
> =A0 <p><small><!--#server_start --></small></p>
> =A0 <p><small><!--#current_time --> =A0<span style=3D"color: yellow;
backg=
round-color: black; font-weight:
> bold"><!--#hit_count --></span> (<!--#url -->)</small></p>
> =A0</body>
> </html>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
> Well, there it is. Good luck cutting 'n pasting.
> I'm not sure the pages validate :D
> --
> =A0( =A0Kees
> =A0 )
> c[_] Oliver's Law: Experience is something you don't get until just
after =
you need it. =A0(#514)
I may seem little stupid but I searched internet gawki.exe I did not
find it at all . Please sepcify applications needed to be downloaded
and their download URL.
Thanks


|