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 31 of 66 Topic 2142 of 2236
Post > Topic >>

Re: GUI Awk

by happytoday <ehabaziz2001@[EMAIL PROTECTED] > Feb 16, 2008 at 01:31 PM

On Feb 16, 9:18=A0pm, Kees Nuyt <k.n...@[EMAIL PROTECTED]
> wrote:
> On Sat, 16 Feb 2008 10:55:43 -0600, Ted Davis
>
>
>
>
>
> <tda...@[EMAIL PROTECTED]
> wrote:
> >On Sat, 16 Feb 2008 05:30:24 -0800, happytoday wrote:
> >> Here is the path of the GTK-server and the example in the site with
tha=
t
> >> error :
> >> H:\programs\sedawk\Gtk>gawk -f test.awk gawk: test.awk:13: fatal:
`|&' =
not
> >> supported
> ><snip>
>
> >> Any advice !!! Thanks for help
>
> >There are several features of gawk that work only under *ix because
other=

> >operating systems don't support them. =A0You found one.
>
> >There are two things you can do:
> > A) find another way to handle the task, perhaps using a transient file
> > B) run the program on a real Unix/Linux machine (not Cygwin - it's
still=

> >limited by the underlying OS.
>
> 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"
> =A0 =A0 =A0 =A0 RC["203"] =3D "Not found"
> =A0 =A0 =A0 =A0 Listen =A0 =A0=3D 80
> =A0 =A0 =A0 =A0 httpd =A0 =A0 =3D "/inet/tcp/" Listen "/0/0"
> =A0 =A0 =A0 =A0 printf("%s Lakota started\n",dtsvcstart)
> =A0 =A0 =A0 =A0 headers =3D \
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "HTTP/1.1 %s %s" ORS \
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "Server: Lakota/" LakotaVersion ORS \
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "Connection: close" ORS \
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "Cache-control: no-cache, no-store" ORS
\
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "MIME-version: 1.0" ORS \
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "Content-type: text/html" ORS
>
> =A0 =A0 =A0 =A0 KeepRunning =3D (1 =3D=3D 1) # true
> =A0 =A0 =A0 =A0 while (KeepRunning){
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 print strftime("%Y-%m-%d %H:%M:%S Listen
"=
) Listen
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 while ((httpd |& getline) > 0){
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 request =3D $0
> # strip all control chars (0x0D 0x0A leftovers etc.)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0
gsub(/[[:cntrl:]]+/,"",req=
uest) =A0 =A0 =A0
> # strip leading =A0whitespace
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0
gsub(/^[[:blank:]]+/,"",re=
quest) =A0 =A0 =A0
> # strip trailing whitespace
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0
gsub(/[[:blank:]]+$/,"",re=
quest)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (request ~ /^GET /){
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 datetime
=
=3D strftime("%Y-%m-%d %H:%M:%S")
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 URL =3D
\
> substr(request,5,index(request," HTTP/") - 5)
>
> # getpage() :
> # - =A0reads the page from disk
> # - =A0handles invalid URLs and similar errors
> # - =A0if needed, generates an errorpage
> # - =A0sets status to 200 or 203,
> # - =A0may also change KeepRunning
> #
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 html =3D
g=
etpage(URL)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 contlen
=
=3D length(html)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } # GET, other request
hea=
ders are ignored
>
> # empty line is end of request,
> # so it's time to respond
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ($0 ~
/^[[:cntrl:][:bla=
nk:]]*$/){
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0
printf("%s=
 %s URL:%s:",datetime,status,URL)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0
printf(hea=
ders,status,RC[status]) =A0 |& httpd
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0
printf("Co=
ntent-Length: %d%s%s",\
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0
=
=A0 =A0 contlen,ORS,ORS) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 |& httpd
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =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 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 printf("\n")
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 fflush("") =A0 =A0 =A0 =A0 =A0 =A0 =A0
=A0=
 =A0 =A0# flush ALL output buffers
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 close(httpd) =A0 =A0 =A0 =A0 =A0 =A0#
keep=
-alive not honored
> =A0 =A0 =A0 =A0 } # while (KeepRunning)
> =3D=3D=3D
>
> I use it as an "emergency" webserver, when Apache is down
> for maintenance.
> --
> =A0( =A0Kees
> =A0 )
> c[_] If cleanliness is next to godliness then your desk
> =A0 =A0 =A0must be an atheist. (Geek horoscopes) =A0(#354)- Hide quoted
te=
xt -
>
> - Show quoted text -

If you run this script under windows . What are the step did you take
to run them under windows ?




 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 4:22:54 CDT 2008.