[GRASS-user] d.monsize doesn't work in 6.3

Philipp Steigenberger userlist at online.de
Thu Jan 17 05:07:18 EST 2008


Hamish schrieb:
> Philipp Steigenberger wrote:
>> in GRASS 6.2.3 I was using a nice script which
>> connects d.start/d.stop and d.monsize to open monitors
>> in a given size or closes them if one is open.
>> In university I'm using 6.3 and there the d.monsize
>> doesn't work.
>> I get the message:
>>
>> execl() failed: Exec format error
>
> It works fine for me. How old is the 6.3 version? When was it checked
> out of CVS/SVN?
>
> Can you change the top line of the 6.3 script to be "#!/bin/sh -x" then
> rerun & send the result? (`which d.monsize`)
>
> Another option is to use d.resize.
>
>
> Hamish
>
>
>
>       ____________________________________________________________________________________
> Never miss a thing.  Make Yahoo your home page. 
> http://www.yahoo.com/r/hs
>
>
>

I have no admin rights so I copied the script to d.mons
with  "#!/bin/sh -x" I get the message

+ test -z /usr/lib/grass
+ '[' setmonitor=x1 '!=' @ARGS_PARSED@ ']'
+ exec g.parser /.../dce.uni-augsburg.de/fs/home/student/s/t/steigeph/bin/d.mons setmonitor=x1 setwidth=1000 setheight=1000
+ test -z /usr/lib/grass
+ '[' @ARGS_PARSED@ '!=' @ARGS_PARSED@ ']'
+ GRASS_WIDTH=1000
+ export GRASS_WIDTH
+ GRASS_HEIGHT=1000
+ export GRASS_HEIGHT
++ d.mon -p
++ sed 's/No monitor currently selected for output//'
+ st1='Currently selected monitor: x1'
++ echo Currently selected monitor: x1
++ cut -d : -f2
+ st2=' x1'
++ echo x1
++ perl -pne 's/^\s+//g'
+ st3=x1
+ '[' -z x1 ']'
+ '[' x1 = x1 ']'
+ d.mon stop=x1

Monitor 'x1' terminated
+ g.message 'Monitor already running and selected'

Monitor already running and selected
+ g.message 'Restarting monitor  size 1000 ...'

Restarting monitor  size 1000 ...
+ sleep 4
+ d.mon start=x1

using default visual which is TrueColor

ncolors: 16777216

Graphics driver [x1] started



and it works!



#!/bin/sh
############################################################################
#
# MODULE:       d.monsize, v 1.6 for GRASS 6.0 (2004/12/07)
#               based on d.monsize for GRASS 5
# AUTHOR(S):    Unknown;
#               updated to GRASS 5.7 by Michael Barton (michael.barton at asu.edu)
# PURPOSE:      selects/starts specified monitor at specified window size
# COPYRIGHT:    (C) 2004 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.
#
#############################################################################


# NOTE: This is based on the output pattern of d.mon -p
# Anantha Prasad <aprasad/ne_de at fs.fed.us>
#
# Version 1: Author?. Tue, 25 Jan 2000 10:31:37


#%Module
#%  description: Selects/starts specified monitor at specified size
#%  keywords: display, setup
#%End
#%option
#% key: setmonitor
#% type: string
#% description: Display monitor to start
#% options: x0,x1,x2,x3,x4,x5,x6
#% required : yes
#%end
#%option
#% key: setwidth
#% type: integer
#% description: Width in pixels of new display monitor
#% required : yes
#%end
#%option
#% key: setheight
#% type: integer
#% description: Height in pixels of new display monitor
#% required : yes
#%end



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

if [ "$1" != "@ARGS_PARSED@" ] ; then
  exec g.parser "$0" "$@"
fi

GRASS_WIDTH=$GIS_OPT_SETWIDTH
export GRASS_WIDTH
GRASS_HEIGHT=$GIS_OPT_SETHEIGHT
export GRASS_HEIGHT


# Check the current status of the monitor
st1=`d.mon -p| sed s/'No monitor currently selected for output'//`
st2=`echo $st1 | cut -d ":" -f2`

# STrip leading blanks
st3=`echo $st2|perl -pne 's/^\s+//g'`

if [ -z "$st3" ]
then
  # No monitor running so start a new one....
    g.message "No monitor selected"
    g.message "Starting monitor $GIS_OPT_SETMONITOR of size $GIS_OPT_SETWIDTHX$GIS_OPT_SETHEIGHT ..."
  d.mon start=$GIS_OPT_SETMONITOR
else
  if [ "$GIS_OPT_SETMONITOR" = "$st3" ]
  then
    # Monitor is already running...stop it and start new one
    d.mon stop=$GIS_OPT_SETMONITOR
    g.message "Monitor already running and selected"
    g.message "Restarting monitor $GIS_OPT_SETMONITORAT size $GIS_OPT_SETWIDTHX$GIS_OPT_SETHEIGHT ..."
    sleep 4
    d.mon start=$GIS_OPT_SETMONITOR
  else
    g.message "A different monitor is selected"
    g.message "Selecting and restarting monitor $GIS_OPT_SETWIDTHX$GIS_OPT_SETHEIGHT..."
    #d.mon select=$GIS_OPT_SETMONITOR
    d.mon stop=$GIS_OPT_SETMONITOR
    sleep 4
    d.mon start=$GIS_OPT_SETMONITOR
  fi
fi


More information about the grass-user mailing list