#! /pkg/bin/ksh
# ---------------------------------------------------------------------
# show_tech_config_history - Script fragment to determine the list of 
#                            config events, and print details for those
#                            of interest.
#
# August 2007, Anthony Toole
#
# Copyright (c) 2007, 2009 by cisco Systems, Inc.
# All rights reserved.
#--------------------------------------------------------------------

#
# Get the config history from cfgmgr - in reverse (-r) so we can stop once all
# events since bootup found.
#
# For each commit ID print the change associated with that ID
#
# When we hit the startup event in the history we want to stop, as older IDs 
# in the history will not be usable.
#
count=0
limit=5
cfgmgr_show_history -r | \
while read idx event ignore1 id ignore2 && [[ $count -lt $limit ]] ; do
  if [ "$event" = "startup" ]; then
    break;
  fi;
  if [ "$event" = "commit" ]; then 
    echo;
    echo; 
    echo "show config commit changes $id";
    echo; 
    show_config_changes -s $id -n 0x1;
    ((count=$count+1));
  fi;
done

