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

Re: GUI Awk

by Kees Nuyt <k.nuyt@[EMAIL PROTECTED] > Feb 16, 2008 at 08:18 PM

On Sat, 16 Feb 2008 10:55:43 -0600, Ted Davis
<tdavis@[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
that
>> 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.  You 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"):

===
	dtsvcstart    = strftime("%Y-%m-%d %H:%M:%S")
	LakotaVersion = "2.2"

	RC["200"] = "Ok"
	RC["203"] = "Not found"
	Listen    = 80
	httpd     = "/inet/tcp/" Listen "/0/0"
	printf("%s Lakota started\n",dtsvcstart)
	headers = \
		"HTTP/1.1 %s %s" ORS \
		"Server: Lakota/" LakotaVersion ORS \
		"Connection: close" ORS \
		"Cache-control: no-cache, no-store" ORS \
		"MIME-version: 1.0" ORS \
		"Content-type: text/html" ORS

	KeepRunning = (1 == 1) # true
	while (KeepRunning){
		print strftime("%Y-%m-%d %H:%M:%S Listen ") Listen
		while ((httpd |& getline) > 0){
			request = $0
# strip all control chars (0x0D 0x0A leftovers etc.)
			gsub(/[[:cntrl:]]+/,"",request)	
# strip leading  whitespace
			gsub(/^[[:blank:]]+/,"",request)	
# strip trailing whitespace
			gsub(/[[:blank:]]+$/,"",request)
			if (request ~ /^GET /){
				datetime = strftime("%Y-%m-%d %H:%M:%S")
				URL = \
substr(request,5,index(request," HTTP/") - 5)

# getpage() :
# -  reads the page from disk
# -  handles invalid URLs and similar errors
# -  if needed, generates an errorpage
# -  sets status to 200 or 203, 
# -  may also change KeepRunning
#
				html = getpage(URL)
				contlen = length(html)
			} # GET, other request headers are ignored

# empty line is end of request,
# so it's time to respond
			if ($0 ~ /^[[:cntrl:][:blank:]]*$/){
				printf("%s %s URL:%s:",datetime,status,URL)
				printf(headers,status,RC[status])   |& httpd
				printf("Content-Length: %d%s%s",\
					contlen,ORS,ORS)                 |& httpd
				printf("%s",html)                   |& httpd
				break
			}
		}
		printf("\n")
		fflush("")			# flush ALL output buffers
		close(httpd)		# keep-alive not honored
	} # while (KeepRunning)
===

I use it as an "emergency" webserver, when Apache is down
for maintenance.
-- 
 (  Kees
  )
c[_] If cleanliness is next to godliness then your desk
     must be an atheist. (Geek horoscopes)  (#354)




 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:36:12 CDT 2008.