Debian Codegraph @

awklib/eg/network/hello-serv.awk

raw
1 BEGIN {
2 RS = ORS = "\r\n"
3 HttpService = "/inet/tcp/8080/0/0"
4 Hello = "<HTML><HEAD>" \
5 "<TITLE>A Famous Greeting</TITLE></HEAD>" \
6 "<BODY><H1>Hello, world</H1></BODY></HTML>"
7 Len = length(Hello) + length(ORS)
8 print "HTTP/1.0 200 OK" |& HttpService
9 print "Content-Length: " Len ORS |& HttpService
10 print Hello |& HttpService
11 while ((HttpService |& getline) > 0)
12 continue;
13 close(HttpService)
14 }