head 1.1; access; symbols; locks; strict; comment @ * @; 1.1 date 2013.05.31.05.56.37; author agc; state Exp; branches; next ; commitid nDg2ioUTUdn4iKRw; desc @@ 1.1 log @Re-do completely the way that external modules are loaded in eawk. For now, use a use("digest") style statement in the script to enable the bindings in a libeawk-digest.so to be loaded via dlopen(3). Also add readrec() and writerec() callbacks for use in embedded programs, so that eawk can really be deeply embedded in other things, and used as a command interpreter, etc. Other headline changes include: + added gawk-style bit arithmetic ops + added gawk-style asort/asorti + added eawk_readrec() and eawk_writerec() callbacks for use in embedded operations + added extension use via use() command + added extensions for base64 c circa db digests dirent getopt2 hmac http mat netdiff netpgp progress rs soundex termcap The upshot is that we can extend awk quite easily, as shown by this example script: % cat scripts/conn2.sh #! /bin/sh env LD_LIBRARY_PATH=lib:extend/c bin/eawk -v host=$1 ' BEGIN { use("c"); if (host == "") print "phooey#0"; addr["ai_family"] = PF_INET; if (getaddrinfo(host, "http", addr) != 0) print "phooey#1"; sd = socket(PF_INET, SOCK_STREAM, 0); if (connect(sd, addr["ai_addr"], addr["ai_addrlen"]) != 0) print "phooey#2"; s = sprintf("GET / HTTP/1.1\r\nHost: %s\r\nUser-Agent: eawk-2.1\r\n\r\n", host); write(sd, s, length(s)); url = read(sd, 4096); print url; close(sd); }' % sh scripts/conn2.sh www.netbsd.org HTTP/1.1 200 OK Date: Fri, 31 May 2013 05:49:44 GMT Server: Apache/2.2.24 (Unix) Last-Modified: Sun, 19 May 2013 17:44:20 GMT ETag: "83765-4fd9-4dd15c40bc500" Accept-Ranges: none Content-Length: 20441 Content-Type: text/html; charset=ISO-8859-1 The NetBSD Project