#!/bin/ksh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License, Version 1.0 only # (the "License"). You may not use this file except in compliance # with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 1993-2003 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # #ident "%Z%%M% %I% %E% SMI" setvar opts = """" while getopts guplmsLv arg { if test $arg = "?" { exit 1 } setvar opts = ""$opts -$arg"" } shift $(($OPTIND - 1)) if test $Argc -le 3 { echo "$0: at least 3 arguments required." >&2 exit 1 } setvar old = "$1"; shift setvar new = "$1"; shift setvar differ = "$1"; shift setvar errlog = "/tmp/protocmp.err.$Pid" protocmp $opts @ARGV 2>$errlog | nawk -v old="$old" -v new="$new" -v differ="$differ" ' /^\**$/ { next; } /^\* Entries/ { category++; next; } /^\* filea ==/ { filea = $NF; next; } /^\* fileb ==/ { fileb = $NF; next; } { buf[category, ++line[category]] = $0 } END { if (line[1] > 2) { printf("\n%s\n\n", old); for (i = 1; i <= line[1]; i++) { print buf[1, i]; } } if (line[2] > 2) { printf("\n%s\n\n", new); for (i = 1; i <= line[2]; i++) { print buf[2, i]; } } if (line[3] > 2) { printf("\n%s\n\n", differ); for (i = 1; i <= line[3]; i++) { print buf[3, i]; } } }' if test -s $errlog { echo "\n====== protocmp ERRORS =====\n" cat $errlog } rm -f $errlog