Browse Source

g.mremove g.mlist replaced by C version

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@33587 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler 16 years ago
parent
commit
2a44dedbce

+ 0 - 2
scripts/Makefile

@@ -13,8 +13,6 @@ SUBDIRS = \
 	db.out.ogr \
 	db.test \
 	g.manual \
-	g.mlist \
-	g.mremove \
 	i.fusion.brovey \
 	i.image.mosaic \
 	i.in.spotvgt \

+ 0 - 7
scripts/g.mlist/Makefile

@@ -1,7 +0,0 @@
-MODULE_TOPDIR = ../..
-
-PGM = g.mlist
-
-include $(MODULE_TOPDIR)/include/Make/Script.make
-
-default: script

+ 0 - 131
scripts/g.mlist/g.mlist

@@ -1,131 +0,0 @@
-#!/bin/sh
-#
-############################################################################
-#
-# MODULE:	g.mlist
-# AUTHOR(S):	Huidae Cho - grass4u@gmail.com
-# PURPOSE:	Lists data files using basic regular expressions and wildcards
-# 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: Lists data files using basic regular expressions and wildcards.
-#%  keywords: general, map management
-#%End
-#%flag
-#%  key: r
-#%  description: Use basic regular expressions instead of wildcards
-#%end
-#%flag
-#%  key: m
-#%  description: Print mapset names
-#%end
-#%option
-#% key: type
-#% type: string
-#% description: Data type
-#% answer: rast
-#% options: rast,rast3d,oldvect,vect,asciivect,icon,labels,sites,region,region3d,group,3dview,all
-#% required : yes
-#% multiple: yes
-#%end
-#%option
-#% key: mapset
-#% type: string
-#% multiple : yes
-#% description: Mapset(s) to list (default: current mapset search path)
-#% required : no
-#%end
-#%option
-#% key: separator
-#% type: string
-#% description: Output separator (default: newline)
-#% required : no
-#%end
-#%option
-#% key: pattern
-#% type: string
-#% description: Map name search pattern (default: all)
-#% answer: *
-#% required : no
-#%end
-
-do_list() {
-    if [ ! "$search" ] ; then
-	search="."
-    fi
-
-    if [ $GIS_FLAG_M -eq 1 ] ; then
-	MAPSET="@$mapset"
-    else
-	MAPSET=""
-    fi
-
-    LC_ALL=C g.list type="$type" mapset="$mapset" |
-    sed '
-	/^--*$/d;
-	/files available/d;
-	/^$/d;
-	s/  */\
-/g;' |
-    sed "
-	/$search/!d;
-	s/$/$MAPSET/;"
-}
-
-
-if [ "$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
-
-#echo "Note:"
-#echo "  Do not forget to enclose expression with '...' to avoid being expanded"
-#echo "  by the shell first."
-
-type="$GIS_OPT_TYPE"
-mapset="$GIS_OPT_MAPSET"
-separator="$GIS_OPT_SEPARATOR"
-search="$GIS_OPT_PATTERN"
-
-# list all datatypes
-if echo $type | grep -qE '(^|,)all(,|$)'; then
-    type="rast,rast3d,oldvect,vect,asciivect,icon,labels,sites,region,region3d,group,3dview"
-fi
-
-if [ $GIS_FLAG_R -ne 1 ] ; then
-    # wildcard
-    search="^`echo \"$search\" | sed 's/\./\\\\./g; s/?/./g; s/*/.*/g; s/|/$\\\\|^/g'`$"
-fi
-#echo $search
-
-start=""
-if [ -z "$mapset" ] ; then
-    # using current mapset
-    mapsets=`g.mapsets -p`
-else
-    mapsets=`echo $mapset | tr , ' '`
-fi
-
-for mapset in $mapsets
-do
-    do_list
-done | sort | (
-    if [ "$separator" != "" ] ; then
-	tr '\n' "$separator" | sed 's/.$/\
-/'
-    else
-	cat
-    fi
-)
-
-exit 0

+ 0 - 60
scripts/g.mlist/g.mlist.html

@@ -1,60 +0,0 @@
-<H2>DESCRIPTION</H2>
-
-<EM>g.mlist</EM> is an extended version of 
-<EM><A HREF="g.list.html">g.list</A></EM> which
-provides support for POSIX Basic Regular Expressions and wildcards.
-<EM>g.mlist</EM> will only print map names and an optional separator,
-without extraneous output. In addition, map search is also available.
-
-<H2>EXAMPLES</H2>
-
-List all available GRASS data base files:
-<BR>
-<TT>g.mlist type=all</TT>
-<P>
-
-List all raster and vector maps:
-<BR>
-<TT>g.mlist type=rast,vect</TT>
-<P>
-
-<H3>Wildcards:</H3>
-
-List all vector maps starting with letter "r":
-<BR>
-<TT>g.mlist type=vect pattern="r*"</TT>
-<P>
-
-List certain raster maps with one variable character/number:
-<BR>
-<TT>g.mlist type=rast pattern="N45E00?.meters"</TT>
-
-<H3>Regular expressions:</H3>
-
-Print out all soils map with "soils" in their name:<BR>
-<TT>g.mlist -r type=rast pattern='^soils'</TT>
-<P>
-
-Print out "tmp" if "tmp" raster map exists:<BR>
-<TT>g.mlist -r pattern='^tmp$'</TT>
-<P>
-
-Print out "tmp0" ..."tmp9" if corresponding vector map exists (each map name linewise):<BR>
-<TT>g.mlist -r type=vect pattern='^tmp[0-9]$'</TT>
-<P>
-
-Print out "tmp0" ..."tmp9" if corresponding vector map exists (each map name comma separated):<BR>
-<TT>g.mlist -r type=vect separator=, pattern='^tmp[0-9]$'</TT>
-<P>
-This may be useful for other programs' parameter input 
-(e.g. <EM><A HREF="r.series.html">r.series</A></EM>).
-
-<H2>SEE ALSO</H2>
-
-<EM><A HREF="g.list.html">g.list</A></EM>
-<P>
-<A HREF="http://en.wikipedia.org/wiki/Regular_expression">Regular expression</A> (from Wikipedia, the free encyclopedia)
-
-<H2>AUTHOR</H2>
-Huidae Cho
-<P><I>Last changed: $Date$</I>

+ 0 - 7
scripts/g.mremove/Makefile

@@ -1,7 +0,0 @@
-MODULE_TOPDIR = ../..
-
-PGM = g.mremove
-
-include $(MODULE_TOPDIR)/include/Make/Script.make
-
-default: script

+ 0 - 151
scripts/g.mremove/g.mremove

@@ -1,151 +0,0 @@
-#!/bin/sh
-#
-############################################################################
-#
-# MODULE:	g.mremove
-# AUTHOR(S):	Huidae Cho - grass4u@gmail.com
-# PURPOSE:	Removes data files using basic regular expressions and wildcards
-# 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: Removes data files using basic regular expressions and wildcards.
-#%  keywords: general, map management
-#%End
-
-#%flag
-#%  key: r
-#%  description: Use basic regular expressions instead of wildcards
-#%end
-
-#%flag
-#%  key: f
-#%  description: Force removal (required for actual deletion of files)
-#%end
-
-#%option
-#% key: rast
-#% type: string
-#% description: Raster to remove
-#% gisprompt: old,cell,raster
-#% required : no
-#%end
-
-#%option
-#% key: rast3d
-#% type: string
-#% description: 3d raster to remove
-#% gisprompt: old,grid3,3d-raster
-#% required : no
-#%end
-
-#%option
-#% key: vect
-#% type: string
-#% description: Vector to remove
-#% gisprompt: old,vector,vector
-#% required : no
-#%end
-
-#%option
-#% key: region
-#% type: string
-#% description: Region to remove
-#% required : no
-#%end
-
-#%option
-#% key: icon
-#% type: string
-#% description: Icon to remove
-#% required : no
-#%end
-
-#%option
-#% key: label
-#% type: string
-#% description: Label to remove
-#% required : no
-#%end
-
-#%option
-#% key: dview
-#% type: string
-#% description: 3dview to remove
-#% required : no
-#%end
-
-#%option
-#% key: group
-#% type: string
-#% description: Group to remove
-#% required : no
-#%end
-
-if [ "$1" != "@ARGS_PARSED@" ] ; then
-    exec g.parser "$0" "$@"
-fi
-
-if test "$GISBASE" = ""; then
-    echo "You must be in GRASS GIS to run this program." >&2
-    exit 1
-fi
-
-eval `g.gisenv`
-: ${GISBASE?} ${GISDBASE?} ${LOCATION_NAME?} ${MAPSET?}
-LOCATION=$GISDBASE/$LOCATION_NAME/$MAPSET
-
-g.message "Collecting map names for current mapset <$MAPSET>..."
-
-if [ $GIS_FLAG_R -eq 1 ] ; then
-    regex="-r"
-else
-    regex=""
-fi
-
-force=$GIS_FLAG_F
-
-if [ $force -eq 1 ] ; then
-    g.message "Forcing ..."
-fi
-
-found=""
-
-search() {
-    if [ ! "$2" ]; then
-	return
-    fi
-    found="$found"`
-	g.mlist $regex sep=, mapset="$MAPSET" type="$1" pattern="$2" |
-	sed "s,^\(.\), $1=\1,"`
-}
-
-search rast	"$GIS_OPT_RAST"
-search rast3d	"$GIS_OPT_RAST3D"
-search vect	"$GIS_OPT_VECT"
-search icon	"$GIS_OPT_ICON"
-search labels	"$GIS_OPT_LABEL"
-search region	"$GIS_OPT_REGION"
-search group	"$GIS_OPT_GROUP"
-search 3dview	"$GIS_OPT_DVIEW"
-
-if [ ! "$found" ] ; then
-    g.message -e "No data found."
-    exit 1
-fi
-
-if [ $force -eq 0 ] ; then
-    g.message "The following files would be deleted:"
-    echo "g.remove $found"
-    g.message message=""
-    g.message "You must use the force flag to actually remove them. Exiting."
-    exit 0
-fi
-
-exec g.remove $found

+ 0 - 29
scripts/g.mremove/g.mremove.html

@@ -1,29 +0,0 @@
-<h2>DESCRIPTION</h2>
-
-<em>g.mremove</em> is an extended version of
-<em><a href="g.remove.html">g.remove</a></em> which
-provides support for POSIX Basic Regular Expressions and wildcards.
-If the <b>-f</b> force flag is not given then nothing is removed, instead
-a functional <em>g.remove</em> command string is printed to <tt>stdout</tt>
-as a preview of the action to be taken.
-
-<h2>EXAMPLE</h2>
-
-Delete all raster maps starting with "<tt>tmp_</tt>" in the current mapset:
-
-<div class="code"><pre>
-  g.mremove -f "tmp_*"
-</pre></div>
-
-<h2>SEE ALSO</h2>
-
-<em><a HREF="g.remove.html">g.remove</a></em>
-<p>
-<a href="http://en.wikipedia.org/wiki/Regular_expression">Regular expression</a> (from Wikipedia, the free encyclopedia)
-
-<h2>AUTHOR</h2>
-
-Huidae Cho<br>
-grass4u@gmail.com
-
-<p><i>Last changed: $Date$</i>