--- /usr/src/etc/periodic/security/security.functions 2005-08-27 11:21:02.000000000 +0300 +++ security.functions 2007-11-07 22:39:30.000000000 +0200 @@ -37,16 +37,25 @@ # Usage: COMMAND | check_diff [new_only] LABEL - MSG # COMMAND > TMPFILE; check_diff [new_only] LABEL TMPFILE MSG # if $1 is new_only, show only the 'new' part of the diff. +# if $1 is sorted, show 'old' and 'new' parts of the diff sorted by filename # LABEL is the base name of the ${LOG}/${label}.{today,yesterday} files. check_diff() { rc=0 - if [ "$1" = "new_only" ]; then - shift - filter="grep '^[>+]'" - else - filter="cat" - fi + case "$1" + in + "new_only") + shift + filter="grep '^[>+]'" + ;; + "sorted") + shift + filter="grep '^[>+-]' | sort -k 11" + ;; + *) + filter="cat" + ;; + esac label="$1"; shift tmpf="$1"; shift msg="$1"; shift