#!/bin/sh
# $NetBSD: dmesg2gif,v 1.5 2003/11/11 21:22:51 hubertf Exp $
#
# Copyright (c) 2003 Hubert Feyrer <hubertf@netbsd.org>
#

if [ -t 0 -o -t 1 ]
then
	echo 2>&1 "Usage: cat /var/run/dmesg.boot | $0 | xv -"
	exit 1
fi


(
	echo "digraph dmesg { "
	cat \
	| grep -v ^# \
	| perl -ne 'if(/^(\S*) at (\S*) *.*/){
			( $from = $1 ) =~ s/://g; 
			( $to   = $2 ) =~ s/://g; 
			print "\t$from -> $to\n"; 
		}'
	echo "}"
) | dot -Tgif
