Date: Tue, 03 Oct 2000 10:58:31 -0700 From: Lee Ann Goldstein <lgoldste@leeann.snedmail.com> To: stable@FreeBSD.ORG Cc: Roman Shterenzon <roman@harmonic.co.il>, lgoldste@leeann.snedmail.com Subject: Re: A new file for the base system? Message-ID: <200010031758.KAA18121@leeann.snedmail.com> In-Reply-To: Your message of Tue, 03 Oct 2000 18:01:50 %2B0300. <Pine.LNX.4.10.10010031800090.11599-100000@shark.harmonic.co.il>
next in thread | previous in thread | raw e-mail | index | archive | help
--Your message was: (from Roman Shterenzon) > > 1) Better use /var/run/dmesg.boot since message buffer may get filled with > other stuff. Unless something's changed in 4.1.1-S or 5.0-C, that's not really a problem. dmesg does not take its input from /var/log/messages. This is not necessarily true about dmesg in other *NIXes. > 2) Since perl is a part of a system now, perhaps it'll be prettier to use > perl for that task. *shrug* I speak awk better than I speak perl. Like any other even mildly interesting problem, there are at least half a dozen ways to solve this. I've been working with Stijn Hoop <stijn@win.tue.nl>, who identified a locale problem with awk/gawk. This is reproduceable- with LANG set to en_US.ISO_8859-1, awk will not match the expression (<[[:print:]]+>), so a line like pci1: <ATI Mach64-GB graphics accelerator> at 0.0 irq 9 does not get turned into pci1 irq 9 pci1.0.0 <ATI Mach64-GB graphics accelerator> When LANG is not set, the expression matches as expected. I have no idea if this is a problem with gawk in general, or with the FreeBSD build of it. I note that I can successfully grep for both "<" and ">" regardless of how LANG is set, though this may be a red herring. I'm giving up on the regex problem, and will just unset LANG in my wrapper script. (bleh. nasty hack) I also found and fixed another regex problem, so here's my final form of both scripts. Lee Ann find_irq.sh ----------- #!/bin/sh LANG=;export LANG dmesg | \ ./find_irq.awk | \ sort -n +2 -3 -----end sh script----- find_irq.awk ------------ #!/usr/bin/awk -f ! /irq\>/ {next} /at device/ && /on pci/ {irqinfo = gensub(/(^[a-z0-9]+[: ]).*(irq [0-9]+).*\<([0-9]+\.[0-9]+)\> on (pci[0-9]+)/, "\\1 \\2 \\4.\\3", 1) sub(/:/, "", irqinfo) sub(/ [0-9] /, " &", irqinfo) print irqinfo next } /on pci/ {irqinfo = gensub(/(^[a-z0-9]+[: ]).*(irq [0-9]+).*(pci[0-9]+\.[0-9]+\.[0-9]+)/, "\\1 \\2 \\3", 1) sub(/:/, "", irqinfo) sub(/ [0-9] /, " &", irqinfo) print irqinfo next } /^pci[0-9]+/ {irqinfo = gensub(/(^[a-z0-9]+[: ]).*(<[[:print:]]+>).*\<([0-9]+\.[0-9]+)\> (irq [0-9]+)/,"\\1 \\4 \\1.\\3 \\2", 1) gsub(/:/, "", irqinfo) sub(/ [0-9] /, " &", irqinfo) print irqinfo next } {irqinfo = gensub(/(^[a-z0-9]+[: ]).*(irq [0-9]+).*/, "\\1 \\2", 1) sub(/:/, "", irqinfo) sub(/ [0-9]$/, " &", irqinfo) print irqinfo next } -----end awk script----- -- Lee Ann Goldstein Caffeine is *not* a substitute for sleep. lgoldste@leeann.snedmail.com lgoldste@lafn.org leeann@rand.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200010031758.KAA18121>