#!/bin/sh
############################################################################
#
# MODULE:	d.redraw
# AUTHOR(S):	Huidae Cho - grass4u@gmail.com
# PURPOSE:	To redraw current displayed maps without saving d.save info
#		before d.erase.
# COPYRIGHT:	(C) 2000 by the GRASS Development Team
#
#		This program is free software under the GNU General Public
#		License (>=v2). Read the file COPYING that comes with GRASS
#		for details.
#
#############################################################################

#%Module
#% description: Redraws the current display frame in the GRASS monitor
#% keywords: display
#%End

if [ -z "$GISBASE" ] ; then
    echo "You must be in GRASS GIS to run this program." 1>&2
    exit 1
fi

# GUI is not very useful here, skip it if no args are given
if [ "$#" -gt 0 ] ; then
  if [ "$1" != "@ARGS_PARSED@" ] ; then
    exec g.parser "$0" "$@"
  fi
fi

dsave=`d.save -o`
# With -x flag, d.redraw behaves as if it actually stops and restarts monitor,
# which is good for PNG non-white transparency and d.mvmon.
d.erase -x
eval "$dsave"

exit 0
