30 Sep 2000 carey   » (Journeyer)

rillian: Are you thinking of editline, perhaps? I don't know if there's an `official' location, but the BSDs seem to use it. See FreeBSD's CVS for libedit for example.

4Suite: A new version of 4Suite is out, and it seems considerably faster when rendering my web pages. Very nice. I've also simplified the process a little, which may have something to do with it. Although I haven't worked out how to pass anything more that a string as an XSLT parameter to 4XSLT, so I'm pickling an array of tuples, then unpickling the array in an extension function and returning a node list. This is not at all simple.

Shell scripting: I've got myself a dynamic DNS name set up at dyndns.org. Unfortunately, my ADSL modem/router uses NAT, and my ISP uses a transparent HTTP proxy, so there's no automatic way to get the current IP address. I've been working on using SNMP to get the address from the router, and I've ended up with a demonstration of the power of the Unix shell.

snmpentry () {
  snmpwalk -O qs "$1" "$2" "$3" | while read -r INDEX VALUE
  do
    if [ "$VALUE" = "$4" ]; then
      echo $INDEX | cut -d '.' -f 2-
    fi
  done
}

The idea of this is that I call it as:

  entry=$(snmpentry m11 public ifDescr \
    "Nokia Telecommunications, M11, PPP")

to get the number of the PPP interface. Then I use snmpget to get the ifIndex:

  ifIndex=$(snmpget -O qs m11 public ifIndex.$entry) \
    | cut -d ' ' -f 2-)

and look up the IP address of that interface, using the snmpentry function again:

  IP=$(snmpentry m11 public ipAdEntIfIndex $ifIndex)

Now I've got an IP address that I can hand off to ddclient or whatever, without using any C, Perl, Python, sed or awk.

Don't ever say shell scripting is dead.

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!