Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Awk > Re: GUI Awk
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 44 of 66 Topic 2142 of 2236
Post > Topic >>

Re: GUI Awk

by happytoday <ehabaziz2001@[EMAIL PROTECTED] > Feb 18, 2008 at 02:09 PM

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>&nbsp;&nbsp;"\
> "<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(/^&/,"\\&amp;",_html) =A0# replace ampersand with
ampersa=
nd a m p semicolon
> =A0 =A0 =A0 gsub(/</,"\\&lt;",_html) =A0 =A0# replace =A0 less =A0
=A0with=
 ampersand l t semicolon
> =A0 =A0 =A0 gsub(/>/,"\\&gt;",_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>&nbsp;&nbsp;<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>&nbsp;<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 did what you say I put the files in one directory like this , I got
the below error . Can I got some little and small examples ?


H:\programs\sedawk\gawki>dir
 Volume in drive H is U1_PROGRAMS
 Volume Serial Number is E010-47D8

 Directory of H:\programs\sedawk\gawki

02/16/2008  02:53 PM    <DIR>          .
02/16/2008  02:53 PM    <DIR>          ..
02/16/2008  02:57 PM             1,784 test.awk
02/19/2008  12:05 AM            11,276 lakota.awk
02/19/2008  12:00 AM               188 go.bat
02/18/2008  11:45 PM               329 httpd.conf
06/03/2001  11:00 PM           129,426 Gawkinet_310.hlp
07/05/2004  11:00 PM         1,015,128 cygiconv-2.dll
08/09/2003  11:00 PM            37,888 cygintl-2.dll
07/02/2005  11:00 PM         1,295,582 cygwin1.dll
02/19/2008  12:06 AM            10,954 lakota2.awk
               9 File(s)      2,502,555 bytes
               2 Dir(s)   5,359,321,088 bytes free

H:\programs\sedawk\gawki>go.bat


H:\programs\sedawk\gawki>gawki.exe "{gsub(/\t/,\"   \");gsub(/
**the_magic**/,\"*
*some_magic**\");print}" lakota.awk   1>lakota2.awk

H:\programs\sedawk\gawki>gawki.exe -f httpd.conf -f lakota2.awk
gawki: lakota2.awk:27:    doctype      =3D \
gawki: lakota2.awk:27:                   ^ backslash not last
character on line

H:\programs\sedawk\gawki>type lakota.hit
The system cannot find the file specified.




 66 Posts in Topic:
GUI Awk
happytoday <ehabaziz20  2008-01-25 18:37:15 
Re: GUI Awk
Janis Papanagnou <Jani  2008-01-26 12:24:26 
Re: GUI Awk
Kees Nuyt <k.nuyt@[EMA  2008-01-26 13:32:35 
Re: GUI Awk
Ted Davis <tdavis@[EMA  2008-01-26 10:40:19 
Re: GUI Awk
pgas <pierre.gaston@[E  2008-01-26 17:22:39 
Re: GUI Awk
happytoday <ehabaziz20  2008-01-26 12:13:50 
Re: GUI Awk
Cesar Rabak <csrabak@[  2008-01-26 18:45:16 
Re: GUI Awk
gazelle@[EMAIL PROTECTED]  2008-01-26 20:41:37 
Re: GUI Awk
"rex" <rex@[  2008-01-29 19:15:57 
TAWK Dll (Was: GUI Awk)
gazelle@[EMAIL PROTECTED]  2008-01-30 17:03:11 
Re: GUI Awk
happytoday <ehabaziz20  2008-01-26 12:18:20 
Re: GUI Awk
happytoday <ehabaziz20  2008-01-26 15:09:21 
Re: GUI Awk
Ted Davis <tdavis@[EMA  2008-01-26 19:16:33 
Re: GUI Awk
happytoday <ehabaziz20  2008-01-26 15:15:02 
Re: GUI Awk
happytoday <ehabaziz20  2008-01-27 14:48:40 
Re: GUI Awk
Ted Davis <tdavis@[EMA  2008-01-27 18:06:50 
Re: GUI Awk
Manuel Collado <m.coll  2008-01-28 11:23:43 
Re: GUI Awk
Adrian Davis <adrian@[  2008-01-28 03:57:50 
Re: GUI Awk
ggrothendieck <ggrothe  2008-01-28 23:02:08 
Re: GUI Awk
happytoday <ehabaziz20  2008-01-29 14:04:01 
Re: GUI Awk
Juergen Kahrs <Juergen  2008-01-30 09:25:24 
Re: GUI Awk
Al <palcibiades-first@  2008-02-02 07:59:25 
Re: GUI Awk
Ted Davis <tdavis@[EMA  2008-02-02 11:17:05 
Re: GUI Awk
"Luuk" <luuk  2008-02-02 18:42:27 
Re: GUI Awk
Ted Davis <tdavis@[EMA  2008-02-02 19:20:08 
Re: GUI Awk
colin.macleod@[EMAIL PROT  2008-02-04 06:45:59 
Re: GUI Awk
gazelle@[EMAIL PROTECTED]  2008-02-04 15:33:09 
Re: GUI Awk
Adrian Davis <adrian@[  2008-02-04 08:16:45 
Re: GUI Awk
happytoday <ehabaziz20  2008-02-07 08:47:34 
Re: GUI Awk
Ted Davis <tdavis@[EMA  2008-02-07 15:25:33 
Re: GUI Awk
happytoday <ehabaziz20  2008-02-16 13:31:17 
Re: GUI Awk
Kees Nuyt <k.nuyt@[EMA  2008-02-17 00:18:27 
Re: GUI Awk
=?ISO-8859-1?Q?J=FCrgen_K  2008-02-17 11:20:42 
Re: GUI Awk
Kees Nuyt <k.nuyt@[EMA  2008-02-17 15:19:23 
Re: GUI Awk
happytoday <ehabaziz20  2008-02-08 12:27:00 
Re: GUI Awk
Ted Davis <tdavis@[EMA  2008-02-08 15:25:01 
Re: GUI Awk
happytoday <ehabaziz20  2008-02-17 08:57:24 
Re: GUI Awk
gazelle@[EMAIL PROTECTED]  2008-02-17 17:23:02 
Re: GUI Awk
=?ISO-8859-1?Q?J=FCrgen_K  2008-02-17 18:32:00 
Re: GUI Awk
happytoday <ehabaziz20  2008-02-17 13:40:53 
Re: GUI Awk
Juergen Kahrs <Juergen  2008-02-18 08:49:26 
Re: GUI Awk
Ted Davis <tdavis@[EMA  2008-02-18 08:03:46 
Re: GUI Awk
Kees Nuyt <k.nuyt@[EMA  2008-02-18 19:59:57 
Re: GUI Awk
happytoday <ehabaziz20  2008-02-18 14:09:35 
Re: GUI Awk
=?ISO-8859-1?Q?J=FCrgen_K  2008-02-19 17:57:20 
Re: GUI Awk
=?ISO-8859-1?Q?J=FCrgen_K  2008-02-19 17:58:35 
Re: GUI Awk
Kees Nuyt <k.nuyt@[EMA  2008-02-19 19:34:32 
Re: GUI Awk
happytoday <ehabaziz20  2008-02-09 12:19:53 
Re: GUI Awk
Ted Davis <tdavis@[EMA  2008-02-09 19:27:59 
Re: GUI Awk
happytoday <ehabaziz20  2008-02-21 10:56:45 
Re: GUI Awk
=?ISO-8859-1?Q?J=FCrgen_K  2008-02-21 20:29:38 
Re: GUI Awk
happytoday <ehabaziz20  2008-02-22 02:11:39 
Re: GUI Awk
Juergen Kahrs <Juergen  2008-02-22 11:59:34 
Re: GUI Awk
happytoday <ehabaziz20  2008-02-22 06:46:51 
Re: GUI Awk
=?ISO-8859-1?Q?J=FCrgen_K  2008-02-22 20:19:13 
Re: GUI Awk
happytoday <ehabaziz20  2008-02-22 12:06:45 
Re: GUI Awk
happytoday <ehabaziz20  2008-02-22 12:08:58 
Re: GUI Awk
=?ISO-8859-1?Q?J=FCrgen_K  2008-02-22 21:38:38 
Re: GUI Awk
happytoday <ehabaziz20  2008-02-22 22:31:09 
Re: GUI Awk
=?ISO-8859-1?Q?J=FCrgen_K  2008-02-23 16:11:38 
Re: GUI Awk
happytoday <ehabaziz20  2008-02-16 05:30:24 
Re: GUI Awk
=?ISO-8859-1?Q?J=FCrgen_K  2008-02-16 16:12:28 
Re: GUI Awk
Ted Davis <tdavis@[EMA  2008-02-16 10:55:43 
Re: GUI Awk
Kees Nuyt <k.nuyt@[EMA  2008-02-16 20:18:09 
MS-Windows gawk pipe support (Was Re: GUI Awk)
Manuel Collado <m.coll  2008-02-17 17:04:53 
Re: MS-Windows gawk pipe support (Was Re: GUI Awk)
gazelle@[EMAIL PROTECTED]  2008-02-17 16:55:28 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri May 16 2:17:32 CDT 2008.