Browse Source

Breaking stuff part 1: the 1970s called; they want their TTYs back
Remove vask, edit, curses, G_ask_*, G_yes, G_gets, I_ask_*, GPJ_ask_*
Remove g.ask, etc/set_data
Remove various terminal-interactive features
Break d.colors, g.setproj, i.class, i.ortho.photo, i.points, i.vpoints,
r.le, r.quant, r.support, r.digit, v.transform



git-svn-id: https://svn.osgeo.org/grass/grass/trunk@32551 15284696-431f-4ddb-bdfa-cd5b030d7da7

Glynn Clements 17 years ago
parent
commit
8a40b7b79f
68 changed files with 791 additions and 7295 deletions
  1. 765 1174
      configure
  2. 0 44
      configure.in
  3. 4 3
      db/db.login/main.c
  4. 0 1
      general/Makefile
  5. 0 11
      general/g.ask/Makefile
  6. 0 162
      general/g.ask/description.html
  7. 0 124
      general/g.ask/main.c
  8. 4 13
      general/g.proj/datumtrans.c
  9. 2 2
      general/g.proj/local_proto.h
  10. 3 10
      general/g.proj/main.c
  11. 3 41
      general/g.proj/output.c
  12. 0 160
      general/manage/lib/menu.c
  13. 2 2
      imagery/i.class/Makefile
  14. 0 3
      include/Make/Platform.make.in
  15. 0 4
      include/P_site.h
  16. 0 9
      include/config.h.in
  17. 0 16
      include/edit.h
  18. 0 45
      include/gisdefs.h
  19. 0 1
      include/gprojects.h
  20. 0 3
      include/imagedefs.h
  21. 0 84
      include/vask.h
  22. 0 2
      lib/Makefile
  23. 0 10
      lib/edit/Makefile
  24. 0 380
      lib/edit/edit_cats.c
  25. 0 604
      lib/edit/edit_cellhd.c
  26. 0 145
      lib/edit/edit_hist.c
  27. 0 618
      lib/gis/ask.c
  28. 0 114
      lib/gis/ask_cell.c
  29. 0 86
      lib/gis/ask_vctrs.c
  30. 0 123
      lib/gis/get_datum_name.c
  31. 0 79
      lib/gis/get_ell_name.c
  32. 0 86
      lib/gis/get_projname.c
  33. 0 99
      lib/gis/gets.c
  34. 0 48
      lib/gis/intr_char.c
  35. 0 95
      lib/gis/make_colr.c
  36. 2 187
      lib/gis/parser.c
  37. 0 71
      lib/gis/yes.c
  38. 0 67
      lib/imagery/ask_group.c
  39. 0 6
      lib/imagery/ls_groups.c
  40. 0 12
      lib/init/Makefile
  41. 0 38
      lib/init/chk_dbase.c
  42. 0 195
      lib/init/mke_loc.c
  43. 0 52
      lib/init/mke_mapset.c
  44. 0 57
      lib/init/other.c
  45. 0 348
      lib/init/set_data.c
  46. 0 148
      lib/proj/datum.c
  47. 0 52
      lib/sites/sites.c
  48. 0 12
      lib/vask/Makefile
  49. 0 35
      lib/vask/README
  50. 0 50
      lib/vask/V_acc.c
  51. 0 507
      lib/vask/V_call.c
  52. 0 61
      lib/vask/V_clear.c
  53. 0 88
      lib/vask/V_const.c
  54. 0 52
      lib/vask/V_error.c
  55. 0 67
      lib/vask/V_exit.c
  56. 0 64
      lib/vask/V_init.c
  57. 0 57
      lib/vask/V_line.c
  58. 0 119
      lib/vask/V_ques.c
  59. 0 110
      lib/vask/V_support.c
  60. 0 56
      lib/vask/V_trim_dec.c
  61. 0 58
      raster/r.coin/check.c
  62. 0 156
      raster/r.coin/inter.c
  63. 1 4
      raster/r.coin/main.c
  64. 2 2
      raster/r.le/r.le.setup/Makefile
  65. 1 0
      raster3d/r3.mkdspf/main.c
  66. 2 14
      raster3d/r3.mkdspf/r3_find.c
  67. 0 6
      vector/v.transform/Makefile
  68. 0 143
      vector/v.transform/ask_trans.c

File diff suppressed because it is too large
+ 765 - 1174
configure


+ 0 - 44
configure.in

@@ -196,7 +196,6 @@ LOC_ARG_WITH(glw, GLw, no)
 LOC_ARG_WITH(nls, NLS, no)
 LOC_ARG_WITH(readline, Readline, no)
 LOC_ARG_WITH(opendwg, openDWG, no)
-LOC_ARG_WITH(curses, Curses, yes)
 AC_ARG_WITH(python,
 [  --with-python[=path/python-config] enable support for Python SWIG bindings (python-config with path, \
 e.g. '--with-python=/usr/bin/python2.5-config', default: no)],, with_python="no")
@@ -419,49 +418,6 @@ AC_SUBST(XLIB)
 AC_SUBST(XTLIB)
 AC_SUBST(USE_X11)
 
-# Enable Curses option
-
-LOC_CHECK_USE(curses,Curses,USE_CURSES)
-
-if test -n "$USE_CURSES"; then
-
-LOC_CHECK_INCLUDES(curses.h,curses,)
-
-AC_MSG_CHECKING(curses.h WINDOW structure component)
-CURSES_MAXY=NONE
-AC_TRY_COMPILE([
-#include <curses.h>
-  ],[WINDOW w; w.maxy = 0;],
-  CURSES_MAXY=maxy)
-AC_TRY_COMPILE([
-#include <curses.h>
-  ],[WINDOW w; w._maxy = 0;],
-  CURSES_MAXY=_maxy)
-AC_DEFINE_UNQUOTED(CURSES_MAXY,$CURSES_MAXY)
-AC_SUBST(CURSES_MAXY)
-AC_MSG_RESULT($CURSES_MAXY)
-
-AC_CHECK_LIB(ncurses, initscr, CURSESLIB=-lncurses, [
-AC_CHECK_LIB(curses, initscr, CURSESLIB=-lcurses, [
-    AC_MSG_ERROR([*** Unable to locate curses library.])
-    CURSESLIB=
-])])
-AC_SUBST(CURSESLIB)
-AC_SUBST(USE_CURSES)
-
-AC_CHECK_LIB(ncurses, keypad, [AC_DEFINE(HAVE_KEYPAD)], [
-AC_CHECK_LIB(curses, keypad, [AC_DEFINE(HAVE_KEYPAD)], [
-])])
-
-fi # $USE_CURSES
-
-AC_CHECK_LIB(compat, gtty, COMPATLIB=-lcompat, [
-AC_CHECK_LIB(bsd-compat, gtty, COMPATLIB=-lbsd-compat, [
-AC_CHECK_LIB(bsd, gtty, COMPATLIB=-lbsd, [
-    COMPATLIB=
-])])])
-AC_SUBST(COMPATLIB)
-
 # Note that some systems (FreeBSD for example) need an extra library for
 # cuserid
 ac_save_libs="$LIBS"

+ 4 - 3
db/db.login/main.c

@@ -80,12 +80,13 @@ int main(int argc, char *argv[])
 #endif
 	    do {
 		fprintf(stderr,
-			_
-			("\nEnter database password for connection\n<%s:%s:user=%s>\n"),
+			_("\nEnter database password for connection\n<%s:%s:user=%s>\n"),
 			driver->answer, database->answer, user->answer);
 		fprintf(stderr, _("Hit RETURN to cancel request\n"));
 		fprintf(stderr, ">");
-	    } while (!G_gets(answer));
+		*answer = '\0';
+		G_getl(answer, sizeof(answer), stdin);
+	    } while (0);
 #ifdef HAVE_TERMIOS_H
 	    tcsetattr(STDIN_FILENO, TCSANOW, &tios);
 #endif

+ 0 - 1
general/Makefile

@@ -3,7 +3,6 @@ MODULE_TOPDIR = ..
 
 SUBDIRS = \
 	g.access \
-	g.ask \
 	g.dirseps \
 	g.filename \
 	g.findetc \

+ 0 - 11
general/g.ask/Makefile

@@ -1,11 +0,0 @@
-
-MODULE_TOPDIR = ../..
-
-PGM = g.ask
-
-LIBES     = $(GISLIB)
-DEPENDENCIES= $(GISDEP)
-
-include $(MODULE_TOPDIR)/include/Make/Module.make
-
-default: cmd

+ 0 - 162
general/g.ask/description.html

@@ -1,162 +0,0 @@
-<H2>DESCRIPTION</H2>
-
-<EM>g.ask</EM> is designed for shell scripts that need to
-prompt the user for the name of a data base file in the
-user's current GRASS location.  After <EM>g.ask</EM> is
-invoked with needed parameters, it will query the user for
-a file name of the specified <EM>type</EM> and
-<EM>element</EM>.  After the user responds to this query,
-the program will write four lines to the UNIX output file
-specified by <EM>unixfile</EM>.
-
-<!-- unused
-<H2>OPTIONS</H2>
-
-<H3>Parameters:</H3>
-
-
-<DL>
-
-
-<DT><B>type=</B><EM>name</EM> 
-
-<DD>The type of query.  Options for <EM>name</EM> are 
-<EM>old</EM>, <EM>new</EM>,
-<EM>any</EM>, and <EM>mapset</EM>;  their functions are given below.
-"New", "any", and "mapset" only look in the user's current mapset.
-
-<DL>
-<DD>
-<DT><B>old</B>
-<DD>For existing data files anywhere in the user's mapset search path.
-
-<DT><B>new</B> 
-
-<DD>Used to create a new file in the current mapset, which must not
-already exist there (if a file with this name exists there,
-it will not be overwritten).
-
-<DT><B>any</B> 
-
-<DD>Creates a file in the current mapset, which may or may not
-already exist there.  If a file with this name exists in the
-current mapset, it will be overwritten;
-if not, a new file with this name will be created.
-
-<DT><B>mapset</B> 
-
-<DD>For files that must exist in the current mapset
-The shell write wants the name of a file which exists
-in the user's current mapset.  This type would
-used instead of "old" if the file is to be modified.
-</DL>
-
-<DT><B>prompt=</B>"<EM>string</EM>" 
-
-<DD>The prompt to be displayed to the user.  If more than
-one word, the prompt should be enclosed within double
-quotes ("").
-
-<DT><B>element=</B><EM>name</EM> 
-
-<DD>The name of the GRASS data base element (i.e.,
-directory under a GRASS mapset) whose files are to be
-queried.
-
-<DT><B>desc=</B>"<EM>string</EM>" 
-
-<DD>A short description of the data base element which is
-meaningful to the user.  If description contains more than
-one word, it should be enclosed within double quotes ("").
-
-<DT><B>unixfile=</B><EM>name</EM> 
-
-<DD>The name of a UNIX file to store the user's response.
-See next section for what is written to this file and how
-it can be used by shell scripts.
-
-</DL>
--->
-
-<H2>OUTPUT</H2>
-
-Upon receiving the user's response to its request for a
-file name, <EM>g.ask</EM> writes four lines to the
-specified <EM>unixfile</EM>; this output file is placed in
-the user's current working directory, unless otherwise
-specified, and contains the following lines:
-
-
-<div class="code">
-<PRE>
-name='<EM>some_name</EM>'
-mapset='<EM>some_mapset</EM>'
-fullname='<EM>some_fullname</EM>'
-file='<EM>some_fullpath</EM>'
-</pre></div>
-
-<P>
-
-The output is <EM>/bin/sh</EM> commands to set the variable
-<EM>name</EM> to the file name specified by the user (of
-the <EM>element</EM> and <EM>type</EM> requested by
-<EM>g.ask</EM>), <EM>mapset</EM> to the GRASS mapset in
-which this file resides (or will be created),
-<EM>fullname</EM> is the name with the mapset embedded in
-it, and <EM>file</EM> to the full UNIX path name
-identifying this file.  These variables may be set in the
-<EM>/bin/sh</EM> as follows:
-
-<DL>
-<DD>
-<B>. unixfile</B>
-</DL>
-
-
-<P>
-
-The . is a shell command which means read the
-<EM>unixfile</EM> and execute the commands found there.  It
-is NOT part of the <EM>unixfile</EM> name and MUST be
-followed by a space.
-
-<H2>NOTES</H2>
-
-The user may choose to simply hit the return key and not enter a file name.
-If this happens the variables will be set as follows:
-
-
-<div class="code">
-<PRE>
-name=
-mapset=
-fullname=
-file=
-</pre></div>
-
-<P>
-
-The following is a way to test for this case:
-
-<div class="code">
-<PRE>
-if [ ! "$file" ]
-then
-	exit
-fi
-</PRE></div>
-
-<H2>SEE ALSO</H2>
-
-<EM><A HREF="d.ask.html">d.ask</A></EM>,
-<EM><A HREF="g.filename.html">g.filename</A></EM>,
-<EM><A HREF="g.findfile.html">g.findfile</A></EM>,
-<EM><A HREF="g.gisenv.html">g.gisenv</A></EM>,
-<EM><A HREF="g.parser.html">g.parser</A></EM>
-
-<H2>AUTHOR</H2>
-
-Michael Shapiro,
-U.S.Army Construction Engineering Research Laboratory
-
-<p><i>Last changed: $Date$</i>

+ 0 - 124
general/g.ask/main.c

@@ -1,124 +0,0 @@
-
-/****************************************************************************
- *
- * MODULE:       g.ask
- * AUTHOR(S):    Michael Shapiro CERL (original contributor)
- *               Markus Neteler <neteler itc.it>,
- *               Bernhard Reiter <bernhard intevation.de>, 
- *               Glynn Clements <glynn gclements.plus.com>,
- *               Jan-Oliver Wagner <jan intevation.de>
- * PURPOSE:      
- * COPYRIGHT:    (C) 1999-2006 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.
- *
- *****************************************************************************/
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <grass/gis.h>
-#include <grass/glocale.h>
-
-int main(int argc, char *argv[])
-{
-    char file[1024], name[40], *mapset;
-    char *prompt;
-    char *help[2];
-    FILE *fd;
-    struct GModule *module;
-    struct Option *opt1;
-    struct Option *opt2;
-    struct Option *opt3;
-    struct Option *opt4;
-    struct Option *opt5;
-
-    G_gisinit(argv[0]);
-
-    module = G_define_module();
-    module->keywords = _("general");
-    module->description =
-	"Prompts the user for the names of GRASS data base files.";
-
-    /* Define the different options */
-
-    opt1 = G_define_option();
-    opt1->key = "type";
-    opt1->type = TYPE_STRING;
-    opt1->required = YES;
-    opt1->description = "The type of query";
-    opt1->options = "old,new,any,mapset";
-
-    opt2 = G_define_option();
-    opt2->key = "prompt";
-    opt2->key_desc = "\"string\"";
-    opt2->type = TYPE_STRING;
-    opt2->required = NO;
-    opt2->description = "The prompt to be displayed to the user";
-
-    opt3 = G_define_option();
-    opt3->key = "element";
-    opt3->type = TYPE_STRING;
-    opt3->required = YES;
-    opt3->description = "The database element to be queried";
-
-    opt4 = G_define_option();
-    opt4->key = "desc";
-    opt4->key_desc = "\"string\"";
-    opt4->type = TYPE_STRING;
-    opt4->required = NO;
-    opt4->description = "A short description of the database element";
-
-    opt5 = G_define_option();
-    opt5->key = "unixfile";
-    opt5->type = TYPE_STRING;
-    opt5->required = YES;
-    opt5->description =
-	"The name of a unix file to store the user's response";
-
-    if (argc < 2) {		/* no interactive version allowed */
-	help[0] = argv[0];
-	help[1] = "help";
-	argv = help;
-	argc = 2;
-    }
-    if (G_parser(argc, argv) < 0)
-	exit(EXIT_FAILURE);
-
-    prompt = opt2->answer;
-
-    fd = fopen(opt5->answer, "w");
-    if (fd == NULL) {
-	fprintf(stderr, "%s - ", argv[0]);
-	perror(opt5->answer);
-	exit(EXIT_FAILURE);
-    }
-
-    if (strcmp(opt1->answer, "old") == 0)
-	mapset = G_ask_old(prompt, name, opt3->answer, opt4->answer);
-    else if (strcmp(opt1->answer, "new") == 0)
-	mapset = G_ask_new(prompt, name, opt3->answer, opt4->answer);
-    else if (strcmp(opt1->answer, "any") == 0)
-	mapset = G_ask_any(prompt, name, opt3->answer, opt4->answer, 0);
-    else if (strcmp(opt1->answer, "mapset") == 0)
-	mapset = G_ask_in_mapset(prompt, name, opt3->answer, opt4->answer);
-
-
-    if (mapset) {
-	fprintf(fd, "name='%s'\n", name);
-	fprintf(fd, "mapset='%s'\n", mapset);
-	fprintf(fd, "fullname='%s'\n", G_fully_qualified_name(name, mapset));
-	G__file_name(file, opt3->answer, name, mapset);
-	fprintf(fd, "file='%s'\n", file);
-	G__make_mapset_element(opt3->answer);
-    }
-    else {
-	fprintf(fd, "name=\n");
-	fprintf(fd, "mapset=\n");
-	fprintf(fd, "file=\n");
-    }
-
-    fclose(fd);
-    exit(EXIT_SUCCESS);
-}

+ 4 - 13
general/g.proj/datumtrans.c

@@ -34,13 +34,10 @@
  * \param force       Force editing of parameters even if current co-ordinate
  *                    system already contains fully specified parameters.
  * 
- * \param interactive Interactively prompt user for parameters, ignoring
- *                    value of datumtrans variable.
- * 
  * \return            1 if a change was made, 0 if not.
  **/
 
-int set_datumtrans(int datumtrans, int force, int interactive)
+int set_datumtrans(int datumtrans, int force)
 {
     char *params, *datum = NULL;
     int paramsets, status;
@@ -81,15 +78,9 @@ int set_datumtrans(int datumtrans, int force, int interactive)
 	struct Key_Value *temp_projinfo;
 	int i;
 
-	/* First of all obtain the new parameters either interactively
-	 * or through the supplied transform number index */
-	if (interactive) {
-	    /* Print to stderr here as the function call will also */
-	    fprintf(stderr, "Datum name: %s (%s)", dstruct.name,
-		    dstruct.longname);
-	    GPJ_ask_datum_params(datum, &chosenparams);
-	}
-	else {
+	/* First of all obtain the new parameters 
+	 * through the supplied transform number index */
+	{
 	    struct gpj_datum_transform_list *list;
 
 	    if (datumtrans > paramsets)

+ 2 - 2
general/g.proj/local_proto.h

@@ -19,7 +19,7 @@ void print_projinfo(void);
 void print_datuminfo(void);
 void print_proj4(int);
 void print_wkt(int, int);
-void create_location(char *, int);
+void create_location(char *);
 
 /* datumtrans.c */
-int set_datumtrans(int, int, int);
+int set_datumtrans(int, int);

+ 3 - 10
general/g.proj/main.c

@@ -31,8 +31,7 @@ int main(int argc, char *argv[])
      *printwkt,			/* Print projection in WKT format           */
      *esristyle,		/* Use ESRI-style WKT format                */
      *dontprettify,		/* Print 'flat' output (no linebreaks)      */
-     *forcedatumtrans,		/* Force override of datumtrans parameters  */
-     *interprompt;		/* Enable interactive prompting             */
+     *forcedatumtrans;		/* Force override of datumtrans parameters  */
 
     struct Option *location,	/* Name of new location to create           */
      *inepsg,			/* EPSG projection code                     */
@@ -159,11 +158,6 @@ int main(int argc, char *argv[])
     location->guisection = "Create/Edit_Locations";
     location->description = _("Name of new location to create");
 
-    interprompt = G_define_flag();
-    interprompt->key = 'i';
-    interprompt->description =
-	_("Enable interactive prompting (for command-line use only)");
-
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
@@ -211,8 +205,7 @@ int main(int argc, char *argv[])
 	G_fatal_error(_("Projection files missing"));
 
     /* Set Datum Parameters if necessary or requested */
-    set_datumtrans(atoi(dtrans->answer), forcedatumtrans->answer,
-		   interprompt->answer);
+    set_datumtrans(atoi(dtrans->answer), forcedatumtrans->answer);
 
 
     /* Output */
@@ -232,7 +225,7 @@ int main(int argc, char *argv[])
 	print_wkt(esristyle->answer, dontprettify->answer);
 
     if (create->answer)
-	create_location(location->answer, interprompt->answer);
+	create_location(location->answer);
 
 
     /* Tidy Up */

+ 3 - 41
general/g.proj/output.c

@@ -143,7 +143,7 @@ void print_wkt(int esristyle, int dontprettify)
     return;
 }
 
-void create_location(char *location, int interactive)
+void create_location(char *location)
 {
     int ret;
 
@@ -165,7 +165,6 @@ void create_location(char *location, int interactive)
 	/* Create flag given but no location specified; overwrite
 	 * projection files for current location */
 
-	int go_ahead = 0;
 	char *mapset = G_mapset();
 	struct Key_Value *old_projinfo = NULL, *old_projunits = NULL;
 	struct Cell_head old_cellhd;
@@ -184,43 +183,9 @@ void create_location(char *location, int interactive)
 	    old_projunits = G_get_projunits();
 	}
 
-	if (old_projinfo && old_projunits) {
-	    if (interactive) {
-		/* Warn as in g.setproj before overwriting current location */
-		fprintf(stderr,
-			_
-			("\n\nWARNING!  A projection file already exists for this location\n"));
-		fprintf(stderr,
-			"\nThis file contains all the parameters for the\nlocation's projection: %s\n",
-			G_find_key_value("proj", old_projinfo));
-		fprintf(stderr,
-			"\n    Overriding this information implies that the old projection parameters\n");
-		fprintf(stderr,
-			"    were incorrect.  If you change the parameters, all existing data will be\n");
-		fprintf(stderr,
-			"    interpreted differently by the projection software.\n%c%c%c",
-			7, 7, 7);
-		fprintf(stderr,
-			"    GRASS will not re-project your data automatically\n\n");
-
-		if (G_yes
-		    (_
-		     ("Would you still like to overwrite the current projection information "),
-		     0))
-		    go_ahead = 1;
-	    }
-	    else
-		go_ahead = 1;
-	}
-	else {
-	    /* Projection files missing for some reason;
-	     * go ahead and update */
-	    go_ahead = 1;
-	}
-
-	if (go_ahead) {
+	{
 	    int out_stat;
-	    char path[4096];
+	    char path[GPATH_MAX];
 
 	    /* Write out the PROJ_INFO, and PROJ_UNITS if available. */
 	    if (projinfo != NULL) {
@@ -250,9 +215,6 @@ void create_location(char *location, int interactive)
 	    }
 	    G_message(_("Projection information updated!"));
 	}
-	else
-	    G_message(_("The projection information will not be updated."));
-
     }
 
     return;

+ 0 - 160
general/manage/lib/menu.c

@@ -1,160 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-#include <grass/gis.h>
-#include "list.h"
-
-static int count;
-static char **text;
-static int first, last;
-
-int menu(int type)
-{
-    int i;
-    int n;
-    int x;
-    char buf[100];
-
-    build_menu();
-
-    first = 0;
-
-    while (1) {
-	last = first + 30;
-	if (last > count)
-	    last = count;
-
-	G_clear_screen();
-	switch (type) {
-	case RENAME:
-	    fprintf(stdout, "RENAME");
-	    break;
-	case REMOVE:
-	    fprintf(stdout, "REMOVE");
-	    break;
-	case COPY:
-	    fprintf(stdout, "COPY");
-	    break;
-	case LIST:
-	    fprintf(stdout, "LIST");
-	    break;
-	}
-	fprintf(stdout, " FACILITY\n\n");
-	fprintf(stdout, "This program allows you to ");
-	switch (type) {
-	case RENAME:
-	    fprintf(stdout, "rename files found in your mapset");
-	    break;
-	case REMOVE:
-	    fprintf(stdout, "remove files found in your mapset");
-	    break;
-	case COPY:
-	    fprintf(stdout, "copy files from other mapsets into your mapset");
-	    break;
-	case LIST:
-	    fprintf(stdout, "list files from mapsets in your search path");
-	    break;
-	}
-	fprintf(stdout, "\n\n");
-	fprintf(stdout, "Please select the type of file to be ");
-	switch (type) {
-	case RENAME:
-	    fprintf(stdout, "renamed");
-	    break;
-	case REMOVE:
-	    fprintf(stdout, "removed");
-	    break;
-	case COPY:
-	    fprintf(stdout, "copied");
-	    break;
-	case LIST:
-	    fprintf(stdout, "listed");
-	    break;
-	}
-
-	fprintf(stdout, "\n\n");
-	display_menu();
-	fprintf(stdout, "\n");
-
-	if (first > 0)
-	    fprintf(stdout, "  -    to see previous menu page\n");
-	if (last < count)
-	    fprintf(stdout, "  +    to see next menu page\n");
-	fprintf(stdout, "RETURN to exit\n\n");
-
-	fprintf(stdout, "> ");
-
-	if (!G_gets(buf))
-	    continue;
-	if (*buf == 0) {
-	    free_menu();
-	    return -1;
-	}
-	G_strip(buf);
-	if (first > 0 && strcmp(buf, "-") == 0) {
-	    first -= 30;
-	    if (first < 0)
-		first = 0;
-	    continue;
-	}
-	if (last < count && strcmp(buf, "+") == 0) {
-	    first = last;
-	    continue;
-	}
-	if (sscanf(buf, "%d", &x) != 1)
-	    continue;
-	i = 1;
-	for (n = 0; n < nlist; n++)
-	    if (list[n].status && (i++ == x)) {
-		free_menu();
-		return n;
-	    }
-    }
-}
-
-int build_menu(void)
-{
-    char buf[100];
-    int n;
-
-    count = 0;
-    text = 0;
-    for (n = 0; n < nlist; n++)
-	if (list[n].status) {
-	    sprintf(buf, "%3d %-.30s", ++count, list[n].text);
-	    text = (char **)G_realloc(text, count * sizeof(char *));
-	    text[count - 1] = G_store(buf);
-	}
-
-    return 0;
-}
-
-int free_menu(void)
-{
-    while (count-- > 0)
-	G_free(text[count]);
-
-    return 0;
-}
-int display_menu(void)
-{
-    int left, right;
-    int i;
-
-    left = first;
-    right = first + 15;
-
-    for (i = 0; i < 15; i++) {
-	if (left >= last)
-	    break;
-	if (right >= last)
-	    fprintf(stdout, "  %-35.35s\n", text[left]);
-	else
-	    fprintf(stdout, "  %-35.35s  %-35.35s\n", text[left],
-		    text[right]);
-
-	left++;
-	right++;
-    }
-
-    return 0;
-}

+ 2 - 2
imagery/i.class/Makefile

@@ -2,8 +2,8 @@ MODULE_TOPDIR = ../..
 
 PGM = i.class
 
-LIBES     = $(IMAGERYLIB) $(DISPLAYLIB) $(RASTERLIB) $(GISLIB) $(VASKLIB) $(CURSES) $(GMATHLIB)
-DEPENDENCIES= $(IMAGERYDEP) $(DISPLAYDEP) $(RASTERDEP) $(GISDEP) $(VASKDEP) $(GMATHDEP)
+LIBES     = $(IMAGERYLIB) $(DISPLAYLIB) $(RASTERLIB) $(GISLIB) $(GMATHLIB)
+DEPENDENCIES= $(IMAGERYDEP) $(DISPLAYDEP) $(RASTERDEP) $(GISDEP) $(GMATHDEP)
 
 include $(MODULE_TOPDIR)/include/Make/Module.make
 

+ 0 - 3
include/Make/Platform.make.in

@@ -90,9 +90,6 @@ XMLIB               = @XMLIB@
 XEXTRALIBS          = @X_EXTRA_LIBS@
 USE_X11             = @USE_X11@
 
-COMPATLIB           = @COMPATLIB@
-CURSES              = @CURSESLIB@ $(COMPATLIB)
-USE_CURSES          = @USE_CURSES@
 MATHLIB             = @MATHLIB@ 
 XDRLIB              = @XDRLIB@ @ZLIBINCPATH@ @ZLIBLIBPATH@ @ZLIB@
 ICONVLIB            = @ICONVLIB@

+ 0 - 4
include/P_site.h

@@ -36,10 +36,6 @@ struct Map_info *G_sites_open_new(const char *name);
 void G_sites_close(struct Map_info *);
 char *G_find_sites(char *name, const char *mapset);
 char *G_find_sites2(const char *name, const char *mapset);
-char *G_ask_sites_new(const char *prompt, char *name);
-char *G_ask_sites_old(const char *prompt, char *name);
-char *G_ask_sites_any(const char *prompt, char *name);
-char *G_ask_sites_in_mapset(const char *prompt, char *name);
 int G__site_put(struct Map_info *, Site *, int);
 
 struct Map_info *G_fopen_sites_old(const char *, const char *);

+ 0 - 9
include/config.h.in

@@ -20,12 +20,6 @@
 /* define for Windows static build */
 #undef STATIC_BUILD
 
-/* define if curses.h exists */
-#undef HAVE_CURSES_H
-
-/* define if keypad in lib[n]curses */
-#undef HAVE_KEYPAD
-
 /* define if limits.h exists */
 #undef HAVE_LIMITS_H
 
@@ -95,9 +89,6 @@
 /* Define the return type of signal handlers */
 #define RETSIGTYPE int
 
-/* define curses.h WINDOW structure component */
-#define CURSES_MAXY @CURSES_MAXY@
-
 /* define if ftime() exists */
 #undef HAVE_FTIME
 

+ 0 - 16
include/edit.h

@@ -1,16 +0,0 @@
-#ifndef GRASS_EDIT_H
-#define GRASS_EDIT_H
-
-#include <grass/gis.h>
-
-/* edit_cats.c */
-int E_edit_cats(const char *, struct Categories *, int);
-int E_edit_fp_cats(const char *, struct Categories *);
-
-/* edit_cellhd.c */
-int E_edit_cellhd(struct Cell_head *, int);
-
-/* edit_hist.c */
-int E_edit_history(struct History *);
-
-#endif

+ 0 - 45
include/gisdefs.h

@@ -81,33 +81,6 @@ double G_area_for_zone_on_sphere(double, double);
 /* ascii_chk.c */
 int G_ascii_check(char *);
 
-/* ask.c */
-char *G_ask_new(const char *, char *, char *, char *);
-char *G_ask_new_ext(const char *, char *, char *, char *, char *, int (*)());
-char *G_ask_old(const char *, char *, char *, char *);
-char *G_ask_old_ext(const char *, char *, char *, char *, char *, int (*)());
-char *G_ask_any(const char *, char *, char *, char *, int);
-char *G_ask_any_ext(const char *, char *, char *, char *, int, char *,
-		    int (*)());
-char *G_ask_in_mapset(const char *, char *, char *, char *);
-char *G_ask_in_mapset_ext(const char *, char *, char *, char *, char *,
-			  int (*)());
-char *G_ask_new_file(const char *, char *, char *, char *);
-char *G_ask_old_file(const char *, char *, char *, char *);
-int G_set_ask_return_msg(const char *);
-char *G_get_ask_return_msg(void);
-
-/* ask_cell.c */
-char *G_ask_cell_new(const char *, char *);
-char *G_ask_cell_old(const char *, char *);
-char *G_ask_cell_in_mapset(const char *, char *);
-char *G_ask_cell_any(const char *, char *);
-
-/* ask_vctrs.c */
-char *G_ask_vector_new(const char *, char *);
-char *G_ask_vector_old(const char *, char *);
-char *G_ask_vector_any(const char *, char *);
-char *G_ask_vector_in_mapset(const char *, char *);
 
 /* asprintf.c */
 /* Do it better if you know how */
@@ -563,12 +536,6 @@ double G_geodesic_distance(double, double, double, double);
 /* get_cellhd.c */
 int G_get_cellhd(const char *, const char *, struct Cell_head *);
 
-/* get_datum_name.c */
-int G_ask_datum_name(char *, char *);
-
-/* get_ell_name.c */
-int G_ask_ellipse_name(char *);
-
 /* get_ellipse.c */
 int G_get_ellipsoid_parameters(double *, double *);
 int G_get_spheroid_by_name(const char *, double *, double *, double *);
@@ -580,9 +547,6 @@ char *G_ellipsoid_description(int);
 struct Key_Value *G_get_projunits(void);
 struct Key_Value *G_get_projinfo(void);
 
-/* get_projname.c */
-int G_ask_proj_name(char *, char *);
-
 /* get_row.c */
 int G_get_map_row_nomask(int, CELL *, int);
 int G_get_raster_row_nomask(int, void *, int, RASTER_MAP_TYPE);
@@ -611,9 +575,6 @@ char *G__get_window(struct Cell_head *, const char *, const char *,
 int G_getl(char *, int, FILE *);
 int G_getl2(char *, int, FILE *);
 
-/* gets.c */
-int G_gets(char *);
-
 /* gisbase.c */
 char *G_gisbase(void);
 
@@ -780,9 +741,6 @@ int G_lzw_transfer_expand(int, int, int);
 /* mach_name.c */
 char *G__machine_name(void);
 
-/* make_colr.c */
-int G_ask_colors(const char *, const char *, struct Colors *);
-
 /* make_loc.c */
 int G__make_location(const char *, struct Cell_head *, struct Key_Value *,
 		     struct Key_Value *, FILE *);
@@ -1271,9 +1229,6 @@ int G__write_Cell_head3(FILE *, const struct Cell_head *, int);
 /* writ_zeros.c */
 int G_write_zeros(int, size_t);
 
-/* yes.c */
-int G_yes(const char *, int);
-
 /* zero.c */
 int G_zero(void *, int);
 

+ 0 - 1
include/gprojects.h

@@ -95,7 +95,6 @@ int GPJ_get_default_datum_params_by_name(const char *, char **);
 int GPJ_get_datum_params(char **, char **);
 int GPJ__get_datum_params(struct Key_Value *, char **, char **);
 void GPJ_free_datum(struct gpj_datum *);
-int GPJ_ask_datum_params(const char *, char **);
 struct gpj_datum_transform_list *GPJ_get_datum_transform_by_name(const char
 								 *inputname);
 

+ 0 - 3
include/imagedefs.h

@@ -13,9 +13,6 @@ int I_free_double2(double **);
 double ***I_alloc_double3(int, int, int);
 int I_free_double3(double ***);
 
-/* ask_group.c */
-int I_ask_group_old(char *, char *);
-
 /* eol.c */
 int I_get_to_eol(char *, int, FILE *);
 

+ 0 - 84
include/vask.h

@@ -1,84 +0,0 @@
-#ifndef __VASK_H__
-#define __VASK_H__
-
-#include	<signal.h>
-#include	<curses.h>
-
-#ifdef MAKE_VASK_LIB
-#define 	MAX_ANSW	80
-#define 	MAX_CONST	80
-#define 	MAX_LINE	23
-
-/**
-*** target contains all the variable type that we will want to
-*** be looking for.
-**/
-union target
-{
-    char *c;
-    short *h;
-    int *i;
-    long *l;
-    float *f;
-    double *d;
-    double for_alignement;
-};
-
-/**
-*** ans_rec contains all the information needed to go
-*** and get an answer from the screen.
-**/
-struct ans_rec
-{
-    union target targetptr;	/* pointer to value     */
-    int var_type;		/* value type           */
-    int row;			/* row position         */
-    int col;			/* column position      */
-    int length;			/* length of entry      */
-    int decimal_places;		/* number of decimal places */
-};
-
-/**
-*** page is an array of pointers to lines on a page.
-**/
-struct page
-{
-    const char *line[MAX_LINE];
-};
-
-struct V__
-{
-    struct ans_rec usr_answ[MAX_ANSW];
-    struct ans_rec constant[MAX_CONST];
-
-    struct page page;
-
-    int NUM_ANSW;
-    int NUM_CONST;
-    int NUM_LINE;
-
-    int decimal_places;
-    char interrupt_msg[80];
-};
-
-/* one of the library routines (V_call) will define this struct */
-extern struct V__ V__;
-
-#endif
-
-void V_float_accuracy(int);
-int V_call(void);
-void V_intrpt_ok(void);
-void V_intrpt_msg(const char *);
-void V_clear(void);
-int V_const(void *, int, int, int, int);
-void V_error(const char *, ...);
-void V_exit(void);
-void V_init(void);
-int V_line(int, const char *);
-int V_ques(void *, int, int, int, int);
-int V__dump_window(void);
-void V__remove_trail(int, char *);
-void V__trim_decimal(char *);
-
-#endif /* __VASK_H__ */

+ 0 - 2
lib/Makefile

@@ -14,8 +14,6 @@ SUBDIRS = \
 	btree \
 	display \
 	db \
-	vask \
-	edit \
 	external \
 	fonts \
 	gtcltk \

+ 0 - 10
lib/edit/Makefile

@@ -1,10 +0,0 @@
-MODULE_TOPDIR = ../..
-
-EXTRA_LIBS=$(GISLIB) $(VASKLIB)
-
-LIB_NAME = $(EDIT_LIBNAME)
-
-include $(MODULE_TOPDIR)/include/Make/Lib.make
-
-default: lib
-

+ 0 - 380
lib/edit/edit_cats.c

@@ -1,380 +0,0 @@
-
-/****************************************************************************
- *
- * MODULE:       edit library functions
- * AUTHOR(S):    Originally part of gis lib dir in CERL GRASS code
- *               Subsequent (post-CVS) contributors:
- *               Glynn Clements <glynn gclements.plus.com>,
- *               Radim Blazek <radim.blazek gmail.com>,
- *               Eric G. Miller <egm2 jps.net>,
- *               Markus Neteler <neteler itc.it>,
- *               Brad Douglas <rez touchofmadness.com>,
- *               Bernhard Reiter <bernhard intevation.de>
- * PURPOSE:      libraries for interactively editing raster support data
- * COPYRIGHT:    (C) 1996-2006 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.
- *
- *****************************************************************************/
-
-/**********************************************************************
- *
- *   E_edit_cats (name, cats, option)
- *      char *name
- *      struct Categories *cats 
- *
- *   Interactively prompts the user for category names for
- *   cats->ncats categories.  Uses screen oriented prompting through
- *   the visual_ask library.  Compile with $(VASKLIB) and $(CURSES)
- *
- *   name is used for informatin on the screen only.
- *   No files are read or written
- *
- *   If option is 0, user can change number of cats
- *                1, user must initialize number of cats
- *               -1, user may not change number of cats
- *
- *
- *   Returns:
- *            -1 if user canceled the edit
- *             1 if ok
- *
- *   note:
- *      at present, this routine pretends to know nothing about the
- *      category label generation capabilities using the cats.fmt
- *      string. If it is necessary to let the user edit this
- *      a separate interface must be used
- **********************************************************************/
-#include <string.h>
-#include <stdlib.h>
-#include <grass/gis.h>
-#include <grass/vask.h>
-#include <grass/edit.h>
-
-
-#define NLINES 10
-
-
-int E_edit_cats(const char *name, struct Categories *cats, int option)
-{
-    long incr;
-    long atnum;
-    long startcat;
-    long endcat;
-    long first_cat, last_cat;
-    long catnum[NLINES];
-    char buff[NLINES][80];
-    char next[20];
-    char next_line[80];
-    char title[80];
-    char msg1[80];
-    char msg2[80];
-    int line;
-    CELL max_ind, max_cat, min_ind;
-    DCELL max_val, min_val;
-
-    if (G_quant_get_limits
-	(&cats->q, &min_val, &max_val, &min_ind, &max_ind) < 0)
-	max_cat = 0;
-    else
-	max_cat = (CELL) max_val;
-
-    if (max_cat < 0)
-	option = 1;
-
-    last_cat = (long)max_cat;
-    if (option >= 0) {
-	V_clear();
-	V_line(1, msg1);
-	V_line(2, msg2);
-
-	if (option == 0) {
-	    strcpy(msg1, "The current value for the highest category");
-	    sprintf(msg2, "in [%s] is shown below", name);
-	    V_line(3, "If you need to change it, enter another value");
-	}
-	else {
-	    last_cat = 0;
-	    strcpy(msg1, "Please enter the highest category value");
-	    sprintf(msg2, "for [%s]", name);
-	}
-
-	V_line(10, "         Highest Category:");
-	V_ques(&last_cat, 'l', 10, 28, 5);
-	V_line(16, next_line);
-
-	*next_line = 0;
-	while (1) {
-	    V_intrpt_ok();
-	    if (!V_call())
-		return -1;
-
-	    if (last_cat >= 0)
-		break;
-
-	    sprintf(next_line, "** Negative values not allowed **");
-	}
-    }
-
-    max_cat = last_cat;
-
-    first_cat = 0;
-    if (cats->ncats > 0 && min_val < 0)
-	first_cat = (CELL) min_val;
-
-    *title = 0;
-    if (cats->title != NULL)
-	strcpy(title, cats->title);
-
-    startcat = first_cat;
-    sprintf(msg1, "[%s] ENTER NEW CATEGORY NAMES FOR THESE CATEGORIES", name);
-
-    while (1) {
-	V_clear();
-	V_line(0, msg1);
-	V_line(2, "TITLE: ");
-	V_line(3, "CAT   NEW CATEGORY NAME");
-	V_line(4, "NUM");
-
-	V_ques(title, 's', 2, 8, 60);
-
-	endcat =
-	    startcat + NLINES <=
-	    last_cat + 1 ? startcat + NLINES : last_cat + 1;
-
-	line = 5;
-	for (incr = startcat; incr < endcat; incr++) {
-	    atnum = incr - startcat;
-	    strcpy(buff[atnum], G_get_cat((CELL) incr, cats));
-	    catnum[atnum] = incr;
-	    V_const(&catnum[atnum], 'l', line, 1, 3);
-	    V_ques(buff[atnum], 's', line, 5, 60);
-	    line++;
-	}
-
-	line += 2;
-	*next = 0;
-	if (endcat > last_cat)
-	    strcpy(next, "end");
-	else
-	    sprintf(next, "%ld", endcat);
-	sprintf(next_line, "%*s%*s  (of %ld)", 41,
-		"Next category ('end' to end): ", 5, "", last_cat);
-	V_line(line, next_line);
-	V_ques(next, 's', line, 41, 5);
-
-	V_intrpt_ok();
-	if (!V_call())
-	    return -1;
-
-	/* store new category name in structure */
-	for (incr = startcat; incr < endcat; incr++) {
-	    atnum = incr - startcat;
-	    G_strip(buff[atnum]);
-	    if (strcmp(buff[atnum], G_get_cat((CELL) incr, cats)) != 0)
-		G_set_cat((CELL) incr, buff[atnum], cats);
-	}
-
-	if (*next == 0)
-	    break;
-	if (strcmp(next, "end") == 0)
-	    break;
-	if (sscanf(next, "%ld", &endcat) != 1)
-	    continue;
-
-	if (endcat < first_cat)
-	    endcat = first_cat;
-
-	if (endcat > last_cat) {
-	    endcat = last_cat - NLINES + 1;
-	    if (endcat < 0)
-		endcat = 0;
-	}
-	startcat = endcat;
-    }
-    if (cats->title)
-	G_free(cats->title);
-
-    G_strip(title);
-    cats->title = G_store(title);
-
-    return (1);
-}
-
-
-/**********************************************************************
- *
- *   E_edit_fp_cats (name, cats)
- *      char *name
- *      struct Categories *cats 
- *
- *   Interactively prompts the user for category names for
- *   fp ranges of data.  Uses screen oriented prompting through
- *   the visual_ask library.  Compile with $(VASKLIB) and $(CURSES)
- *
- *   name is used for informatin on the screen only.
- *   No files are read or written
- *
- *   Returns:
- *            -1 if user canceled the edit
- *             1 if ok
- *
- *   note:
- *      at present, this routine pretends to know nothing about the
- *      category label generation capabilities using the cats.fmt
- *      string. If it is necessary to let the user edit this
- *      a separate interface must be used
- **********************************************************************/
-
-#define NLINES 10
-
-int E_edit_fp_cats(const char *name, struct Categories *cats)
-{
-    long incr;
-    long atnum;
-    long startcat;
-    long endcat;
-    char buff[NLINES][60];
-    char next[20];
-    char next_line[80];
-    char title[80];
-    char msg1[80];
-    char msg2[80];
-    int line, ncats;
-    size_t lab_len;
-    DCELL max_val[NLINES], min_val[NLINES];
-    DCELL dmin, dmax;
-    CELL tmp_cell;
-    struct Categories old_cats;
-    struct FPRange fp_range;
-
-    if (G_read_fp_range(name, G_mapset(), &fp_range) < 0)
-	G_fatal_error("can't read the floating point range for %s", name);
-
-    G_get_fp_range_min_max(&fp_range, &dmin, &dmax);
-    /* first save old cats */
-    G_copy_raster_cats(&old_cats, cats);
-
-    G_init_raster_cats(old_cats.title, cats);
-    G_free_raster_cats(cats);
-
-    ncats = old_cats.ncats;
-    V_clear();
-
-    if (!ncats)
-	sprintf(msg1, "There are no predefined fp ranges to label");
-    else
-	sprintf(msg1, "There are %d predefined fp ranges to label", ncats);
-    sprintf(msg2, "Enter the number of fp ranges you want to label");
-
-    V_line(1, msg1);
-    V_line(2, msg2);
-    V_ques(&ncats, 'l', 2, 48, 5);
-    V_line(16, next_line);
-    *next_line = 0;
-    V_intrpt_ok();
-
-    if (!V_call())
-	return -1;
-
-    *title = 0;
-    if (old_cats.title != NULL)
-	strcpy(title, old_cats.title);
-
-    startcat = 0;
-    sprintf(msg1, "The fp data in map %s ranges from %f to %f", name, dmin,
-	    dmax);
-    sprintf(msg2, "[%s] ENTER NEW CATEGORY NAMES FOR THESE CATEGORIES", name);
-
-    while (1) {
-	V_clear();
-	V_line(0, msg1);
-	V_line(1, msg2);
-	V_line(3, "TITLE: ");
-	V_line(4, "FP RANGE           NEW CATEGORY NAME");
-
-	V_ques(title, 's', 2, 8, 60);
-
-	endcat = startcat + NLINES <= ncats ? startcat + NLINES : ncats;
-
-	line = 6;
-	for (incr = startcat; incr < endcat; incr++) {
-	    atnum = incr - startcat;
-	    if (incr < old_cats.ncats) {
-		/* if editing existing range label */
-		lab_len = strlen(old_cats.labels[incr]);
-		if (lab_len > 58)
-		    lab_len = 58;
-		strncpy(buff[atnum], old_cats.labels[incr], lab_len);
-		buff[atnum][lab_len] = 0;
-		G_quant_get_ith_rule(&old_cats.q, incr, &min_val[atnum],
-				     &max_val[atnum], &tmp_cell, &tmp_cell);
-	    }
-	    else {
-		/* adding new range label */
-		strcpy(buff[atnum], "");
-		max_val[atnum] = min_val[atnum] = 0;
-	    }
-
-	    V_ques(&min_val[atnum], 'd', line, 1, 8);
-	    V_const("-", 's', line, 9, 1);
-	    V_ques(&max_val[atnum], 'd', line, 10, 8);
-	    V_ques(buff[atnum], 's', line, 19, 58);
-	    line++;
-	}
-
-	line += 2;
-	*next = 0;
-	if (endcat >= ncats)
-	    strcpy(next, "end");
-	else
-	    sprintf(next, "%ld", endcat);
-	sprintf(next_line, "%*s%*s  (of %d)", 41,
-		"Next range number ('end' to end): ", 5, "", ncats);
-	V_line(line, next_line);
-	V_ques(next, 's', line, 41, 5);
-
-	V_intrpt_ok();
-	if (!V_call())
-	    return -1;
-
-	/* store new category name in structure */
-	for (incr = startcat; incr < endcat; incr++) {
-	    atnum = incr - startcat;
-	    G_strip(buff[atnum]);
-
-	    /* adding new range label */
-	    if (!(strcmp(buff[atnum], "") == 0 &&
-		  min_val[atnum] == 0. && max_val[atnum] == 0.))
-		G_set_d_raster_cat(&min_val[atnum], &max_val[atnum],
-				   buff[atnum], cats);
-	}
-
-	if (*next == 0)
-	    break;
-	if (strcmp(next, "end") == 0)
-	    break;
-	if (sscanf(next, "%ld", &endcat) != 1)
-	    continue;
-
-	if (endcat < 0)
-	    endcat = 0;
-
-	if (endcat > ncats) {
-	    endcat = ncats - NLINES + 1;
-	    if (endcat < 0)
-		endcat = 0;
-	}
-	startcat = endcat;
-    }
-
-    G_strip(title);
-    cats->title = G_store(title);
-    /* since label pointers in old_cats point to the old allocated strings,
-       and cats now has all the newly allocated strings, it never reuses
-       old ones, we need to free them */
-
-    return (1);
-}

+ 0 - 604
lib/edit/edit_cellhd.c

@@ -1,604 +0,0 @@
-
-/****************************************************************************
- *
- * MODULE:       edit library functions
- * AUTHOR(S):    Originally part of gis lib dir in CERL GRASS code
- *               Subsequent (post-CVS) contributors:
- *               Glynn Clements <glynn gclements.plus.com>,
- *               Radim Blazek <radim.blazek gmail.com>,
- *               Eric G. Miller <egm2 jps.net>,
- *               Markus Neteler <neteler itc.it>,
- *               Brad Douglas <rez touchofmadness.com>,
- *               Bernhard Reiter <bernhard intevation.de>
- * PURPOSE:      libraries for interactively editing raster support data
- * COPYRIGHT:    (C) 1996-2006 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.
- *
- *****************************************************************************/
-#define AS_CELLHD 1
-#define AS_WINDOW 0
-#define AS_DEF_WINDOW -1
-
-/* modified 26nov to use word region instead of window
- * as far as the USER is concerned.
- */
-/*
- **********************************************************************
- *
- *   E_edit_cellhd (cellhd, type)
- *      struct Cell_head *cellhd   (cellhd to be defined)
- *      int type 
- *        0 = region - user input resolutions
- *       -1 = default region - user input resolutions
- *        1 = cellhd - rows and cols must be set
- *
- *   Screen oriented user interactive session for modifying a cell header
- *   or region.
- *   Uses the visual_ask V_ask routines.  As such, programs including
- *   this must load the GRASS library $(VASKLIB) and include $(CURSES) in
- *   in the compile line
- *
- *   returns:
- *      -1 error of some sort, or user cancels the edit
- *       0 ok
- *
- **********************************************************************/
-
-/* Documentation moved here from the g.region man page:
- *  (g.region no longer does interactive; lib/init/set_data.c is the
- *   only thing left using E_edit_cellhd() AFAICT.  --HB 28 Jan 2008)
- *
- * <h2>REGION EDIT PROMPT</h2>
- *
- * Most of the options will require the user to edit a
- * geographic region, be it the current geographic region or
- * one stored in the user's named region definitions
- * (the <kbd>windows</kbd> directory).  A standard prompt is
- * used to perform this edit.  An example is shown below:
- *
- *
- *
- * <pre>
- * ---------------------------------------------------------------
- *  |                         IDENTIFY REGION                     |
- *  |                                                             |
- *  |           ===========  DEFAULT REGION  ==========           |
- *  |           |    Default North: 3402025.00        |           |
- *  |           |                                     |           |
- *  |           |          ===YOUR REGION===          |           |
- *  |           |          |  NORTH EDGE   |          |           |
- *  |           |          |  3402025.00_  |          |           |
- *  |           |          |               |          |           |
- *  | Def West: |WEST EDGE |               |EAST EDGE | Def.East: |
- *  | 233975.00 |233975.00_|               |236025.00_| 236025.00 |
- *  |           |          |  SOUTH EDGE   |          |           |
- *  |           |          |  3399975.00_  |          |           |
- *  |           |          =================          |           |
- *  |           |                                     |           |
- *  |           |    Default South: 3399975.00        |           |
- *  |           =======================================           |
- *  |                                                             |
- *  |              Default   GRID RESOLUTION   Region             |
- *  |               50.00   --- East-West ---  50.00__            |
- *  |               50.00   -- North-South --  50.00__            |
- *  |                                                             |
- *  |                                                             |
- *  |     AFTER COMPLETING ALL ANSWERS, HIT &lt;ESC&gt; TO CONTINUE     |
- *  ---------------------------------------------------------------
- *  </pre>
- *
- *  The fields NORTH EDGE, SOUTH EDGE, WEST EDGE and EAST EDGE,
- *  are the boundaries of the geographic region that the user
- *  can change.  The fields Default North, Default South, Def
- *  West and Def East are the boundaries of the default
- *  geographic region that are displayed for reference and
- *  <em>cannot</em> be changed.  The two GRID RESOLUTION Region
- *  fields (east-west, and north-south) are the geographic
- *  region's cell resolutions that the user can change.  The
- *  two GRID RESOLUTION Default fields list the resolutions of
- *  the default geographic region;  these are displayed for
- *  reference and cannot be changed here by the user.
- *
- */
-
-#include <string.h>
-#include <stdlib.h>
-#include <grass/vask.h>
-#include <grass/gis.h>
-#include <grass/edit.h>
-
-
-static void format_value(int (*func) (double, char *, int),
-			 double x, char *buf, int projection);
-static void format_northing(double north, char *buf, int projection);
-static void format_easting(double east, char *buf, int projection);
-static void format_resolution(double res, char *buf, int projection);
-static int hitreturn(void);
-
-
-static char *cellhd_screen[] = {
-    "                           IDENTIFY CELL HEADER",
-    "",
-    "           ============================= DEFAULT REGION ========",
-    "           |          Default North:                           |",
-    "           |                                                   |",
-    "           |           =======  CELL HEADER  =======           |",
-    "           |           | NORTH EDGE:               |           |",
-    "           |           |                           |           |",
-    " Def. West |WEST EDGE  |                           |EAST EDGE  | Def. East",
-    "           |           |                           |           |",
-    "           |           | SOUTH EDGE:               |           |",
-    "           |           =============================           |",
-    "           |                                                   |",
-    "           |          Default South:                           |",
-    "           =====================================================",
-    "           PROJECTION:                                ZONE:",
-    NULL
-};
-
-static char *window_screen[] = {
-    "                              IDENTIFY REGION",
-    "",
-    "           ============================= DEFAULT REGION ========",
-    "           |          Default North:                           |",
-    "           |                                                   |",
-    "           |           =======  YOUR REGION  =======           |",
-    "           |           | NORTH EDGE:               |           |",
-    "           |           |                           |           |",
-    " Def. West |WEST EDGE  |                           |EAST EDGE  | Def. East",
-    "           |           |                           |           |",
-    "           |           | SOUTH EDGE:               |           |",
-    "           |           =============================           |",
-    "           |                                                   |",
-    "           |          Default South:                           |",
-    "           =====================================================",
-    "           PROJECTION:                                ZONE:",
-    "",
-    "                   Default   GRID RESOLUTION   Region",
-    "                            --- East-West ---",
-    "                            -- North-South --",
-    NULL
-};
-
-static char *def_window_screen[] = {
-    "                         DEFINE THE DEFAULT REGION",
-    "",
-    "",
-    "",
-    "",
-    "                       ====== DEFAULT REGION =======",
-    "                       | NORTH EDGE:               |",
-    "                       |                           |",
-    "            WEST EDGE  |                           |EAST EDGE",
-    "                       |                           |",
-    "                       | SOUTH EDGE:               |",
-    "                       =============================",
-    "",
-    "",
-    "",
-    "           PROJECTION:                                ZONE:",
-    "",
-    "                             GRID RESOLUTION",
-    "                                 East-West:",
-    "                               North-South:",
-    NULL
-};
-
-
-static void format_value(int (*func) (double, char *, int),
-			 double x, char *buf, int projection)
-{
-    if (projection != PROJECTION_XY) {
-	int k = (projection == PROJECTION_LL) ? 3600 : 1;
-	int i = (int)(x * k + (x < 0 ? -0.5 : 0.5));
-
-	x = (double)i / k;
-    }
-
-    func(x, buf, projection);
-    buf[10] = '\0';
-}
-
-
-static void format_northing(double north, char *buf, int projection)
-{
-    format_value(G_format_northing, north, buf, projection);
-}
-
-
-static void format_easting(double east, char *buf, int projection)
-{
-    format_value(G_format_easting, east, buf, projection);
-}
-
-
-static void format_resolution(double res, char *buf, int projection)
-{
-    format_value(G_format_resolution, res, buf, projection);
-}
-
-
-int E_edit_cellhd(struct Cell_head *cellhd, int type)
-{
-    char ll_north[20];
-    char ll_south[20];
-    char ll_east[20];
-    char ll_west[20];
-    char ll_nsres[20];
-    char ll_ewres[20];
-    char ll_def_north[20];
-    char ll_def_south[20];
-    char ll_def_east[20];
-    char ll_def_west[20];
-    char ll_def_ewres[20];
-    char ll_def_nsres[20];
-    char projection[80];
-    char **screen;
-
-    struct Cell_head def_wind;
-    double north, south, east, west;
-    double nsres, ewres;
-    char buf[64], buf2[30], *p;
-    short ok;
-    int line;
-    char *prj;
-    char *err;
-
-    if (type == AS_CELLHD && (cellhd->rows <= 0 || cellhd->cols <= 0)) {
-	G_message("E_edit_cellhd() - programmer error");
-	G_message("  ** rows and cols must be positive **");
-	return -1;
-    }
-    if (type != AS_DEF_WINDOW) {
-	if (G_get_default_window(&def_wind) != 1)
-	    return -1;
-
-	if (cellhd->proj < 0) {
-	    cellhd->proj = def_wind.proj;
-	    cellhd->zone = def_wind.zone;
-	}
-	else if (cellhd->zone < 0)
-	    cellhd->zone = def_wind.zone;
-    }
-
-    prj = G__projection_name(cellhd->proj);
-    if (!prj)
-	prj = "** unknown **";
-    sprintf(projection, "%d (%s)", cellhd->proj, prj);
-
-    if (type != AS_DEF_WINDOW) {
-	if (cellhd->west >= cellhd->east || cellhd->south >= cellhd->north) {
-	    cellhd->north = def_wind.north;
-	    cellhd->south = def_wind.south;
-	    cellhd->west = def_wind.west;
-	    cellhd->east = def_wind.east;
-
-	    if (type != AS_CELLHD) {
-		cellhd->ew_res = def_wind.ew_res;
-		cellhd->ns_res = def_wind.ns_res;
-		cellhd->rows = def_wind.rows;
-		cellhd->cols = def_wind.cols;
-	    }
-	}
-
-	if (cellhd->proj != def_wind.proj) {
-	    if (type == AS_CELLHD)
-		G_message
-		    ("header projection %d differs from default projection %d",
-		     cellhd->proj, def_wind.proj);
-	    else
-		G_message
-		    ("region projection %d differs from default projection %d",
-		     cellhd->proj, def_wind.proj);
-
-	    if (!G_yes("do you want to make them match? ", 1))
-		return -1;
-
-	    cellhd->proj = def_wind.proj;
-	    cellhd->zone = def_wind.zone;
-	}
-
-	if (cellhd->zone != def_wind.zone) {
-	    if (type == AS_CELLHD)
-		G_message("header zone %d differs from default zone %d",
-			  cellhd->zone, def_wind.zone);
-	    else
-		G_message("region zone %d differs from default zone %d",
-			  cellhd->zone, def_wind.zone);
-
-	    if (!G_yes("do you want to make them match? ", 1))
-		return -1;
-
-	    cellhd->zone = def_wind.zone;
-	}
-
-	*ll_def_north = 0;
-	*ll_def_south = 0;
-	*ll_def_east = 0;
-	*ll_def_west = 0;
-	*ll_def_ewres = 0;
-	*ll_def_nsres = 0;
-	format_northing(def_wind.north, ll_def_north, def_wind.proj);
-	format_northing(def_wind.south, ll_def_south, def_wind.proj);
-	format_easting(def_wind.east, ll_def_east, def_wind.proj);
-	format_easting(def_wind.west, ll_def_west, def_wind.proj);
-	format_resolution(def_wind.ew_res, ll_def_ewres, def_wind.proj);
-	format_resolution(def_wind.ns_res, ll_def_nsres, def_wind.proj);
-    }
-
-    *ll_north = 0;
-    *ll_south = 0;
-    *ll_east = 0;
-    *ll_west = 0;
-    *ll_ewres = 0;
-    *ll_nsres = 0;
-    format_northing(cellhd->north, ll_north, cellhd->proj);
-    format_northing(cellhd->south, ll_south, cellhd->proj);
-    format_easting(cellhd->east, ll_east, cellhd->proj);
-    format_easting(cellhd->west, ll_west, cellhd->proj);
-    format_resolution(cellhd->ew_res, ll_ewres, cellhd->proj);
-    format_resolution(cellhd->ns_res, ll_nsres, cellhd->proj);
-
-    while (1) {
-	ok = 1;
-
-	/* List window options on the screen for the user to answer */
-	switch (type) {
-	case AS_CELLHD:
-	    screen = cellhd_screen;
-	    break;
-	case AS_DEF_WINDOW:
-	    screen = def_window_screen;
-	    break;
-	default:
-	    screen = window_screen;
-	    break;
-	}
-
-	V_clear();
-	line = 0;
-	while (*screen)
-	    V_line(line++, *screen++);
-
-	/* V_ques ( variable, type, row, col, length) ; */
-	V_ques(ll_north, 's', 6, 36, 10);
-	V_ques(ll_south, 's', 10, 36, 10);
-	V_ques(ll_west, 's', 9, 12, 10);
-	V_ques(ll_east, 's', 9, 52, 10);
-
-	if (type != AS_CELLHD) {
-	    V_ques(ll_ewres, 's', 18, 48, 10);
-	    V_ques(ll_nsres, 's', 19, 48, 10);
-	}
-
-	if (type != AS_DEF_WINDOW) {
-	    V_const(ll_def_north, 's', 3, 36, 10);
-	    V_const(ll_def_south, 's', 13, 36, 10);
-	    V_const(ll_def_west, 's', 9, 1, 10);
-	    V_const(ll_def_east, 's', 9, 65, 10);
-
-	    if (type != AS_CELLHD) {
-		V_const(ll_def_ewres, 's', 18, 21, 10);
-		V_const(ll_def_nsres, 's', 19, 21, 10);
-	    }
-	}
-
-	V_const(projection, 's', 15, 23, (int)strlen(projection));
-	V_const(&cellhd->zone, 'i', 15, 60, 3);
-
-	V_intrpt_ok();
-	if (!V_call())
-	    return -1;
-
-	G_squeeze(ll_north);
-	G_squeeze(ll_south);
-	G_squeeze(ll_east);
-	G_squeeze(ll_west);
-
-	if (type != AS_CELLHD) {
-	    G_squeeze(ll_ewres);
-	    G_squeeze(ll_nsres);
-	}
-
-	if (!G_scan_northing(ll_north, &cellhd->north, cellhd->proj)) {
-	    G_warning("Illegal value for north: %s", ll_north);
-	    ok = 0;
-	}
-
-	if (!G_scan_northing(ll_south, &cellhd->south, cellhd->proj)) {
-	    G_warning("Illegal value for south: %s", ll_south);
-	    ok = 0;
-	}
-
-	if (!G_scan_easting(ll_east, &cellhd->east, cellhd->proj)) {
-	    G_warning("Illegal value for east: %s", ll_east);
-	    ok = 0;
-	}
-
-	if (!G_scan_easting(ll_west, &cellhd->west, cellhd->proj)) {
-	    G_warning("Illegal value for west: %s", ll_west);
-	    ok = 0;
-	}
-
-	if (type != AS_CELLHD) {
-	    if (!G_scan_resolution(ll_ewres, &cellhd->ew_res, cellhd->proj)) {
-		G_warning("Illegal east-west resolution: %s", ll_ewres);
-		ok = 0;
-	    }
-
-	    if (!G_scan_resolution(ll_nsres, &cellhd->ns_res, cellhd->proj)) {
-		G_warning("Illegal north-south resolution: %s", ll_nsres);
-		ok = 0;
-	    }
-	}
-
-	if (!ok) {
-	    hitreturn();
-	    continue;
-	}
-
-	/* Adjust and complete the cell header */
-	north = cellhd->north;
-	south = cellhd->south;
-	east = cellhd->east;
-	west = cellhd->west;
-	nsres = cellhd->ns_res;
-	ewres = cellhd->ew_res;
-
-	if ((err =
-	     G_adjust_Cell_head(cellhd, type == AS_CELLHD,
-				type == AS_CELLHD))) {
-	    G_message("%s", err);
-	    hitreturn();
-	    continue;
-	}
-
-	if (type == AS_CELLHD) {
-	    nsres = cellhd->ns_res;
-	    ewres = cellhd->ew_res;
-	}
-
-      SHOW:
-	fprintf(stderr, "\n\n");
-	G_message("  projection:   %s", projection);
-	G_message("  zone:         %d", cellhd->zone);
-
-	G_format_northing(cellhd->north, buf, cellhd->proj);
-	G_format_northing(north, buf2, cellhd->proj);
-	fprintf(stderr, "  north:       %s", buf);
-
-	if (strcmp(buf, buf2) != 0) {
-	    ok = 0;
-	    fprintf(stderr, "  (Changed to match resolution)");
-	}
-	fprintf(stderr, "\n");
-
-	G_format_northing(cellhd->south, buf, cellhd->proj);
-	G_format_northing(south, buf2, cellhd->proj);
-	fprintf(stderr, "  south:       %s", buf);
-	if (strcmp(buf, buf2) != 0) {
-	    ok = 0;
-	    fprintf(stderr, "  (Changed to match resolution)");
-	}
-	fprintf(stderr, "\n");
-
-	G_format_easting(cellhd->east, buf, cellhd->proj);
-	G_format_easting(east, buf2, cellhd->proj);
-	fprintf(stderr, "  east:        %s", buf);
-	if (strcmp(buf, buf2) != 0) {
-	    ok = 0;
-	    fprintf(stderr, "  (Changed to match resolution)");
-	}
-	fprintf(stderr, "\n");
-
-	G_format_easting(cellhd->west, buf, cellhd->proj);
-	G_format_easting(west, buf2, cellhd->proj);
-	fprintf(stderr, "  west:        %s", buf);
-	if (strcmp(buf, buf2) != 0) {
-	    ok = 0;
-	    fprintf(stderr, "  (Changed to match resolution)");
-	}
-	fprintf(stderr, "\n\n");
-
-	G_format_resolution(cellhd->ew_res, buf, cellhd->proj);
-	G_format_resolution(ewres, buf2, cellhd->proj);
-	fprintf(stderr, "  e-w res:     %s", buf);
-	if (strcmp(buf, buf2) != 0) {
-	    ok = 0;
-	    fprintf(stderr, "  (Changed to conform to grid)");
-	}
-	fprintf(stderr, "\n");
-
-	G_format_resolution(cellhd->ns_res, buf, cellhd->proj);
-	G_format_resolution(nsres, buf2, cellhd->proj);
-	fprintf(stderr, "  n-s res:     %s", buf);
-	if (strcmp(buf, buf2) != 0) {
-	    ok = 0;
-	    fprintf(stderr, "  (Changed to conform to grid)");
-	}
-	fprintf(stderr, "\n\n");
-
-	G_message("  total rows:  %15d", cellhd->rows);
-	G_message("  total cols:  %15d", cellhd->cols);
-
-	sprintf(buf, "%lf", (double)cellhd->rows * cellhd->cols);
-	*(p = strchr(buf, '.')) = 0;
-	G_insert_commas(buf);
-	G_message("  total cells: %15s", buf);
-	fprintf(stderr, "\n");
-
-	if (type != AS_DEF_WINDOW) {
-	    if (cellhd->north > def_wind.north) {
-		G_warning("north falls outside the default region");
-		ok = 0;
-	    }
-
-	    if (cellhd->south < def_wind.south) {
-		G_warning("south falls outside the default region");
-		ok = 0;
-	    }
-
-	    if (cellhd->proj != PROJECTION_LL) {
-		if (cellhd->east > def_wind.east) {
-		    G_warning("east falls outside the default region");
-		    ok = 0;
-		}
-
-		if (cellhd->west < def_wind.west) {
-		    G_warning("west falls outside the default region");
-		    ok = 0;
-		}
-	    }
-	}
-
-      ASK:
-	fflush(stdin);
-	if (type == AS_CELLHD)
-	    fprintf(stderr, "\nDo you accept this header? (y/n) [%s] > ",
-		    ok ? "y" : "n");
-	else
-	    fprintf(stderr, "\nDo you accept this region? (y/n) [%s] > ",
-		    ok ? "y" : "n");
-
-	if (!G_gets(buf))
-	    goto SHOW;
-
-	G_strip(buf);
-	switch (*buf) {
-	case 0:
-	    break;
-	case 'y':
-	case 'Y':
-	    ok = 1;
-	    break;
-	case 'n':
-	case 'N':
-	    ok = 0;
-	    break;
-	default:
-	    goto ASK;
-	}
-
-	if (ok)
-	    return 0;
-    }
-}
-
-
-static int hitreturn(void)
-{
-    char buf[100];
-
-    fprintf(stderr, "hit RETURN -->");
-    if (!fgets(buf, 100, stdin))
-	exit(EXIT_SUCCESS);
-
-    G_strip(buf);
-    if (!strncmp(buf, "exit", sizeof(buf)))
-	exit(EXIT_SUCCESS);
-
-    return 0;
-}

+ 0 - 145
lib/edit/edit_hist.c

@@ -1,145 +0,0 @@
-
-/****************************************************************************
- *
- * MODULE:       edit library functions
- * AUTHOR(S):    Originally part of gis lib dir in CERL GRASS code
- *               Subsequent (post-CVS) contributors:
- *               Glynn Clements <glynn gclements.plus.com>,
- *               Radim Blazek <radim.blazek gmail.com>,
- *               Eric G. Miller <egm2 jps.net>,
- *               Markus Neteler <neteler itc.it>,
- *               Brad Douglas <rez touchofmadness.com>,
- *               Bernhard Reiter <bernhard intevation.de>
- * PURPOSE:      libraries for interactively editing raster support data
- * COPYRIGHT:    (C) 1996-2006 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.
- *
- *****************************************************************************/
-/*
- **********************************************************************
- *
- *   E_edit_history (hist)
- *      struct History *hist 
- *
- *   Interactively prompts the user for history information.
- *   Uses screen oriented prompting through the visual_ask library.
- *   Programs using this must be compiled with the GRASS library $(VASKLIB)
- *   and include $(CURSES) in the compile line
- *
- *   Returns: 1 ok
- *           -1 user canceled edit
- *
- **********************************************************************/
-
-#include <grass/gis.h>
-#include <grass/vask.h>
-#include <grass/edit.h>
-
-int E_edit_history(struct History *phist)
-{
-    int len;
-    int i;
-
-    if (!*phist->mapid)
-	sprintf(phist->mapid, "%s : %s", G_date(), "filename");
-    if (!*phist->title)
-	sprintf(phist->title, "%s", "filename");
-    if (!*phist->mapset)
-	sprintf(phist->mapset, "%s", G_mapset());
-    if (!*phist->creator)
-	sprintf(phist->creator, "%s", G_whoami());
-    if (!*phist->maptype)
-	sprintf(phist->maptype, "raster");
-
-    V_clear();
-    V_line(0, "		 ENTER/CORRECT FILE HISTORY INFORMATION");
-    V_line(2, "Map ID ...");
-    V_line(4, "Title ....");
-    V_line(6, "Project ..");
-    V_line(8, "Creator ..");
-    V_line(10, "Maptype ..");
-    V_line(12, "Data source");
-    V_line(16, "Data Description");
-    V_line(19, "For history comments see next page");
-
-    len = RECORD_LEN - 1;
-    if (len > 65)
-	len = 65;
-    phist->mapid[len] = 0;
-    phist->title[len] = 0;
-    phist->mapset[len] = 0;
-    phist->creator[len] = 0;
-    phist->maptype[len] = 0;
-    len--;
-
-    V_const(phist->mapid, 's', 2, 11, len);
-    V_ques(phist->title, 's', 4, 11, len);
-    V_const(phist->mapset, 's', 6, 11, len);
-    V_const(phist->creator, 's', 8, 11, len);
-    V_ques(phist->maptype, 's', 10, 11, len);
-
-    phist->datsrc_1[len] = 0;
-    phist->datsrc_2[len] = 0;
-    phist->keywrd[len] = 0;
-    len--;
-
-    V_ques(phist->datsrc_1, 's', 13, 0, len);
-    V_ques(phist->datsrc_2, 's', 14, 0, len);
-    V_ques(phist->keywrd, 's', 17, 0, len);
-
-    V_intrpt_ok();
-    if (!V_call())
-	return -1;
-
-    G_strip(phist->title);
-    G_strip(phist->maptype);
-    G_strip(phist->datsrc_1);
-    G_strip(phist->datsrc_2);
-    G_strip(phist->keywrd);
-
-    V_clear();
-    V_line(0, "		 ENTER/CORRECT FILE HISTORY COMMENTS");
-    V_ques(phist->edhist[0], 's', 2, 0, len);
-    V_ques(phist->edhist[1], 's', 3, 0, len);
-    V_ques(phist->edhist[2], 's', 4, 0, len);
-    V_ques(phist->edhist[3], 's', 5, 0, len);
-    V_ques(phist->edhist[4], 's', 6, 0, len);
-    V_ques(phist->edhist[5], 's', 7, 0, len);
-    V_ques(phist->edhist[6], 's', 8, 0, len);
-    V_ques(phist->edhist[7], 's', 9, 0, len);
-    V_ques(phist->edhist[8], 's', 10, 0, len);
-    V_ques(phist->edhist[9], 's', 11, 0, len);
-    V_ques(phist->edhist[10], 's', 12, 0, len);
-    V_ques(phist->edhist[11], 's', 13, 0, len);
-    V_ques(phist->edhist[12], 's', 14, 0, len);
-    V_ques(phist->edhist[13], 's', 15, 0, len);
-    V_ques(phist->edhist[14], 's', 16, 0, len);
-    V_ques(phist->edhist[15], 's', 17, 0, len);
-    V_ques(phist->edhist[16], 's', 18, 0, len);
-    V_ques(phist->edhist[17], 's', 19, 0, len);
-    V_ques(phist->edhist[18], 's', 20, 0, len);
-    V_ques(phist->edhist[19], 's', 21, 0, 65);
-
-    len++;
-    for (i = 0; i <= 19; i++)
-	phist->edhist[i][len] = 0;
-
-    V_intrpt_ok();
-    if (!V_call())
-	return -1;
-
-    for (i = 0; i <= 19; i++)
-	G_strip(phist->edhist[i]);
-
-    for (phist->edlinecnt = 19; phist->edlinecnt > 0; phist->edlinecnt--) {
-	if (*phist->edhist[phist->edlinecnt] != 0)
-	    break;
-    }
-    phist->edlinecnt++;
-    V_clear();
-
-    return (1);
-}

+ 0 - 618
lib/gis/ask.c

@@ -1,618 +0,0 @@
-
-/****************************************************************
-* These routines prompt the user for names of GIS data files
-*
-* G_ask_new           (prompt, name, element, desc)
-* G_ask_old           (prompt, name, element, desc)
-* G_ask_any           (prompt, name, element, desc, warn)
-* G_ask_in_mapset     (prompt, name, element, desc)
-* G_ask_new_file      (prompt, name, element, desc)
-* G_ask_old_file      (prompt, name, element, desc)
-*
-* G_ask_new_ext       (prompt, name, element, desc, option, lister)
-* G_ask_old_ext       (prompt, name, element, desc, option, lister)
-* G_ask_any_ext       (prompt, name, element, desc, warn, option, lister)
-* G_ask_in_mapset_ext (prompt, name, element, desc, option, lister)
-*
-*   char *prompt      prompt to be printed. can be "" in which
-*                     case an appropriate prompt will be printed.
-*   char *name        buffer to hold the name input by the user
-*   char *element     GIS data element - "cell", "vect", etc.
-*   char *desc        a description of element.  Used for prompting
-*                     and listing. Will be set to element if given as ""
-*                     (eg, if element is "vect", set desc = "vector")
-*   char *option      list option. a description of the option.
-*                     (eg, "with utms" will prompt as follows:
-*                     list -f for a list with utms)
-*   int (*lister)()   subroutine to return text for -f option.
-*
-*
-* G_ask_new() requires the user to enter the name of a file
-*             which does not exist in the current mapset
-*             (but which may exist in other mapsets).
-*
-* G_ask_old() requires the user to enter the name of a file
-*             which already exists.
-*
-* G_ask_in_mapset() requires the user to enter the name of a file
-*                   which exists in the current mapset
-*
-* G_ask_any() accepts any legal filename. Optionally warns user
-*             if the file exists in the current mapset.
-*
-* G_ask_new_file() requires the user to enter the name of a new file.
-*
-* G_ask_old_file() requires the user to enter the name of any existing file.
-*
-* returns:
-*   char *    mapset where file was found, or
-*             mapset where file is to be created
-*   NULL      user hit RETURN to cancel the request
-*
-* note:
-*  These routines have a 'list' function built in.  If a list -f
-*  option is also desired, create a lister() routine, and
-*  use G_ask_xxx_ext(). The lister() routine will be called as
-*  follows:
-*
-*       lister (name, mapset, buf)
-*
-*       char *name        name of file 
-*       char *mapset      mapset to where file lives
-*       char *buf         buffer to hold description.
-*                         lister() should copy into buf.
-*                         buf will be large (about 400 bytes)
-*                         but only first 60 chars will be displayed
-*
-*
-*  for each mapset, lister() will be called once with
-*  name set to the empty string "" in order to get an title for the
-*  list.  Set buf to null to suppress title, otherwise copy title
-*  into buf.  The title will start above the text for the files.
-*
-*  then for each file in each mapset, lister() will be called
-*  to obtain infomation about the file.
-*
-* also:
-*   G_set_ask_return_msg (msg) char *msg;
-*   can be used to change the hit RETURN to cancel request message
-*   displayed during the ask prompting.
-*
-*   G_get_ask_return_msg() will return the msg.
-******************************************************************/
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <grass/gis.h>
-#include <grass/glocale.h>
-
-/*
- * OLD references any mapset
- * NEW, ANY, PRJ are for the current mapset only
- *
- * OLD means must exist in some mapset
- * NEW means must not exist in current mapset
- * ANY means just get a name. If file exists, (optionally) warn user.
- * PRJ means must exist in current mapset
- */
-
-#define OLD 0
-#define NEW 1
-#define PRJ 2
-#define ANY 3
-#define ANY_NW 4
-#define OLD_FILE 5
-#define NEW_FILE 6
-
-static char *ask_return_msg = 0;
-static char clear_return_msg = 0;
-static int (*no_lister) () = 0;
-static int parselist(const char *, int, char *);
-static char *ask(const char *, char *, char *, char *, char *, int (*)(),
-		 int);
-
-
-/*!
- * \brief prompt for new database file
- *
- * The user is asked to enter the name of
- * a new file which does not exist in the current mapset.
- * <b>Note.</b> The file chosen by the user may exist in other mapsets. This
- * routine does not look in other mapsets, since the assumption is that
- * <b>name</b> will be used to create a new file. New files are always created
- * in the current mapset.
- *
- *  \param prompt
- *  \param name
- *  \param element
- *  \param desc
- *  \return char * 
- */
-
-char *G_ask_new(const char *prompt, char *name, char *element, char *desc)
-{
-    return ask(prompt, name, element, desc, (char *)NULL, no_lister, NEW);
-}
-
-char *G_ask_new_ext(const char *prompt, char *name, char *element, char *desc,
-		    char *option, int (*lister) ())
-{
-    return ask(prompt, name, element, desc, option, lister, NEW);
-}
-
-
-/*!
- * \brief prompt for existing database file
- *
- * The user is asked to enter the
- * name of an existing database file.
- * <b>Note.</b> This routine looks for the file in the current mapset as well
- * as other mapsets. The mapsets that are searched are determined from the user's
- * mapset search path. See Mapset_Search_Path for some more details
- * about the search path.
- *
- *  \param prompt
- *  \param name
- *  \param element
- *  \param label
- *  \return char * 
- */
-
-char *G_ask_old(const char *prompt, char *name, char *element, char *desc)
-{
-    return ask(prompt, name, element, desc, (char *)NULL, no_lister, OLD);
-}
-
-char *G_ask_old_ext(const char *prompt, char *name, char *element, char *desc,
-		    char *option, int (*lister) ())
-{
-    return ask(prompt, name, element, desc, option, lister, OLD);
-}
-
-
-/*!
- * \brief prompt for any valid file name
- *
- * The user is asked to enter
- * any leg al file name. If <b>warn</b> is 1 and the file chosen exists in the
- * current mapset, then the user is asked if it is ok to overwrite the file. If
- * <b>warn</b> is 0, then any leg al name is accepted and no warning is issued
- * to the user if the file exists.
- *
- *  \param prompt
- *  \param name
- *  \param element
- *  \param label
- *  \param warn
- *  \return char * 
- */
-
-char *G_ask_any(const char *prompt, char *name, char *element, char *desc,
-		int warn)
-{
-    return ask(prompt, name, element, desc, (char *)NULL, no_lister,
-	       warn ? ANY : ANY_NW);
-}
-
-char *G_ask_any_ext(const char *prompt, char *name, char *element, char *desc,
-		    int warn, char *option, int (*lister) ())
-{
-    return ask(prompt, name, element, desc, option, lister,
-	       warn ? ANY : ANY_NW);
-}
-
-
-/*!
- * \brief prompt for existing database file
- *
- * The user is asked to enter the
- * name of an file which exists in the current mapset.
- * <b>Note.</b> The file chosen by the user may or may not exist in other
- * mapsets. This routine does not look in other mapsets, since the assumption is
- * that <b>name</b> will be used to modify a file. GRASS only permits users to
- * modify files in the current mapset.
- *
- *  \param prompt
- *  \param name
- *  \param element
- *  \param label
- *  \return char * 
- */
-
-char *G_ask_in_mapset(const char *prompt, char *name, char *element,
-		      char *desc)
-{
-    return ask(prompt, name, element, desc, (char *)NULL, no_lister, PRJ);
-}
-
-char *G_ask_in_mapset_ext(const char *prompt, char *name, char *element,
-			  char *desc, char *option, int (*lister) ())
-{
-    return ask(prompt, name, element, desc, option, lister, PRJ);
-}
-
-
-/*!
- * \brief prompt for new file
- *
- * The user is asked to enter the name of an file which doesn't exist.
- *
- *  \param prompt
- *  \param name
- *  \param element
- *  \param label
- *  \return char * 
- */
-
-char *G_ask_new_file(const char *prompt, char *name, char *element,
-		     char *desc)
-{
-    /* element is a dummy parameter for this function */
-    return ask(prompt, name, element, desc, (char *)NULL, no_lister,
-	       NEW_FILE);
-}
-
-/* do we need this function?
-   char *
-   G_ask_new_file_ext (prompt, name, element, desc, option, lister)
-   char *prompt;
-   char *name;
-   char *element;
-   char *desc;
-   char *option;
-   int (*lister)();
-   {
-   return ask (prompt, name, element, desc, option, lister, NEW_FILE);
-   }
- */
-
-
-/*!
- * \brief prompt for existing file
- *
- * The user is asked to enter the name of an file which exists.
- *
- *  \param prompt
- *  \param name
- *  \param element
- *  \param label
- *  \return char * 
- */
-
-char *G_ask_old_file(const char *prompt, char *name, char *element,
-		     char *desc)
-{
-    /* element is a dummy parameter for this function */
-    return ask(prompt, name, element, desc, (char *)NULL, no_lister,
-	       OLD_FILE);
-}
-
-/* do we need this function?
-   char *
-   G_ask_old_file_ext (prompt, name, element, desc, option, lister)
-   char *prompt;
-   char *name;
-   char *element;
-   char *desc;
-   char *option;
-   int (*lister)();
-   {
-   return ask (prompt, name, element, desc, option, lister, OLD_FILE);
-   }
- */
-
-
-/*!
- * \brief set Hit RETURN msg
- *
- * The "Hit
- * RETURN to cancel request" part of the prompt in the prompting routines
- * described above, is modified to "Hit RETURN <b>msg.</b>"
- *
- *  \param msg
- *  \return int
- */
-
-int G_set_ask_return_msg(const char *msg)
-{
-    if (ask_return_msg)
-	G_free(ask_return_msg);
-    ask_return_msg = G_store(msg);
-    clear_return_msg = 0;
-
-    return 0;
-}
-
-
-/*!
- * \brief get Hit RETURN msg
- *
- *  The current
- * <i>msg</i> (as set by <i>G_set_ask_return_msg</i>) is returned.
- *
- *  \param void
- *  \return char * 
- */
-
-char *G_get_ask_return_msg()
-{
-    static char none[80];
-
-    strcpy(none, _("to cancel request"));
-    return (ask_return_msg == NULL ? none : ask_return_msg);
-}
-
-static char *ask(const char *prompt,
-		 char *name,
-		 char *element,
-		 char *desc, char *option, int (*lister) (), int type)
-{
-    char tmapset[GMAPSET_MAX];
-    char xname[GNAME_MAX], xmapset[GMAPSET_MAX];
-    int name_is_qualified;
-    int ok;
-    char tprompt[256];
-    char input[256];
-    char *mapset;
-    char *cur_mapset;
-
-    G__check_gisinit();
-
-    fflush(stdout);
-    /* RETURN msg */
-    if (clear_return_msg) {
-	G_free(ask_return_msg);
-	ask_return_msg = 0;
-    }
-    clear_return_msg = ask_return_msg ? 1 : 0;
-
-    /* make sure option is valid */
-    if (lister && (option == 0 || *option == 0))
-	lister = 0;
-
-    /* set name to NO NAME at outset */
-    *name = 0;
-
-    /*
-     * if element description not given, make it the same as the
-     * element name
-     */
-    if (desc == 0 || *desc == 0)
-	desc = element;
-
-    /*
-     * if no prompt is given, build an approriate prompt
-     */
-    if (prompt == 0 || *prompt == 0) {
-	switch (type) {
-	case NEW:
-	case NEW_FILE:
-	    sprintf(tprompt, _("Enter a new %s file name"), desc);
-	    prompt = tprompt;
-	    break;
-	case OLD:
-	case PRJ:
-	case OLD_FILE:
-	    sprintf(tprompt, _("Enter the name of an existing %s file"),
-		    desc);
-	    prompt = tprompt;
-	    break;
-	default:
-	    sprintf(tprompt, _("Enter %s file name"), desc);
-	    prompt = tprompt;
-	    break;
-	}
-    }
-
-    /*
-     * get the current mapset name
-     */
-    cur_mapset = G_mapset();
-
-    while (1) {
-	/*
-	 * print the prompt and input the request
-	 */
-	do {
-	    fprintf(stderr, "\n%s\n", prompt);
-	    /* no listing function implemented for old_file and new_file */
-	    if (type != OLD_FILE && type != NEW_FILE)
-		fprintf(stderr,
-			_("Enter 'list' for a list of existing %s files\n"),
-			desc);
-	    if (lister) {
-		fprintf(stderr, _("Enter 'list -f' for "));
-		if (option && *option)
-		    fprintf(stderr, _("a list %s"), option);
-		else
-		    fprintf(stderr, _("an extended list"));
-		fprintf(stderr, "\n");
-	    }
-
-	    fprintf(stderr, _("Hit RETURN %s\n"), G_get_ask_return_msg());
-	    fprintf(stderr, "> ");
-	}
-	while (!G_gets(input));
-
-	G_strip(input);
-	fprintf(stderr, "<%s>\n", input);
-
-	/*
-	 * if the user just hit return (or blanks only)
-	 * return NULL
-	 */
-	if (*input == 0)
-	    return 0;
-
-	if (type == OLD_FILE || type == NEW_FILE) {
-	    int exist;
-
-	    exist = (access(input, 0) == 0);
-	    if (type == OLD_FILE && !exist) {
-		fprintf(stderr, _("\n** %s - not found **\n"), input);
-		continue;
-	    }
-	    if (type == NEW_FILE && exist) {
-		char question[200];
-
-		sprintf(question,
-			_("\n** %s exists. ok to overwrite? "), input);
-		if (!G_yes(question, 0))
-		    continue;
-	    }
-	    strcpy(name, input);
-	    return G_store(input);
-	}
-	/*
-	 * 'list' does a list without extension. if we are looking for a new
-	 * file only list the current mapset. Otherwise list all mapsets
-	 * in the mapset search list
-	 *
-	 * 0  not a list request
-	 * 1  list
-	 * 2  list -f
-	 * 3  list mapset
-	 * 4  list -f mapset
-	 */
-
-	switch (parselist(input, lister ? 1 : 0, tmapset)) {
-	case 0:
-	    break;
-	case 1:
-	    G_list_element(element, desc, type == OLD ? "" : cur_mapset,
-			   no_lister);
-	    continue;
-	case 2:
-	    G_list_element(element, desc, type == OLD ? "" : cur_mapset,
-			   lister);
-	    continue;
-	case 3:
-	    G_list_element(element, desc, tmapset, no_lister);
-	    continue;
-	case 4:
-	    G_list_element(element, desc, tmapset, lister);
-	    continue;
-	default:
-	    fprintf(stderr, "** illegal request **\n");
-	    continue;
-	}
-
-	if ((name_is_qualified =
-	     G__name_is_fully_qualified(input, xname, xmapset)))
-	    ok = G_legal_filename(xname) >= 0;
-	else
-	    ok = G_legal_filename(input) >= 0;
-	if (!ok) {
-	    fprintf(stderr, _("\n**<%s> illegal name **\n"), input);
-	    continue;
-	}
-	/*
-	 * now look for the file.
-	 *
-	 * new files must be simple names
-	 * and must not exist in the current mapset
-	 */
-	if (type != OLD) {
-	    if (name_is_qualified) {
-		if (strcmp(cur_mapset, xmapset) != 0) {
-		    fprintf(stderr, _("\n** %s - illegal request **\n"),
-			    input);
-		    continue;
-		}
-		strcpy(input, xname);
-	    }
-	    mapset = G_find_file(element, input, cur_mapset);
-	    switch (type) {
-	    case NEW:
-
-		if (!mapset) {
-		    strcpy(name, input);
-		    return cur_mapset;
-		}
-		fprintf(stderr,
-			_("\n** %s - exists, select another name **\n"),
-			input);
-		break;
-
-	    case ANY:
-	    case ANY_NW:
-
-		if (mapset && type == ANY) {
-		    char question[200];
-
-		    sprintf(question,
-			    _("\n** %s exists. ok to overwrite? "), input);
-		    if (!G_yes(question, 0))
-			break;
-		}
-		strcpy(name, input);
-		return cur_mapset;
-
-	    case PRJ:
-
-		if (mapset) {
-		    strcpy(name, input);
-		    return cur_mapset;
-		}
-		fprintf(stderr, _("\n** %s - not found **\n"), input);
-		break;
-
-	    default:
-		G_fatal_error(_("ask: can't happen"));
-	    }
-	}
-	/*
-	 * old names can be simple or qualified
-	 * and must exist
-	 */
-	else {
-	    mapset = G_find_file(element, input, "");
-	    if (mapset) {
-		if (name_is_qualified)
-		    strcpy(name, xname);
-		else
-		    strcpy(name, input);
-		return mapset;
-	    }
-	    fprintf(stderr, _("\n** %s - not found **\n"), input);
-	}
-    }
-
-    return NULL;
-}
-
-static int parselist(const char *input, int option, char *mapset)
-{
-    char list[GNAME_MAX];
-    char f1[GMAPSET_MAX];
-    char f2[GMAPSET_MAX];
-    char f3[GMAPSET_MAX];
-    int count;
-
-    *list = *f1 = *f2 = 0;
-    count = sscanf(input, "%s%s%s%s", list, f1, f2, f3);
-    if (count < 1)
-	return 0;
-    if (strcmp(list, "list") != 0)
-	return 0;
-
-    if (count == 1)
-	return 1;		/* list */
-    if (count > 3)
-	return -1;		/* illegal */
-
-    if (*f1 == '-') {		/* list -f */
-	if (!option)
-	    return -1;
-	if (f1[1] == 0 || f1[1] != 'f' || f1[2] != 0)
-	    return -1;
-	if (count == 2)
-	    return 2;
-	strcpy(mapset, f2);
-	return 4;
-    }
-    if (count != 2)
-	return -1;
-    strcpy(mapset, f1);
-    return 3;
-}

+ 0 - 114
lib/gis/ask_cell.c

@@ -1,114 +0,0 @@
-/*
- *************************************************************************
- *   char *
- *   G_ask_cell_new(prompt, name)) 
- *       asks user to input name of a new cell file
- *
- *   char *
- *   G_ask_cell_old(prompt, name) 
- *       asks user to input name of an existing cell file
- *
- *   char *
- *   G_ask_cell_in_mapset(prompt, name)
- *       asks user to input name of an existing cell file in current mapset
- *
- *   char *
- *   G_ask_cell_any(prompt, name)
- *       asks user to input name of a new or existing cell file in
- *       the current mapset. Warns user about (possible) overwrite
- *       if cell file already exists
- *
- *   parms:
- *      const char *prompt    optional prompt for user
- *      char *name            buffer to hold name of map found
- *
- *   returns:
- *      char *pointer to a string with name of mapset
- *       where file was found, or NULL if not found
- *
- *   note:
- *      rejects all names that begin with .
- **********************************************************************/
-#include <stdlib.h>
-#include <string.h>
-#include <grass/gis.h>
-#include <grass/glocale.h>
-
-static int lister(char *, char *, char *);
-
-
-/*!
- * \brief prompt for new raster map
- *
- * Asks the user to enter a name for a raster map which does not
- * exist in the current mapset.
- *
- *  \param prompt
- *  \param name
- *  \return char * 
- */
-
-char *G_ask_cell_new(const char *prompt, char *name)
-{
-
-    return G_ask_new_ext(prompt, name, "cell", "raster", _("with titles"),
-			 lister);
-}
-
-
-/*!
- * \brief prompt for existing raster map
- *
- * Asks the user to enter the name of an existing raster
- * file in any mapset in the database.
- *
- *  \param prompt
- *  \param name
- *  \return char * 
- */
-
-char *G_ask_cell_old(const char *prompt, char *name)
-{
-    return G_ask_old_ext(prompt, name, "cell", "raster", _("with titles"),
-			 lister);
-}
-
-
-/*!
- * \brief prompt for existing raster map
- *
- * Asks the user to enter the name of an existing raster
- * file in the current mapset.
- *
- *  \param prompt
- *  \param name
- *  \return char * 
- */
-
-char *G_ask_cell_in_mapset(const char *prompt, char *name)
-{
-    return G_ask_in_mapset_ext(prompt, name, "cell", "raster",
-			       _("with titles"), lister);
-}
-
-char *G_ask_cell_any(const char *prompt, char *name)
-{
-    return G_ask_any_ext(prompt, name, "cell", "raster", 1, _("with titles"),
-			 lister);
-}
-
-static int lister(char *name, char *mapset, char *buf)
-{
-    char *title;
-
-    *buf = 0;
-    if (*name == 0)
-	return 0;
-
-    strcpy(buf, title = G_get_cell_title(name, mapset));
-    if (*buf == 0)
-	strcpy(buf, _("(no title)"));
-    G_free(title);
-
-    return 0;
-}

+ 0 - 86
lib/gis/ask_vctrs.c

@@ -1,86 +0,0 @@
-/*
- ***********************************************************************
- * prompt for vector maps (digit)
- *
- *   char *
- *   G_ask_vector_new(prompt, name)) 
- *       asks user to input name of a new vector map
- *
- *   char *
- *   G_ask_vector_old(prompt, name) 
- *       asks user to input name of an existing vector map
- *
- *   char *
- *   G_ask_vector_any(prompt, name)
- *       asks user to input any vector name
- *
- *   char *
- *   G_ask_vector_in_mapset(prompt, name)
- *       asks user to input name of an existing vector map
- *       in current mapset
- *
- *   parms:
- *      const char *prompt    optional prompt for user
- *      char *name            buffer to hold name of map found
- *
- *   returns:
- *      char *pointer to a string with name of mapset
- *       where file was found, or NULL if not found
- **********************************************************************/
-#include <grass/gis.h>
-
-
-/*!
- * \brief prompt for a new vector map
- *
- * Asks the user to enter a name for a vector map which does not
- * exist in the current mapset.
- *
- *  \param prompt
- *  \param name
- *  \return char * 
- */
-
-char *G_ask_vector_new(const char *prompt, char *name)
-{
-    return G_ask_new(prompt, name, "vector", "vector");
-}
-
-
-/*!
- * \brief prompt for an existing vector map
- *
- * Asks the user to enter the name of an existing vector
- * file in any mapset in the database.
- *
- *  \param prompt
- *  \param name
- *  \return char * 
- */
-
-char *G_ask_vector_old(const char *prompt, char *name)
-{
-    return G_ask_old(prompt, name, "vector", "vector");
-}
-
-char *G_ask_vector_any(const char *prompt, char *name)
-{
-    return G_ask_any(prompt, name, "vector", "vector", 1);
-}
-
-
-/*!
- * \brief prompt for an existing vector map
- *
- * Asks the user to enter the name of an existing vector
- * file in the current mapset.
- *
- *  \param prompt
- *  \param name
- *  \return char * 
- */
-
-char *G_ask_vector_in_mapset(const char *prompt, char *name)
-{
-    return G_ask_in_mapset(prompt, name, "vector", "vector");
-}

+ 0 - 123
lib/gis/get_datum_name.c

@@ -1,123 +0,0 @@
-/*
- *
- ****************************************************************************
- *
- * MODULE:       GRASS 5.0 gis library, get_datum_name.c
- * AUTHOR(S):    unknown, updated by Andreas Lange, andreas.lange@rhein-main.de
- * PURPOSE:      Get datum name for new location database
- * 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.
- *
- *****************************************************************************/
-
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <grass/gis.h>
-#include <grass/glocale.h>
-
-/***********************************************************************
- * G_ask_datum_name(char *datumname, char *ellpsname)
- *
- * ask interactively for a valid datum name
- *
- * returns <0 on error
- * returns 1 on success
- ***********************************************************************/
-
-/*!
- * \brief ask for a valid datum name
- *
- * This function asks the user interactively for a valid datum name from the datum
- * table. The datum name is stored in the character array pointed to by
- * <b>datum</b>. The function returns 1 on sucess, -1 if no datum was entered
- * on command line and 0 on internal error. 
- *
- *  \param datum
- *  \return int
- */
-
-int G_ask_datum_name(char *datumname, char *ellpsname)
-{
-    char buff[1024], answer[100], ellipse[100];
-    char *dat, *Tmp_file;
-    FILE *Tmp_fd = NULL;
-    int i;
-
-
-    for (;;) {
-	do {
-	    fprintf(stderr, _("\nPlease specify datum name\n"));
-	    fprintf(stderr,
-		    _("Enter 'list' for the list of available datums\n"));
-	    fprintf(stderr,
-		    _
-		    ("or 'custom' if you wish to enter custom parameters\n"));
-	    fprintf(stderr, _("Hit RETURN to cancel request\n"));
-	    fprintf(stderr, ">");
-	} while (!G_gets(answer));
-	G_strip(answer);
-
-	if (strlen(answer) == 0)
-	    return -1;
-
-	if (strcmp(answer, "list") == 0) {
-	    Tmp_file = G_tempfile();
-	    if (NULL == (Tmp_fd = fopen(Tmp_file, "w")))
-		G_warning(_("Cannot open temp file"));
-	    else {
-		char *pager;
-
-		fprintf(Tmp_fd, "Short Name\tLong Name / Description\n---\n");
-		for (i = 0; (dat = G_datum_name(i)); i++) {
-		    fprintf(Tmp_fd, "%s\t%s\n\t\t\t(%s ellipsoid)\n---\n",
-			    dat, G_datum_description(i),
-			    G_datum_ellipsoid(i));
-		}
-		fclose(Tmp_fd);
-
-		pager = getenv("GRASS_PAGER");
-		if (!pager || strlen(pager) == 0)
-		    pager = "cat";
-		sprintf(buff, "%s \"%s\" 1>&2", pager,
-			G_convert_dirseps_to_host(Tmp_file));
-		G_system(buff);
-
-		remove(Tmp_file);
-	    }
-	    G_free(Tmp_file);
-	}
-	else {
-	    if (G_strcasecmp(answer, "custom") == 0)
-		break;
-
-	    if (G_get_datum_by_name(answer) < 0) {
-		fprintf(stderr, _("\ninvalid datum\n"));
-	    }
-	    else
-		break;
-	}
-    }
-
-
-    if (G_strcasecmp(answer, "custom") == 0) {
-	/* For a custom datum we need to interactively ask for the ellipsoid */
-	if (G_ask_ellipse_name(ellipse) < 0)
-	    return -1;
-	sprintf(ellpsname, ellipse);
-	sprintf(datumname, "custom");
-    }
-    else {
-	/* else can look it up from datum.table */
-	if ((i = G_get_datum_by_name(answer)) < 0)
-	    return -1;
-	sprintf(ellpsname, G_datum_ellipsoid(i));
-	sprintf(datumname, G_datum_name(i));
-    }
-
-    return 1;
-
-}

+ 0 - 79
lib/gis/get_ell_name.c

@@ -1,79 +0,0 @@
-/*
- ****************************************************************************
- *
- * MODULE:       GRASS 5 gis library, get_ell_name.c
- * AUTHOR(S):    unknown, updated by Andreas Lange, andreas.lange@rhein-main.de
- * PURPOSE:      Get ellipse name from user
- * 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.
- *
- *****************************************************************************/
-
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <grass/gis.h>
-#include <grass/glocale.h>
-
-int G_ask_ellipse_name(char *spheroid)
-{
-    char buff[1024], answer[50];
-    double aa, e2;
-    char *sph, *Tmp_file;
-    FILE *Tmp_fd = NULL;
-    int i;
-
-    Tmp_file = G_tempfile();
-    if (NULL == (Tmp_fd = fopen(Tmp_file, "w"))) {
-	G_fatal_error(_("Cannot open temp file"));
-    }
-    fprintf(Tmp_fd, "sphere\n");
-    for (i = 0; (sph = G_ellipsoid_name(i)); i++) {
-	fprintf(Tmp_fd, "%s\n", sph);
-    }
-
-    fclose(Tmp_fd);
-
-    for (;;) {
-	do {
-	    fprintf(stderr, _("\nPlease specify ellipsoid name\n"));
-	    fprintf(stderr,
-		    _("Enter 'list' for the list of available ellipsoids\n"));
-	    fprintf(stderr, _("Hit RETURN to cancel request\n"));
-	    fprintf(stderr, ">");
-	} while (!G_gets(answer));
-	G_strip(answer);
-	if (strlen(answer) == 0)
-	    return -1;
-	if (strcmp(answer, "list") == 0) {
-	    char *pager;
-
-	    pager = getenv("GRASS_PAGER");
-	    if (!pager || strlen(pager) == 0)
-		pager = "cat";
-
-	    /* Always print interactive output to stderr */
-	    sprintf(buff, "%s \"%s\" 1>&2", pager,
-		    G_convert_dirseps_to_host(Tmp_file));
-	    G_system(buff);
-	}
-	else {
-	    if (strcmp(answer, "sphere") == 0)
-		break;
-	    if (G_get_ellipsoid_by_name(answer, &aa, &e2) == 0) {
-		fprintf(stderr, _("\ninvalid ellipsoid\n"));
-	    }
-	    else
-		break;
-	}
-    }
-    sprintf(spheroid, "%s", answer);
-    remove(Tmp_file);
-    if (strcmp(spheroid, "sphere") == 0) {
-	return 2;
-    }
-    return 1;
-}

+ 0 - 86
lib/gis/get_projname.c

@@ -1,86 +0,0 @@
-/*
- ****************************************************************************
- *
- * MODULE:       GRASS 5 gis library, get_projname.c
- * AUTHOR(S):    unknown
- * PURPOSE:      Get projection name from user
- * 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.
- *
- *****************************************************************************/
-
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <grass/gis.h>
-#include <grass/glocale.h>
-
-int G_ask_proj_name(char *proj_id, char *proj_name)
-{
-    char path[GPATH_MAX], buff[GPATH_MAX], answer[50], *a;
-    struct Key_Value *in_proj_keys;
-    char *Tmp_file;
-    FILE *Tmp_fd = NULL;
-    int in_stat, i, npr;
-
-    sprintf(path, "%s/etc/projections", G_gisbase());
-    while (access(path, 0) != 0)
-	G_fatal_error(_("%s not found"), path);
-    in_proj_keys = G_read_key_value_file(path, &in_stat);
-    if (in_stat != 0)
-	G_fatal_error(_("ERROR in reading %s"), path);
-    npr = in_proj_keys->nitems;
-    Tmp_file = G_tempfile();
-    if (NULL == (Tmp_fd = fopen(Tmp_file, "w"))) {
-	G_fatal_error(_("Cannot open temp file"));
-    }
-    for (i = 0; i < npr; i++) {
-	fprintf(Tmp_fd, "%s -- %s\n", in_proj_keys->key[i],
-		in_proj_keys->value[i]);
-    }
-    fclose(Tmp_fd);
-
-    for (;;) {
-
-	do {
-	    fprintf(stderr, _("\n\nPlease specify projection name\n"));
-	    fprintf(stderr,
-		    _
-		    ("Enter 'list' for the list of available projections\n"));
-	    fprintf(stderr, _("Hit RETURN to cancel request\n"));
-	    fprintf(stderr, ">");
-	} while (!G_gets(answer));
-
-	G_strip(answer);
-	if (strlen(answer) == 0)
-	    return -1;
-	if (strcmp(answer, "list") == 0) {
-	    char *pager;
-
-	    pager = getenv("GRASS_PAGER");
-	    if (!pager || strlen(pager) == 0)
-		pager = "cat";
-
-	    /* Always print interactive output to stderr */
-	    sprintf(buff, "%s \"%s\" 1>&2", pager,
-		    G_convert_dirseps_to_host(Tmp_file));
-	    G_system(buff);
-	}
-	else {
-	    a = G_find_key_value(answer, in_proj_keys);
-	    if (a == NULL) {
-		fprintf(stderr, _("\ninvalid projection\n"));
-	    }
-	    else
-		break;
-	}
-    }
-
-    sprintf(proj_id, "%s", answer);
-    sprintf(proj_name, "%s", a);
-    remove(Tmp_file);
-    return 1;
-}

+ 0 - 99
lib/gis/gets.c

@@ -1,99 +0,0 @@
-#include <grass/gis.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <signal.h>
-
-/**********************************************************
- * G_gets (buf)
- *    char *buf      buffer to receive data
- *
- *  does a gets() from stdin. exits upon EOF.
- *  if stdin is a tty (ie, not a pipe or redirected)
- *  then ctrl-z is detected
- *
- * returns
- *  1 read ok
- *  0 ctrl-z entered. calling routine should re-print a prompt
- *    and call G_gets() again
- *
- * note: This is very useful for allowing a program to 
- *       reprompt after the program is restarted after
- *       being stopped with a ctrl-Z.
- *
- * sample use:
- *   do {
- *      fprintf (stderr, "Enter some input:  ") ;
- *   } while ( ! G_gets(buff) )  ;
- *
- *   If the user suspends the process at this prompt G_gets will return
- *   "0" causing the reprompting.
- ***********************************************************/
-
-static int ctrlz = 0;
-static void catch_ctrlz(int);
-static void catch_int(int);
-
-
-int G_gets(char *buf)
-{
-#ifdef SIGTSTP
-    RETSIGTYPE(*sigtstp) ();
-    int tty;
-#endif
-    char p[128];
-    char *eof;
-
-    ctrlz = 0;
-#ifdef SIGTSTP
-    if ((tty = isatty(0))) {
-	sigtstp = signal(SIGTSTP, catch_ctrlz);
-	if (sigtstp != (RETSIGTYPE(*)())SIG_DFL)
-	    signal(SIGTSTP, sigtstp);
-    }
-#endif
-    eof = fgets(p, 100, stdin);
-    /* strip the EOL character      */
-    if (strlen(p) > 1 && p[strlen(p) - 1] == '\n' && p[strlen(p) - 2] == '\r')
-	p[strlen(p) - 2] = '\0';	/* Handles DOS/Windows "\r\n" */
-    else
-	p[strlen(p) - 1] = '\0';	/* Handles Unix "\n" or old Mac "\r" */
-    /*      buf could be any length.  Any overflow will occur here. */
-    strcpy(buf, p);
-
-#ifdef SIGTSTP
-    if (tty)
-	signal(SIGTSTP, sigtstp);
-#endif
-    if (eof)
-	return 1;
-    if (ctrlz)
-	return 0;
-
-    exit(EXIT_SUCCESS);
-}
-
-static void catch_ctrlz(int n)
-{
-#ifdef __MINGW32__
-    G_warning("catch_ctrlz: ignored Ctrl-z");
-#else
-
-    RETSIGTYPE(*sigint) ();
-
-    /* having caught ctrlz - effect a ctrl-z using kill */
-    ctrlz = 1;
-    signal(n, SIG_DFL);
-    kill(0, n);
-
-    /* for berkley systems, ctrlz will not cause eof on read */
-    sigint = signal(SIGINT, catch_int);
-    kill(getpid(), SIGINT);
-    signal(SIGINT, sigint);
-#endif
-}
-
-static void catch_int(int n)
-{
-}

+ 0 - 48
lib/gis/intr_char.c

@@ -1,48 +0,0 @@
-#include <grass/gis.h>
-
-#include <grass/config.h>
-#ifndef __MINGW32__
-#if defined(HAVE_TERMIOS_H)
-# include <termios.h>
-# define TYPE termios
-# define C c_cc[VINTR]
-#elif defined(HAVE_TERMIO_H)
-# include <termio.h>
-# define TYPE termio
-# define C c_cc[VINTR]
-# define GET TCGETA
-#else
-# include <sgtty.h>
-# define TYPE tchars
-# define C t_intrc
-# define GET TIOCGETC
-#endif
-#endif
-
-/*!
- * \brief return interrupt char
- *
- * This routine returns the
- * user's keyboard interrupt character. This is the character that generates the
- * SIGINT signal from the keyboard.
- *
- *  \param ~
- *  \return char 
- */
-
-char G_intr_char(void)
-{
-    char c = 0;
-
-#ifndef __MINGW32__
-    struct TYPE buf;
-
-#ifdef HAVE_TERMIOS_H
-    tcgetattr(2, &buf);
-#else
-    ioctl(2, GET, &buf);
-#endif
-    c = buf.C;
-#endif
-    return c;
-}

+ 0 - 95
lib/gis/make_colr.c

@@ -1,95 +0,0 @@
-
-/**********************************************************************
- *
- *   G_make_color (name, mapset, colors)
- *       char *name               name of map
- *       char *mapset             mapset containing name
- *       struct Colors *colors    struct to hold colors
- *
- *   Interactively prompts user for deciding which type of color
- *   lookup table is desired.
- *       Red, green, and blue color ramps
- *       Gray scale
- *       Rainbow colors
- *       Random colors
- *       Color wave
- *       Aspect colors
- *       Red through yellow to green
- *
- *   Returns -1 user canceled the request
- *            1 color table is ok
- **********************************************************************/
-
-#include <grass/gis.h>
-#include <grass/glocale.h>
-
-int G_ask_colors(const char *name, const char *mapset, struct Colors *pcolr)
-{
-    char buff[128];
-    int answ;
-    struct FPRange range;
-    DCELL min, max;
-
-    G_init_colors(pcolr);
-
-    /* determine range cell values */
-    if (G_read_fp_range(name, mapset, &range) < 0)
-	return -1;
-    G_get_fp_range_min_max(&range, &min, &max);
-    if (G_is_d_null_value(&min) || G_is_d_null_value(&max)) {
-	sprintf(buff, _(" The raster map %s@%s is empty"), name, mapset);
-	G_warning(buff);
-	return -1;
-    }
-
-    /* Prompting */
-  ASK:
-    G_clear_screen();
-    fprintf(stderr,
-	    _("\n\nColor table needed for file [%s] in mapset [%s].\n"), name,
-	    mapset);
-
-    fprintf(stderr, _("\nPlease identify the type desired:\n"));
-    fprintf(stderr, _("    1:  Random colors\n"));
-    fprintf(stderr, _("    2:  Red, green, and blue color ramps\n"));
-    fprintf(stderr, _("    3:  Color wave\n"));
-    fprintf(stderr, _("    4:  Gray scale\n"));
-    fprintf(stderr, _("    5:  Aspect\n"));
-    fprintf(stderr, _("    6:  Rainbow colors\n"));
-    fprintf(stderr, _("    7:  Red through yellow to green\n"));
-    fprintf(stderr, _("    8:  Green through yellow to red\n"));
-    fprintf(stderr, _("RETURN  quit\n"));
-    fprintf(stderr, "\n> ");
-
-    for (;;) {
-	if (!G_gets(buff))
-	    goto ASK;
-	G_strip(buff);
-	if (*buff == 0)
-	    return -1;
-	if (sscanf(buff, "%d", &answ) != 1)
-	    answ = -1;
-
-	switch (answ) {
-	case 1:
-	    return G_make_random_colors(pcolr, (CELL) min, (CELL) max);
-	case 2:
-	    return G_make_ramp_fp_colors(pcolr, min, max);
-	case 3:
-	    return G_make_wave_fp_colors(pcolr, min, max);
-	case 4:
-	    return G_make_grey_scale_fp_colors(pcolr, min, max);
-	case 5:
-	    return G_make_aspect_fp_colors(pcolr, min, max);
-	case 6:
-	    return G_make_rainbow_fp_colors(pcolr, min, max);
-	case 7:
-	    return G_make_ryg_fp_colors(pcolr, min, max);
-	case 8:
-	    return G_make_gyr_fp_colors(pcolr, min, max);
-	default:
-	    fprintf(stderr, _("\n%s invalid; Try again > "), buff);
-	    break;
-	}
-    }
-}

+ 2 - 187
lib/gis/parser.c

@@ -130,10 +130,6 @@ static int check_required(void);
 static int split_opts(void);
 static int check_multiple_opts(void);
 static int check_overwrite(void);
-static int interactive(const char *);
-static int interactive_flag(struct Flag *);
-static int interactive_option(struct Option *);
-static int gis_prompt(struct Option *, char *);
 static int split_gisprompt(const char *, char *, char *, char *);
 
 static void G_gui(void);
@@ -807,15 +803,8 @@ int G_parser(int argc, char **argv)
     /* If there are NO arguments, go interactive */
 
     if (argc < 2 && interactive_ok && isatty(0)) {
-	if (getenv("GRASS_UI_TERM")) {
-	    interactive(argv[0]);
-	    opt_checked = 1;
-	    /* all options have been already checked interactively */
-	}
-	else {
-	    G_gui();
-	    return -1;
-	}
+	G_gui();
+	return -1;
     }
     else if (argc < 2 && isatty(0)) {
 	G_usage();
@@ -2564,134 +2553,6 @@ static int check_overwrite(void)
     return (error);
 }
 
-static int interactive(const char *command)
-{
-    struct Item *item;
-
-    /* Query for flags */
-
-    if (!n_items) {
-	fprintf(stderr, "PROGRAMMER ERROR: no flags or options\n");
-	exit(EXIT_FAILURE);
-    }
-
-    for (item = &first_item;;) {
-	if (item->flag)
-	    interactive_flag(item->flag);
-	else if (item->option)
-	    interactive_option(item->option);
-	else
-	    break;
-
-	item = item->next_item;
-
-	if (item == NULL)
-	    break;
-    }
-
-    return 0;
-}
-
-static int interactive_flag(struct Flag *flag)
-{
-    char buff[1024];
-
-    fprintf(stderr, _("\nFLAG: Set the following flag?\n"));
-    sprintf(buff, "    %s?", flag->description);
-    flag->answer = G_yes(buff, 0);
-
-    return 0;
-}
-
-static int interactive_option(struct Option *opt)
-{
-    char buff[1024], *bptr;
-    char buff2[1024];
-    int set_one;
-    int no_prompt;
-
-    fprintf(stderr, _("\nOPTION:   %s\n"), opt->description);
-    fprintf(stderr, _("     key: %s\n"), opt->key);
-    if (opt->key_desc)
-	fprintf(stderr, _("  format: %s\n"), opt->key_desc);
-    if (opt->def)
-	fprintf(stderr, _(" default: %s\n"), opt->def);
-    fprintf(stderr, _("required: %s\n"), opt->required ? "YES" : "NO");
-    if (opt->multiple)
-	fprintf(stderr, _("multiple: %s\n"), opt->multiple ? "YES" : "NO");
-    if (opt->options)
-	fprintf(stderr, _(" options: %s\n"), opt->options);
-    /*
-       show_options(0, opt->options) ;
-     */
-
-    set_one = 0;
-    for (;;) {
-	*buff = '\0';
-	if (opt->gisprompt)
-	    no_prompt = gis_prompt(opt, buff);
-	else
-	    no_prompt = -1;
-	if (no_prompt) {
-	    fprintf(stderr, _("enter option > "));
-	    if (fgets(buff, 1024, stdin) == 0)
-		exit(EXIT_SUCCESS);;
-	    bptr = buff;	/* strip newline  */
-	    while (*bptr) {
-		if (*bptr == '\n')
-		    *bptr = '\0';
-		bptr++;
-	    }
-
-	}
-
-	if (strlen(buff) != 0) {
-	    if (opt->options)
-		/* then check option */
-	    {
-		if (check_an_opt(opt->key, opt->type, opt->options, buff)) {
-		    if (G_yes(_("   Try again? "), 1))
-			continue;
-		    else
-			exit(EXIT_FAILURE);
-		}
-	    }
-	    if (opt->checker)
-		if (opt->checker(buff)) {
-		    fprintf(stderr, _("Sorry, %s is not accepted.\n"), buff);
-		    *buff = '\0';
-		    if (G_yes(_("   Try again? "), 1))
-			continue;
-		    else
-			exit(EXIT_FAILURE);
-		}
-
-	    sprintf(buff2, "%s=%s", opt->key, buff);
-	    if (!opt->gisprompt) {
-		fprintf(stderr, _("\nYou have chosen:\n  %s\n"), buff2);
-		if (G_yes(_("Is this correct? "), 1)) {
-		    set_option(buff2);
-		    set_one++;
-		}
-	    }
-	    else {
-		set_option(buff2);
-		set_one++;
-	    }
-	}			/* if strlen(buf ) !=0 */
-
-	if ((strlen(buff) == 0) && opt->required && (set_one == 0))
-	    exit(EXIT_FAILURE);
-	if ((strlen(buff) == 0) && (set_one > 0) && opt->multiple)
-	    break;
-	if ((strlen(buff) == 0) && !opt->required)
-	    break;
-	if ((set_one == 1) && !opt->multiple)
-	    break;
-    }
-    return (0);
-}
-
 static int split_gisprompt(const char *gisprompt, char *age, char *element,
 			   char *desc)
 {
@@ -2722,52 +2583,6 @@ static int split_gisprompt(const char *gisprompt, char *age, char *element,
     return 0;
 }
 
-static int gis_prompt(struct Option *opt, char *buff)
-{
-    char age[KEYLENGTH];
-    char element[KEYLENGTH];
-    char desc[KEYLENGTH];
-    char *ptr1;
-
-    split_gisprompt(opt->gisprompt, age, element, desc);
-
-	/*********ptr1 points to current mapset description***********/
-
-    if (opt->answer)
-	G_set_ask_return_msg(_("to accept the default"));
-    if (!strcmp("old", age)) {
-	ptr1 = G_ask_old("", buff, element, desc);
-	if (ptr1) {
-	    strcpy(buff, G_fully_qualified_name(buff, ptr1));
-	}
-    }
-    else if (!strcmp("new", age))
-	ptr1 = G_ask_new("", buff, element, desc);
-    else if (!strcmp("mapset", age))
-	ptr1 = G_ask_in_mapset("", buff, element, desc);
-    else if (!strcmp("any", age))
-	ptr1 = G_ask_any("", buff, element, desc, 1);
-    else if (!strcmp("old_file", age))	/* file must exist */
-	ptr1 = G_ask_old_file("", buff, element, desc);
-    else if (!strcmp("new_file", age))	/* file shouldn't exist unless overwrite is enabled */
-	ptr1 = G_ask_new_file("", buff, element, desc);
-    else if (!strcmp("color", age))
-	/* These prompts are only implemented in the gui */
-	/* The data can still be entered in the console */
-	return -1;
-    else {
-	fprintf(stderr,
-		"\nPROGRAMMER ERROR: first item in gisprompt is <%s>\n", age);
-	fprintf(stderr,
-		"        Must be either new, old, mapset, any, old_file, new_file, or color\n");
-	return -1;
-    }
-    if (ptr1 == '\0')
-	*buff = '\0';
-
-    return 0;
-}
-
 /**
  * \brief Creates command to run non-interactive.
  *

+ 0 - 71
lib/gis/yes.c

@@ -1,71 +0,0 @@
-
-/**
- * \file yes.c
- *
- * \brief GIS Library - Yes/No functions.
- *
- * (C) 2001-2008 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.
- *
- * \author GRASS GIS Development Team
- *
- * \date 1999-2008
- */
-
-#include <stdio.h>
-#include <grass/gis.h>
-
-
-/**
- * \brief Ask a yes/no question.
- *
- * This routine prints a <b>question</b> to the user, and expects the user to
- * respond either yes or no. (Invalid responses are rejected and the process is
- * repeated until the user answers yes or no.)<br>
- * The <b>default</b> indicates what the RETURN key alone should mean. A
- * <b>default</b> of 1 indicates that RETURN means yes, 0 indicates that RETURN
- * means no. The <b>question</b> will be appended with ''(y/n) '', and, 
- * if <b>default</b> is not -1, with ''[y] '' or ''[n] '', depending on 
- * the <b>default.</b><br>
- *
- * \param[in] question
- * \param[in] dflt
- * \return 0 for No
- * \return 1 for Yes
- */
-
-int G_yes(const char *question, int dflt)
-{
-    fflush(stdout);
-
-    while (1) {
-	char answer[100];
-
-	fprintf(stderr, "%s", question);
-
-	while (1) {
-	    fprintf(stderr, "(y/n) ");
-	    if (dflt >= 0)
-		fprintf(stderr, dflt == 0 ? "[n] " : "[y] ");
-
-	    fflush(stderr);
-	    if (!G_gets(answer))
-		break;
-	    G_strip(answer);
-
-	    switch (*answer) {
-	    case 'y':
-	    case 'Y':
-		return (1);
-	    case 'n':
-	    case 'N':
-		return (0);
-	    case 0:
-		if (dflt >= 0)
-		    return (dflt);
-	    }
-	}
-    }
-}

+ 0 - 67
lib/imagery/ask_group.c

@@ -1,67 +0,0 @@
-
-/*************************************************************
-* I_ask_group_old (prompt,group)
-*
-* prompt the user for an imagery group file name
-*************************************************************/
-#include <string.h>
-#include <grass/gis.h>
-#include <grass/imagery.h>
-static int ask_group(char *, char *);
-
-
-/*!
- * \brief prompt for an existing group
- *
- * Asks the user to enter the name of an existing <b>group</b>
- * in the current mapset.
- *
- *  \param prompt
- *  \param group
- *  \return int
- */
-
-int I_ask_group_old(char *prompt, char *group)
-{
-    while (1) {
-	if (*prompt == 0)
-	    prompt = "Select an imagery group file";
-	if (!ask_group(prompt, group))
-	    return 0;
-	if (I_find_group(group))
-	    return 1;
-	fprintf(stderr, "\n** %s - not found **\n\n", group);
-    }
-}
-
-static int ask_group(char *prompt, char *group)
-{
-    char buf[1024];
-
-    while (1) {
-	fprintf(stderr, "\n%s\n", prompt);
-	fprintf(stderr,
-		"Enter 'list' for a list of existing imagery groups\n");
-	fprintf(stderr, "Enter 'list -f' for a verbose listing\n");
-	fprintf(stderr, "Hit RETURN %s\n", G_get_ask_return_msg());
-	fprintf(stderr, "> ");
-	if (!G_gets(buf))
-	    continue;
-
-	G_squeeze(buf);
-	fprintf(stderr, "<%s>\n", buf);
-	if (*buf == 0)
-	    return 0;
-
-	if (strcmp(buf, "list") == 0)
-	    I_list_groups(0);
-	else if (strcmp(buf, "list -f") == 0)
-	    I_list_groups(1);
-	else if (G_legal_filename(buf) < 0)
-	    fprintf(stderr, "\n** <%s> - illegal name **\n\n", buf);
-	else
-	    break;
-    }
-    strcpy(group, buf);
-    return 1;
-}

+ 0 - 6
lib/imagery/ls_groups.c

@@ -71,9 +71,6 @@ int I_list_groups(int full)
     fclose(temp);
     G_spawn(getenv("GRASS_PAGER"), getenv("GRASS_PAGER"), tempfile, NULL);
     remove(tempfile);
-    fprintf(stdout, "hit RETURN to continue -->");
-    fflush(stdout);
-    G_gets(buf);
 
     return 0;
 }
@@ -129,9 +126,6 @@ int I_list_subgroups(const char *group, int full)
     fclose(temp);
     G_spawn(getenv("GRASS_PAGER"), getenv("GRASS_PAGER"), tempfile, NULL);
     remove(tempfile);
-    fprintf(stdout, "hit RETURN to continue -->");
-    fflush(stdout);
-    G_gets(buf);
 
     return 0;
 }

+ 0 - 12
lib/init/Makefile

@@ -23,20 +23,11 @@ include $(MODULE_TOPDIR)/include/Make/Rules.make
 START_UP=grass$(GRASS_VERSION_MAJOR)$(GRASS_VERSION_MINOR)
 
 EXTRA_CFLAGS = -DD_LOCATION_NAME=\"$(DEFAULT_LOCATION)\" -DD_GISDBASE=\"$(DEFAULT_DATABASE)\" -DGRASS_VERSION_NUMBER=\"'$(GRASS_VERSION_NUMBER)'\" -DGRASS_VERSION_UPDATE_PKG=\"'$(GRASS_VERSION_UPDATE_PKG)'\"
-SET_DATA = $(OBJDIR)/set_data.o $(OBJDIR)/mke_mapset.o \
-	   $(OBJDIR)/mke_loc.o $(OBJDIR)/chk_dbase.o $(OBJDIR)/other.o
-
-ifdef USE_CURSES
-SET_DATA_PROG = $(ETC)/set_data$(EXE)
-else
-SET_DATA_PROG =
-endif
 
 FILES = \
 	$(ARCH_BINDIR)/$(START_UP) \
 	$(ETC)/Init.sh \
 	$(ETC)/prompt.sh \
-	$(SET_DATA_PROG) \
 	$(ETC)/clean_temp$(EXE) \
 	$(ETC)/lock$(EXE) \
 	$(ETC)/run$(EXE) \
@@ -118,9 +109,6 @@ $(ETC)/Init.bat: init.bat
 	$< > $@"
 	chmod +x $@
 
-$(ETC)/set_data$(EXE): $(SET_DATA)
-	$(CC) $(LDFLAGS) -o $@ $(SET_DATA) $(EDITLIB) $(GISLIB) $(DATETIMELIB) $(VASKLIB) $(CURSES) $(MATHLIB) $(XDRLIB)
-
 $(ETC)/echo$(EXE): $(OBJDIR)/echo.o
 	$(CC) $(LDFLAGS) $(OBJDIR)/echo.o -o $@
 

+ 0 - 38
lib/init/chk_dbase.c

@@ -1,38 +0,0 @@
-#include <stdio.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#ifndef __MINGW32__
-#  include <pwd.h>
-#endif
-
-int can_make_location(char *gisdbase, char *location)
-{
-    struct stat s;
-    struct passwd *pwd;
-
-    /* make sure this is a directory */
-    if (stat(gisdbase, &s) != 0) {
-	fprintf(stderr, "\n** %s not found **\n", gisdbase);
-	return 0;
-    }
-    if (!(s.st_mode & S_IFDIR)) {
-	fprintf(stderr, "\n** %s is not a directory **\n", gisdbase);
-	return 0;
-    }
-
-    /* look for write permission */
-    if (access(gisdbase, 2) == 0)
-	return 1;
-
-    fprintf(stderr, "\nNote\n");
-    fprintf(stderr,
-	    " You don't have permission under %s to create a new location\n",
-	    gisdbase);
-#ifndef __MINGW32__
-    if ((pwd = getpwuid(s.st_uid)))
-	fprintf(stderr, " See user %s about creating location %s\n",
-		pwd->pw_name, location);
-#endif
-    return 0;
-}

+ 0 - 195
lib/init/mke_loc.c

@@ -1,195 +0,0 @@
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <grass/gis.h>
-#include "local_proto.h"
-
-int make_location(const char *gisdbase, const char *location_name)
-{
-    struct Cell_head window;
-    char buf[GPATH_MAX];
-    int i;
-    char myname[75];
-    char *mapset;
-    char *name, c;
-    FILE *fp;
-
-    G_clear_screen();
-    fprintf(stderr,
-	    "To create a new LOCATION, you will need the following information:\n");
-    fprintf(stderr, "\n");
-    fprintf(stderr, "1. The coordinate system for the database\n");
-    /*for (i = 1; name = G__projection_name(i); i++) */
-    fprintf(stderr, "        %s (for imagery and other unreferenced data)\n",
-	    G__projection_name(PROJECTION_XY));
-    fprintf(stderr, "        %s\n", G__projection_name(PROJECTION_LL));
-    fprintf(stderr, "        %s\n", G__projection_name(PROJECTION_UTM));
-    fprintf(stderr, "        %s\n", G__projection_name(PROJECTION_OTHER));
-    fprintf(stderr, "2. The zone for the %s database\n",
-	    G__projection_name(PROJECTION_UTM));
-    fprintf(stderr,
-	    "   and all the necessary parameters for projections other than\n");
-    fprintf(stderr, "   %s, %s, and %s\n", G__projection_name(PROJECTION_LL),
-	    G__projection_name(PROJECTION_XY),
-	    G__projection_name(PROJECTION_UTM));
-    fprintf(stderr,
-	    "3. The coordinates of the area to become the default region\n");
-    fprintf(stderr, "   and the grid resolution of this region\n");
-    fprintf(stderr,
-	    "4. A short, one-line description or title for the location\n");
-    fprintf(stderr, "\n");
-
-    if (!G_yes("Do you have all this information? ", 1))
-	return 0;
-
-    G_zero(&window, sizeof(window));
-    while (1) {
-	G_clear_screen();
-	fprintf(stderr,
-		"Please specify the coordinate system for location <%s>\n\n",
-		location_name);
-	fprintf(stderr, "A   %s\n", G__projection_name(PROJECTION_XY));
-	fprintf(stderr, "B   %s\n", G__projection_name(PROJECTION_LL));
-	fprintf(stderr, "C   %s\n", G__projection_name(PROJECTION_UTM));
-	fprintf(stderr, "D   %s\n", G__projection_name(PROJECTION_OTHER));
-	fprintf(stderr, "RETURN to cancel\n");
-	fprintf(stderr, "\n");
-	fprintf(stderr, "> ");
-	if (!G_gets(buf))
-	    continue;
-	G_strip(buf);
-	if (*buf == 0)
-	    return 0;
-	if (sscanf(buf, "%c", &c) != 1)
-	    continue;
-	switch (c) {
-	case 'A':
-	    i = PROJECTION_XY;
-	    break;
-	case 'a':
-	    i = PROJECTION_XY;
-	    break;
-	case 'B':
-	    i = PROJECTION_LL;
-	    break;
-	case 'b':
-	    i = PROJECTION_LL;
-	    break;
-	case 'C':
-	    i = PROJECTION_UTM;
-	    break;
-	case 'c':
-	    i = PROJECTION_UTM;
-	    break;
-	case 'D':
-	    i = PROJECTION_OTHER;
-	    break;
-	case 'd':
-	    i = PROJECTION_OTHER;
-	    break;
-	default:
-	    continue;
-	}
-	name = G__projection_name(i);
-	if (name == NULL)
-	    continue;
-	fprintf(stderr, "\n");
-	sprintf(buf, "\n%s coordinate system? ", name);
-	if (G_yes(buf, 1))
-	    break;
-    }
-    window.proj = i;
-    /*
-       while (window.proj == PROJECTION_UTM)
-       {
-       fprintf (stderr, " ("Please specify the %s zone for location <%s>\n",
-       G__projection_name(window.proj), location_name);
-       fprintf (stderr, " ("or RETURN to cancel\n");
-       fprintf (stderr, " ("\n");
-       fprintf (stderr, " ("> ");
-       if (!G_gets(buf))
-       continue;
-       G_strip (buf);
-       if (*buf == 0) return 0;
-       if (sscanf (buf, "%d", &i) != 1)
-       continue;
-       if (i > 0 && i <= 60)
-       {
-       fprintf(stderr, "zone %d is illegal"\n);
-       fprintf (stderr, " ("\n");
-       sprintf (buf, "zone %d? ", i);
-       if (G_yes (buf, 1))
-       {
-       window.zone = i;
-       break;
-       }
-       }
-     */
-
-    while (1) {
-	G_clear_screen();
-	fprintf(stderr,
-		"Please enter a one line description for location <%s>\n\n",
-		location_name);
-	fprintf(stderr, "> ");
-	if (!G_gets(buf))
-	    continue;
-	G_squeeze(buf);
-	buf[sizeof(myname)] = 0;
-	G_squeeze(buf);
-	fprintf(stderr,
-		"=====================================================\n");
-	fprintf(stderr, "%s\n", buf);
-	fprintf(stderr,
-		"=====================================================\n");
-	if (G_yes("ok? ", *buf != 0))
-	    break;
-    }
-    strcpy(myname, buf);
-    /*
-       if(G_edit_cellhd(&window, -1) < 0)
-       return 0;
-     */
-
-    mapset = "PERMANENT";
-    G__setenv("MAPSET", mapset);
-    G__setenv("LOCATION_NAME", location_name);
-
-    sprintf(buf, "%s/%s", gisdbase, location_name);
-    if (G_mkdir(buf) < 0)
-	return 0;
-    sprintf(buf, "%s/%s/%s", gisdbase, location_name, mapset);
-    if (G_mkdir(buf) < 0)
-	return 0;
-    /* set the dummy window */
-    window.north = 1.;
-    window.south = 0.;
-    window.top = 1.;
-    window.bottom = 0.;
-    window.rows = 1;
-    window.rows3 = 1;
-    window.cols = 1;
-    window.cols3 = 1;
-    window.depths = 1;
-    window.ew_res = 1.;
-    window.ew_res3 = 1.;
-    window.ns_res = 1.;
-    window.ns_res3 = 1.;
-    window.tb_res = 1.;
-    window.east = 1.;
-    window.west = 0.;
-    window.zone = 0.;
-    /* make a dummy default window for location */
-    /* later after calling g.setrpj we will let user create a real default window */
-    G__put_window(&window, "", "DEFAULT_WIND");
-    G__put_window(&window, "", "WIND");
-
-    sprintf(buf, "%s/%s/%s/MYNAME", gisdbase, location_name, mapset);
-    fp = fopen(buf, "w");
-    fputs(myname, fp);
-    fclose(fp);
-
-    return 1;
-}

+ 0 - 52
lib/init/mke_mapset.c

@@ -1,52 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-extern int errno;
-
-#include <grass/gis.h>
-
-int make_mapset(const char *location, const char *mapset)
-{
-    char buffer[GPATH_MAX];
-    char *buffer2;
-    FILE *fd;
-    struct Cell_head window;
-
-    /* create the mapset directory */
-    sprintf(buffer, "%s/%s", location, mapset);
-    G_mkdir(buffer);
-
-    /* give the mapset a default window for the entire location */
-    G_get_default_window(&window);
-    G_put_window(&window);
-
-    /* generate DB settings file in new mapset */
-    G_asprintf(&buffer2, "%s/%s/VAR", location, mapset);
-    if ((fd = fopen(buffer2, "w")) == NULL) {
-	perror("fopen");
-	G_fatal_error("Cannot create <%s> file in new mapset", buffer2);
-    }
-    /* Use DB_DEFAULT_DRIVER from <grass/dbmi.h> instead of hardcoding? */
-    fprintf(fd, "DB_DRIVER: sqlite\n");
-    fprintf(fd, "DB_DATABASE: $GISDBASE/$LOCATION_NAME/$MAPSET/sqlite.db\n");
-    fclose(fd);
-    G_free(buffer2);
-
-#ifdef KEEP_IF_DB_PER_MAP
-    /* create similar dir structure for SQLite if a db file is to be
-       created for every vector map instead of one DB per mapset */
-    if (strcmp(DB_DEFAULT_DRIVER, "dbf") == 0) {
-	/* Make the dbf/ subdirectory */
-	sprintf(buffer, "%s/%s/dbf", location, mapset);
-	if (G_mkdir(buffer) != 0)
-	    return -1;
-    }
-#endif
-
-    return (0);
-}

+ 0 - 57
lib/init/other.c

@@ -1,57 +0,0 @@
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <grass/gis.h>
-#include "local_proto.h"
-
-static char *filename(const char *name, const char *mapset)
-{
-    static char path[GPATH_MAX];
-
-    G__file_name(path, "", name, mapset);
-    return path;
-}
-
-int mapset_permissions(const char *mapset)
-{
-    int stat;
-
-    stat = G__mapset_permissions(mapset);
-    if (stat == 1) {
-	if (access(filename(".lock", mapset), 0) == 0)
-	    stat = 0;
-    }
-    return stat;
-}
-
-int mapset_message(const char *mapset)
-{
-    if (printfile(filename(".message", mapset)))
-	hit_return();
-
-    return 0;
-}
-
-int mapset_question(const char *mapset)
-{
-    if (printfile(filename(".question", mapset)))
-	return G_yes("Select this mapset? ", -1);
-    return 1;
-}
-
-int printfile(const char *name)
-{
-    int fd;
-    int n;
-    char buf[1024];
-
-    fd = open(name, 0);
-    if (fd < 0)
-	return 0;
-    while ((n = read(fd, buf, sizeof buf)) > 0)
-	write(STDOUT_FILENO, buf, n);
-    close(fd);
-    return 1;
-}

+ 0 - 348
lib/init/set_data.c

@@ -1,348 +0,0 @@
-/* setup:  Program for GRASS user to first use.  Sets environment
- * variables:  LOCATION_NAME MAPSET GISDBASE
- */
-
-
-/* these defines come from the Gmakefile, but are defined here to allow
- * debugging with saber
- */
-#ifndef D_LOCATION_NAME
-#define D_LOCATION_NAME "spearfish"
-#endif
-#ifndef D_GISDBASE
-#define D_GISDBASE "/data"
-#endif
-#ifndef GRASS_VERSION_NUMBER
-#define GRASS_VERSION_NUMBER ""
-#endif
-
-
-
-static char *intro[] = {
-    "                   PLEASE SET SESSION INFORMATION",
-    "",
-    "DATABASE: A directory (folder) on disk to contain all GRASS maps and data.",
-    "",
-    "LOCATION: This is the name of a geographic location. It is defined by a",
-    "          co-ordinate system and a rectangular boundary.",
-    "",
-    "MAPSET:   Each GRASS session runs under a particular MAPSET. This consists of",
-    "          a rectangular REGION and a set of maps. Every LOCATION contains at",
-    "          least a MAPSET called PERMANENT, which is readable by all sessions.",
-    "",
-    "         The REGION defaults to the entire area of the chosen LOCATION.",
-    "         You may change it later with the command: g.region",
-    "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ",
-    0
-};
-static char *loc_text =
-    "LOCATION:                              (enter list for a list of locations)";
-static char *map_text =
-    "MAPSET:                                (or mapsets within a location)";
-
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <grass/gis.h>
-#include <grass/vask.h>
-#include <grass/edit.h>
-#include "local_proto.h"
-
-int main(int argc, char *argv[])
-{
-    char version[80];
-    char gisdbase[70];
-    char location_name[41];
-    char location[1024];
-    char mapset[41];
-    int line;
-    int yes;
-    struct Cell_head window;
-
-    char *GISDBASE;
-    char *LOCATION_NAME;
-    char *MAPSET;
-
-    int repeat;
-
-    /* GISBASE
-     *   comes from the unix environment and must be set
-     *   make sure it is NOT in the .gisrc file
-     *   note: G_getenv() make a special case of this variable
-     */
-    G_no_gisinit();
-
-    G_unsetenv("GISBASE");	/* this cleans the variable */
-    G_getenv("GISBASE");	/* this reads it from the unix environment */
-
-    /* Gather all existing variables ********************************************* */
-    GISDBASE = G__getenv("GISDBASE");
-    LOCATION_NAME = G__getenv("LOCATION_NAME");
-    MAPSET = G__getenv("MAPSET");
-
-    if (!MAPSET)
-	MAPSET = G_whoami();
-    if (!LOCATION_NAME)
-	LOCATION_NAME = D_LOCATION_NAME;
-    if (!GISDBASE)
-	GISDBASE = D_GISDBASE;
-
-    strcpy(mapset, MAPSET);
-    strcpy(location_name, LOCATION_NAME);
-    strcpy(gisdbase, GISDBASE);
-    G__setenv("GISDBASE", gisdbase);
-
-    sprintf(version, "                            GRASS %s",
-	    GRASS_VERSION_NUMBER);
-
-    for (repeat = 1; repeat; hit_return()) {
-	V_clear();
-	V_line(0, version);
-	for (line = 1; intro[line]; line++)
-	    V_line(line, intro[line]);
-
-	line++;
-	V_line(line, loc_text);
-	V_ques(location_name, 's', line++, 12, 25);
-
-	V_line(line, map_text);
-	V_ques(mapset, 's', line++, 12, 25);
-
-	line++;
-	V_line(line, "DATABASE:");
-	V_ques(gisdbase, 's', line++, 10, sizeof(gisdbase) - 1);
-
-	V_intrpt_ok();
-	if (!V_call())
-	    exit(1);
-
-	G_strip(gisdbase);
-	if (*gisdbase == 0) {
-	    fprintf(stderr, "No DATABASE specified\n");
-	    strcpy(gisdbase, D_GISDBASE);
-	    continue;
-	}
-#ifdef __MINGW32__
-	if (*gisdbase == '/') {
-	    char tmp[200], *p;
-
-	    sprintf(tmp, "%s", getenv("WD"));
-	    for (p = tmp + strlen(tmp); --p >= tmp && *p == '\\';) ;
-	    for (; --p >= tmp && *p != '\\';) ;
-	    for (; --p >= tmp && *p == '\\';) ;
-	    *(p + 1) = 0;
-	    for (p = tmp; *p; p++)
-		if (*p == '\\')
-		    *p = '/';
-	    strcat(tmp, gisdbase);
-	    strcpy(gisdbase, tmp);
-	}
-	if (!gisdbase[1] || gisdbase[1] != ':')
-#else
-	if (*gisdbase != '/')
-#endif
-	{
-	    char temp[200];
-
-	    fprintf(stderr, "DATABASE <%s> - must start with /\n", gisdbase);
-	    sprintf(temp, " '%s'", gisdbase);
-	    strcpy(gisdbase, temp);
-	    continue;
-	}
-	if (access(gisdbase, 0) != 0) {
-	    fprintf(stderr, "DATABASE <%s> - not found\n", gisdbase);
-	    continue;
-	}
-	G__setenv("GISDBASE", gisdbase);
-
-	/* take only first word of responses */
-	first_word(location_name);
-	first_word(mapset);
-
-	if (*location_name && (G_legal_filename(location_name) < 0)) {
-	    fprintf(stderr, "LOCATION <%s> - illegal name\n", location_name);
-	    continue;
-	}
-	if (*mapset && (G_legal_filename(mapset) < 0)) {
-	    fprintf(stderr, "MAPSET <%s> - illegal name\n", mapset);
-	    continue;
-	}
-
-	if (*location_name == 0 || strcmp(location_name, "list") == 0) {
-	    list_locations(gisdbase);
-	    *location_name = 0;
-	    continue;
-	}
-	sprintf(location, "%s/%s", gisdbase, location_name);
-	if (access(location, 0) != 0) {
-	    fprintf(stderr, "LOCATION <%s> - doesn't exist\n", location_name);
-	    list_locations(gisdbase);
-	    if (!can_make_location(gisdbase, location_name))
-		continue;
-
-	    fprintf(stderr, "\nWould you like to create location <%s> ? ",
-		    location_name);
-	    if (G_yes("", 1)) {
-		if (make_location(gisdbase, location_name)) {
-
-		    G__setenv("LOCATION_NAME", location_name);
-		    G__setenv("MAPSET", "PERMANENT");
-		    G__write_env();
-
-
-		    if (system("g.setproj")) {
-			G_get_default_window(&window);
-			if (E_edit_cellhd(&window, -1) < 0)
-			    fprintf(stderr,
-				    "WARNING: You did not provide default region for %s!\n",
-				    location_name);
-
-			G__put_window(&window, "", "DEFAULT_WIND");
-			G__put_window(&window, "", "WIND");
-			fprintf(stderr, "LOCATION <%s> created\n",
-				location_name);
-			fprintf(stderr,
-				"\nBut the PROJECTION information files were not created!\n");
-			fprintf(stderr,
-				"You must run g.setproj successfully before projection software will work%c%c%c\n",
-				7, 7, 7);
-			continue;
-		    }
-		    else {
-			G_get_default_window(&window);
-			if (E_edit_cellhd(&window, -1) < 0)
-			    fprintf(stderr,
-				    "WARNING: You did not provide default region for %s!\n",
-				    location_name);
-			G__put_window(&window, "", "DEFAULT_WIND");
-			G__put_window(&window, "", "WIND");
-			fprintf(stderr, "LOCATION <%s> created!\n",
-				location_name);
-			continue;
-		    }
-		}
-		fprintf(stderr, "LOCATION <%s> NOT created\n", location_name);
-	    }
-	    continue;
-	}
-	G__setenv("LOCATION_NAME", location_name);
-	if (*mapset == 0 || strcmp(mapset, "list") == 0) {
-	    list_mapsets(location_name, location);
-	    *mapset = 0;
-	    continue;
-	}
-	G__setenv("MAPSET", mapset);
-
-	repeat = 0;
-
-	switch (mapset_permissions(mapset)) {
-	case -1:
-	    if (strcmp(mapset, G_whoami()) == 0) {
-		yes = 1;
-	    }
-	    else {
-		repeat = 1;
-		fprintf(stderr, "\n\nMapset <<%s>> is not available\n",
-			mapset);
-		list_mapsets(location_name, location);
-		fprintf(stderr,
-			"\nWould you like to create < %s > as a new mapset? ",
-			mapset);
-		yes = G_yes("", 1);
-	    }
-
-	    if (yes && (make_mapset(location, mapset) == 0))
-		repeat = 0;
-	    break;
-	case 0:
-	    fprintf(stderr, "\n\nSorry, no access to <<%s>>.\n", mapset);
-	    list_mapsets(location_name, location);
-	    repeat = 1;
-	    break;
-	case 1:
-	    mapset_message(mapset);
-	    if (!mapset_question(mapset))
-		repeat = 1;
-	    break;
-	}
-	if (!repeat)
-	    break;
-    }
-
-    G__write_env();
-    exit(0);
-}
-
-int list_locations(const char *gisdbase)
-{
-    fprintf(stderr, "\nAvailable locations:\n");
-    fprintf(stderr, "----------------------\n");
-    G_ls(gisdbase, stderr);
-    fprintf(stderr, "----------------------\n");
-    return 0;
-}
-
-int list_mapsets(const char *location_name, const char *location)
-{
-    char **mapsets;
-    int i, num_mapsets;
-    int any, ok, any_ok;
-    int len, tot_len;
-
-    fprintf(stderr, "\nMapsets in location <%s>\n", location_name);
-    fprintf(stderr, "----------------------\n");
-    mapsets = G__ls(location, &num_mapsets);
-    any = 0;
-    any_ok = 0;
-    tot_len = 0;
-    if (num_mapsets > 0) {
-	for (i = 0; i < num_mapsets; i++) {
-	    any = 1;
-	    len = strlen(mapsets[i]) + 1;
-	    len /= 20;
-	    len = (len + 1) * 20;
-	    tot_len += len;
-	    if (tot_len > 75) {
-		fprintf(stderr, "\n");
-		tot_len = len;
-	    }
-	    if ((ok = (mapset_permissions(mapsets[i]) == 1)))
-		any_ok = 1;
-	    fprintf(stderr, "%s%-*s", ok ? "(+)" : "   ", len, mapsets[i]);
-	}
-	if (tot_len)
-	    fprintf(stderr, "\n");
-	if (any_ok)
-	    fprintf(stderr,
-		    "\nnote: you only have access to mapsets marked with (+)\n");
-	else if (any)
-	    fprintf(stderr,
-		    "\nnote: you do not have access to any of these mapsets\n");
-    }
-    fprintf(stderr, "----------------------\n");
-
-    return 0;
-}
-
-int first_word(char *buf)
-{
-    char temp[GNAME_MAX];
-
-    *temp = 0;
-    sscanf(buf, "%s", temp);
-    strcpy(buf, temp);
-
-    return 0;
-}
-
-int hit_return(void)
-{
-    char buf[80];
-
-    fprintf(stderr, "\nHit RETURN -->");
-    G_gets(buf);
-
-    return 0;
-}

+ 0 - 148
lib/proj/datum.c

@@ -216,154 +216,6 @@ int GPJ__get_datum_params(struct Key_Value *projinfo,
 }
 
 /**
- *  \brief Interactively ask for datum parameters for a particular datum
- * 
- *  Uses traditional GRASS interactive prompt interface to provide 
- *  information to user and encourage him/her to select the most 
- *  appropriate set of datum transformation parameters for the location.
- *  Could really benefit from an abstracted user interaction library
- *  for seamless GUI interaction.
- *
- *  \param datumname     String containing datum name that
- *                       parameters are to be found for. Must
- *                       exist in datum.table or be "custom"
- * 
- *  \param params        Pointer to a pointer that will have 
- *                       memory allocated and into which a string 
- *                       containing the datum parameters chosen 
- *                       by the user will be placed.
- *
- *  \return 1 ok, -1 error or user cancelled
- * 
- **/
-
-int GPJ_ask_datum_params(const char *datumname, char **params)
-{
-    char buff[1024], answer[100];
-    char *Tmp_file;
-    FILE *Tmp_fd = NULL;
-    struct gpj_datum_transform_list *list, *listhead, *old;
-    int transformcount, currenttransform;
-
-    if (G_strcasecmp(datumname, "custom") != 0) {
-	Tmp_file = G_tempfile();
-	if (NULL == (Tmp_fd = fopen(Tmp_file, "w"))) {
-	    G_warning(_("Unable to open temporary file"));
-	}
-
-	fprintf(Tmp_fd, "Number\tDetails\t\n---\n");
-	listhead = GPJ_get_datum_transform_by_name(datumname);
-	list = listhead;
-	transformcount = 0;
-	while (list != NULL) {
-	    /* Count how many sets of transformation paramters have been 
-	     * defined for this datum and print them to a temporary file 
-	     * in case the user asks for them to be displayed */
-	    fprintf(Tmp_fd,
-		    "%d\tUsed in %s\n\t(PROJ.4 Params %s)\n\t%s\n---\n",
-		    list->count, list->where_used, list->params,
-		    list->comment);
-	    list = list->next;
-	    transformcount++;
-	}
-	fclose(Tmp_fd);
-
-	for (;;) {
-	    do {
-		fprintf(stderr,
-			("\nNow select Datum Transformation Parameters\n"));
-		fprintf(stderr,
-			("Please think carefully about the area covered by your data\n"
-			 "and the accuracy you require before making your selection.\n"));
-		fprintf(stderr,
-			("\nEnter 'list' to see the list of available Parameter sets\n"));
-		fprintf(stderr,
-			("Enter the corresponding number, or <RETURN> to cancel request\n"));
-		fprintf(stderr, ">");
-	    } while (!G_gets(answer));
-	    G_strip(answer);
-	    if (strlen(answer) == 0) {
-		remove(Tmp_file);
-		G_free(Tmp_file);
-		return -1;
-	    }
-	    if (strcmp(answer, "list") == 0) {
-		char *pager;
-
-		pager = getenv("GRASS_PAGER");
-		if (!pager || strlen(pager) == 0)
-		    pager = "cat";
-
-		/* Always print interactive output to stderr */
-		sprintf(buff, "%s \"%s\" 1>&2", pager,
-			G_convert_dirseps_to_host(Tmp_file));
-		G_system(buff);
-	    }
-	    else {
-		if ((sscanf(answer, "%d", &currenttransform) != 1) ||
-		    currenttransform > transformcount ||
-		    currenttransform < 1) {
-
-		    /* If a number was not typed, was less than 0 or greater
-		     * than the number of sets of parameters, ask again */
-		    fprintf(stderr, ("\ninvalid transformation number\n"));
-		}
-		else
-		    break;
-	    }
-
-	}
-	remove(Tmp_file);
-	G_free(Tmp_file);
-
-	list = listhead;
-	while (list != NULL) {
-	    /* Search through the linked list to find the parameter string
-	     * that corresponds to the number entered */
-	    if (list->count == currenttransform)
-		G_asprintf(params, list->params);
-
-	    /* Continue to end of list even after we find it, to free all
-	     * the memory used */
-	    old = list;
-	    list = old->next;
-	    G_free(old);
-	}
-    }
-    else {
-	/* Here we ask the user to enter customised parameters */
-	for (;;) {
-	    do {
-		fprintf(stderr,
-			("\nPlease specify datum transformation parameters in PROJ.4 syntax. Examples:\n"));
-		fprintf(stderr,
-			("\ttowgs84=dx,dy,dz\t(3-parameter transformation)\n"));
-		fprintf(stderr,
-			("\ttowgs84=dx,dy,dz,rx,ry,rz,m\t(7-parameter transformation)\n"));
-		fprintf(stderr,
-			("\tnadgrids=alaska\t(Tables-based grid-shifting transformation)\n"));
-		fprintf(stderr, _("Hit RETURN to cancel request\n"));
-		fprintf(stderr, ">");
-	    } while (!G_gets(answer));
-	    G_strip(answer);
-	    if (strlen(answer) == 0)
-		return -1;
-	    G_asprintf(params, answer);
-	    sprintf(buff,
-		    "Parameters to be used are:\n\"%s\"\nIs this correct?",
-		    *params);
-	    if (G_yes(buff, 1))
-		break;
-
-	}
-
-    }
-
-    return 1;
-
-}
-
-/**
  * \brief Internal function to find all possible sets of 
  *        transformation parameters for a particular datum
  *  

+ 0 - 52
lib/sites/sites.c

@@ -249,34 +249,6 @@ int G_site_get_head(struct Map_info *Map, Site_head * head)
 }
 
 /*-************************************************************************
- *   char *
- *   G_ask_sites_new(prompt, name))
- *       asks user to input name of a new site list file
- *
- *   char *
- *   G_ask_sites_old(prompt, name)
- *       asks user to input name of an existing site list file
- *
- *   char *
- *   G_ask_sites_any(prompt, name)
- *       asks user to input any site list name
- *
- *   char *
- *   G_ask_sites_in_mapset(prompt, name)
- *       asks user to input name of an existing site list file in
- *       current mapset
- *
- *   parms:
- *      char *prompt    optional prompt for user
- *      char *name      buffer to hold name of map found
- *
- *   returns:
- *      char *pointer to a string with name of mapset
- *       where file was found, or NULL if not found
- *
- *   note:
- *      rejects all names that begin with .
- **********************************************************************
  *
  *  struct Map_info *
  *  G_sites_open_old (name, mapset)
@@ -304,30 +276,6 @@ char *G_find_sites2(const char *name, const char *mapset)
 }
 
 
-char *G_ask_sites_new(const char *prompt, char *name)
-{
-    return G_ask_new(prompt, name, "vector", "vector");
-}
-
-
-char *G_ask_sites_old(const char *prompt, char *name)
-{
-    return G_ask_old(prompt, name, "vector", "vector");
-}
-
-
-char *G_ask_sites_any(const char *prompt, char *name)
-{
-    return G_ask_any(prompt, name, "vector", "vector", 1);
-}
-
-
-char *G_ask_sites_in_mapset(const char *prompt, char *name)
-{
-    return G_ask_in_mapset(prompt, name, "vector", "vector");
-}
-
-
 struct Map_info *G_sites_open_old(const char *name, const char *mapset)
 {
     struct Map_info *Map;

+ 0 - 12
lib/vask/Makefile

@@ -1,12 +0,0 @@
-MODULE_TOPDIR = ../..
-
-EXTRA_LIBS=$(GISLIB) $(CURSES)
-
-EXTRA_CFLAGS	= -DMAKE_VASK_LIB
-
-LIB_NAME = $(VASK_LIBNAME)
-
-include $(MODULE_TOPDIR)/include/Make/Lib.make
-
-default: lib
-

+ 0 - 35
lib/vask/README

@@ -1,36 +0,0 @@
-From: Glynn Clements <glynn.clements@virgin.net>
-Date: Fri, 1 Jun 2001 00:31:44 +0100
-To: Markus Neteler <neteler@geog.uni-hannover.de>, grass5@geog.uni-hannover.de
-Subject: Vask changes
-
-Glynn Clements wrote:
-
-[...]
-> I'll do the more substantial changes to vasklib today or tonight.
-
-I've now commited these.
-
-The main change is that V_call() now has curses process the escape
-sequences for extended keys, rather than using hardcoded definitions.
-
-Extended keys (cursor keys, Home, End) should now work on any terminal
-which has a correct termcap/terminfo entry.
-
-One possible disadvantage is that if the termcap/terminfo entry is
-broken, you will get undesirable results. This seems most likely to
-happen with xterm, which has many configuration options which impact
-upon the necessary terminal description.
-
-The main one of relevance here is the sunKeyboard resource,
-corresponding to the [+/-]sp command line flag and the "Sun Keyboard"
-(or "VT220 Keyboard" in recent XFree86) menu option (Ctrl + left mouse
-button). This affects whether the escape sequences generated by
-Home/End are the Sun versions or the VT220 versions.
-
-BTW: I tagged the previous version of V_call.c with "pre-curses-fix",
-in case anyone needs the original breakage (to match a broken
-terminfo).
-
-Glynn Clements <glynn.clements@virgin.net>
-

+ 0 - 50
lib/vask/V_acc.c

@@ -1,50 +0,0 @@
-
-/**
- * \file V_acc.c
- *
- * \brief Decimal precision functions.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * \author GRASS GIS Development Team
- *
- * \date 1999-2006
- */
-
-#include <grass/vask.h>
-
-
-/**
- * \brief Set number of decimal places.
- * 
- * <i>V_float_accuracy()</i> defines the number of decimal places in 
- * which floats and doubles are displayed or accepted. <b>Num</b> is an 
- * integer value defining the number of decimal places to be used. This 
- * routine affects subsequent calls to <i>V_const()</i> and 
- * <i>V_ques()</i>. Various inputs or displayed constants can be
- * represented with different numbers of decimal places within the same 
- * screen display by making different calls to <i>V_float_accuracy()</i> 
- * before calls to <i>V_ques()</i> or <i>V_const()</i>. <i>V_clear()</i> 
- * resets the number of decimal places to the default (which is 
- * unlimited).
- *
- *  \param[in] n
- *  \return always returns 0
- */
-
-void V_float_accuracy(int n)
-{
-    V__.decimal_places = n;
-}

+ 0 - 507
lib/vask/V_call.c

@@ -1,507 +0,0 @@
-
-/**
- * \file V_call.c
- *
- * \brief Interactive call functions.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * \note Modified by Jacques Bouchard and Markus Neteler 6/99 to make 
- * cursor keys working. Exit now with ESC-CR.
- *
- * \author GRASS GIS Development Team
- *
- * \date 2007-11-01
- */
-
-/*
-   ALGORITHM:  
-   |   Zero out screen answer locations
-   |   Initial curses screens
-   |   Display text, constants, and answer fields
-   |       Write text      (results from V_line() calls)  to curses window
-   |       Write constants (results from V_const() calls) to curses window
-   |       Write answers   (results from V_ques() calls)  to curses window
-   |   Take commands from the keyboard
-   |       switch on commands:
-   |           case CR: case NL: case UP: case ESC:
-   |               switch on answer type
-   |                   case string
-   |                       remove trailing non-alphanumeric characters
-   |                       copy answer to target denoted in V_ques() call
-   |                       blank out screen line
-   |                       copy target to curses window
-   |                   case integer
-   |                       run atoi on answer, putting results in target 
-   |                           denoted in V_ques() call
-   |                       blank out screen line
-   |                       printf target to curses window
-   |                   case long
-   |                       run atol on answer, putting results in target 
-   |                           denoted in V_ques() call
-   |                       blank out screen line
-   |                       printf target to curses window
-   |                   case float, double
-   |                       run sscanf on answer, putting results in target 
-   |                           denoted in V_ques() call
-   |                       blank out screen line
-   |                       printf target to curses window
-   |                   default:
-   |                       do nothing
-   |               if ESC+CR return from V_call()
-   |               if UP  shift to previous question
-   |               if CR or NL  shift to next question
-   |           case BS:   Move cursor back one column in current question
-   |           case FS:   Move cursor forward one column in current 
-   |               question
-   |           case RPLT: Replot the current screen image
-   |           case DUMP: Dump (append) the current window to the user's 
-   |               home dir.
-   |           default:   If an alphanumeric, put that char on the screen 
-   |               and in the current answer field
-   |   call V_exit  (erase screen and exit curses)
-   ********************************************************************** */
-
-#include <grass/config.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <grass/vask.h>
-
-
-static void centered(const char *);
-static void fmt(char *, int, double);
-
-/* define the V__ struct defined in vask.h */
-struct V__ V__;
-
-#define DUMP	001
-#define BS	010
-#define FS	014
-#define NL	012
-#define UP	013
-#define CR	015
-#define RPLT	022
-#define ESC	033
-#define CTRLC	003
-
-#define TARGET	V__.usr_answ[at_answer].targetptr
-#define ROW	V__.usr_answ[at_answer].row
-#define COL	V__.usr_answ[at_answer].col
-#define LENGTH	V__.usr_answ[at_answer].length
-#define TYPE	V__.usr_answ[at_answer].var_type
-#define ANSWER	scr_answ[at_answer].position
-#define RELINE	do {                                           \
-			move(ROW, COL) ;                       \
-			for (incr2=0;incr2<LENGTH; incr2++)    \
-				addch('_')  ;                  \
-			move(ROW, COL) ;                       \
-		} while (0)
-
-/* flag ctrl-c is to be allowed */
-
-static int interrupts_ok = 0;	/* mod shapiro */
-
-
-/**
- * \fn int V_call (void)
- *
- * \brief Interact with the user.
- *
- * Interactively allow the user to enter answers into all available 
- * fields (as previously defined). Answer fields have been created with 
- * calls to <i>V_ques()</i>. Information fields have been created using 
- * <i>V_const()</i>. General text has been created with calls to 
- * <i>V_line()</i>.
- *
- * <i>V_call()</i> clears the screen and writes the text and data values 
- * specified by <i>V_line()</i>, <i>V_ques()</i> and <i>V_const()</i> to 
- * the screen. It interfaces with the user, collecting user responses in 
- * the <i>V_ques()</i> fields until the user is satisfied. A message is
- * automatically supplied on line number 23, explaining to the user to 
- * enter an ESC when all inputs have been supplied as desired. 
- * <i>V_call()</i> ends when the user hits ESC and returns a value of 1 
- * (but see <i>V_intrpt_ok()</i> below). No error checking is done by 
- * <i>V_call()</i>. Instead, all variables used in <i>V_ques()</i>
- * calls must be checked upon return from <i>V_call()</i>. If the user 
- * has supplied inappropriate information, the user can be informed, and 
- * the input prompted for again by further calls to <i>V_call()</i>.
- *
- * \return 1 user entered ESC to continue
- * \return 0 user entered CTRL-C to cancel
- * \return -1 no match
- */
-
-int V_call(void)
-{
-    int incr;
-    int incr2;
-    int num_answers;
-    int at_answer;
-    int at_constant;
-    int ans_col = 0;
-    int newchar;
-    int lastchar = 0;
-    int new_answer = 0;
-    struct
-    {
-	char position[80];
-    } scr_answ[MAX_ANSW];
-    int y, x;			/* shapiro */
-    char temp[100];
-    int done;
-
-    /* Zero out screen answer locations */
-    for (incr = 0; incr < MAX_ANSW; incr++)
-	for (incr2 = 0; incr2 < 80; incr2++)
-	    scr_answ[incr].position[incr2] = 000;
-
-    /* Initialize the curses windows */
-    V_init();
-
-    /* Display text              */
-    for (incr = 0; incr < MAX_LINE; incr++) {
-	move(incr, 0);
-	addstr(V__.page.line[incr]);
-    }
-
-    /* Display constants   */
-    for (at_constant = 0; at_constant < V__.NUM_CONST; at_constant++) {
-	move(V__.constant[at_constant].row, V__.constant[at_constant].col);
-	switch (V__.constant[at_constant].var_type) {
-	case 's':
-	    addstr(V__.constant[at_constant].targetptr.c);
-	    break;
-	case 'i':
-	    sprintf(temp, "%d", *V__.constant[at_constant].targetptr.i);
-	    addstr(temp);
-	    break;
-	case 'l':
-	    sprintf(temp, "%ld", *V__.constant[at_constant].targetptr.l);
-	    addstr(temp);
-	    break;
-	case 'f':
-	    fmt(temp, V__.constant[at_constant].decimal_places,
-		(double)*V__.constant[at_constant].targetptr.f);
-	    addstr(temp);
-	    break;
-	case 'd':
-	    fmt(temp, V__.constant[at_constant].decimal_places,
-		(double)*V__.constant[at_constant].targetptr.d);
-	    addstr(temp);
-	    break;
-	default:
-	    break;
-	}
-    }
-
-    /* Display answer locations  */
-    for (at_answer = 0; at_answer < V__.NUM_ANSW; at_answer++) {
-	/* clear ANSWER */
-	for (incr = 0; incr < 80; incr++)
-	    scr_answ[at_answer].position[incr] = 000;
-
-	switch (TYPE) {
-	case 's':
-	    strcpy(ANSWER, TARGET.c);
-	    RELINE;
-	    for (incr = 0; incr < LENGTH; incr++) {
-		if (*(TARGET.c + incr) == '\000')
-		    while (incr++ < LENGTH)
-			addch('_');
-		else
-		    addch(*(TARGET.c + incr));
-	    }
-	    break;
-	case 'i':
-	    sprintf(ANSWER, "%d", *TARGET.i);
-	    RELINE;
-	    addstr(ANSWER);
-	    break;
-	case 'l':
-	    sprintf(ANSWER, "%ld", *TARGET.l);
-	    RELINE;
-	    addstr(ANSWER);
-	    break;
-	case 'f':
-	    fmt(ANSWER, V__.usr_answ[at_answer].decimal_places,
-		(double)*TARGET.f);
-	    RELINE;
-	    addstr(ANSWER);
-	    break;
-	case 'd':
-	    fmt(ANSWER, V__.usr_answ[at_answer].decimal_places,
-		(double)*TARGET.d);
-	    RELINE;
-	    addstr(ANSWER);
-	    break;
-	default:
-	    break;
-	}
-    }
-    num_answers = at_answer;
-
-    if (interrupts_ok)
-	move(22, 0);
-    else
-	move(23, 0);
-
-    centered("AFTER COMPLETING ALL ANSWERS, HIT <ESC><ENTER> TO CONTINUE");
-    if (interrupts_ok) {
-	sprintf(temp, "(OR <Ctrl-C> TO %s)", V__.interrupt_msg);
-	centered(temp);
-    }
-
-    /* Begin taking commands/answers from terminal */
-    at_answer = 0;
-
-    move(ROW, COL);
-    refresh();
-
-    for (done = 0; !done;) {
-	getyx(stdscr, y, x);
-
-	newchar = getch();
-
-	switch (newchar) {
-	case ERR:
-	    break;
-
-	case ESC:
-	    if (V__.NUM_ANSW <= 0)
-		done = 1;
-	    break;
-
-	case CTRLC:
-	    if (interrupts_ok || V__.NUM_ANSW <= 0)
-		done = 1;
-	    break;
-
-#ifdef KEY_UP
-	case KEY_UP:
-#endif
-	case UP:
-	    new_answer = (at_answer + num_answers - 1) % num_answers;
-	    ans_col = 0;
-	    break;
-
-#ifdef KEY_DOWN
-	case KEY_DOWN:
-#endif
-	case CR:
-	case NL:
-	    new_answer = (at_answer + 1) % num_answers;
-	    ans_col = 0;
-	    if (lastchar == ESC && (newchar == CR || newchar == NL))
-		done = 1;
-	    break;
-
-#ifdef KEY_LEFT
-	case KEY_LEFT:
-	    ans_col = (ans_col - 1 >= 0) ? ans_col - 1 : 0;
-	    break;
-#endif
-
-#ifdef KEY_BACKSPACE
-	case KEY_BACKSPACE:
-#endif
-	case BS:
-	    ans_col = (ans_col - 1 >= 0) ? ans_col - 1 : 0;
-	    ANSWER[ans_col] = ' ';
-	    move(ROW, COL + ans_col);
-	    addch(' ');
-	    break;
-
-#ifdef KEY_RIGHT
-	case KEY_RIGHT:
-#endif
-	case FS:
-	    ans_col = (ans_col + 1 < LENGTH &&
-		       ANSWER[ans_col]) ? ans_col + 1 : ans_col;
-	    break;
-
-#ifdef KEY_HOME
-	case KEY_HOME:
-	    ans_col = 0;
-	    break;
-#endif
-
-#ifdef KEY_END
-	case KEY_END:
-	    for (ans_col = 0; ans_col < LENGTH && ANSWER[ans_col];
-		 ans_col++) ;
-	    break;
-#endif
-
-#ifdef KEY_REFRESH
-	case KEY_REFRESH:
-#endif
-	case RPLT:
-	    wrefresh(curscr);
-	    break;
-
-#ifdef KEY_PRINT
-	case KEY_PRINT:
-#endif
-	case DUMP:
-	    V__dump_window();
-	    break;
-
-	case '\177':
-	    break;
-
-	default:
-	    if (ans_col < LENGTH && newchar >= 040 && newchar <= 0377) {
-		addch(newchar);
-		ANSWER[ans_col] = newchar;
-		ans_col++;
-	    }
-	    break;
-	}
-
-	if (new_answer != at_answer || done) {
-	    V__remove_trail(LENGTH, ANSWER);
-	    switch (TYPE) {
-	    case 's':
-		strcpy(TARGET.c, ANSWER);
-		RELINE;
-		addstr(TARGET.c);
-		break;
-	    case 'i':
-		*TARGET.i = atoi(ANSWER);
-		RELINE;
-		sprintf(temp, "%d", *TARGET.i);
-		addstr(temp);
-		break;
-	    case 'l':
-		*TARGET.l = atol(ANSWER);
-		RELINE;
-		sprintf(temp, "%ld", *TARGET.l);
-		addstr(temp);
-		break;
-	    case 'f':
-		sscanf(ANSWER, "%f", TARGET.f);
-		RELINE;
-		fmt(ANSWER, V__.usr_answ[at_answer].decimal_places,
-		    (double)*TARGET.f);
-		sscanf(ANSWER, "%f", TARGET.f);
-		addstr(ANSWER);
-		break;
-	    case 'd':
-		sscanf(ANSWER, "%lf", TARGET.d);
-		RELINE;
-		fmt(ANSWER, V__.usr_answ[at_answer].decimal_places,
-		    (double)*TARGET.d);
-		sscanf(ANSWER, "%lf", TARGET.d);
-		addstr(ANSWER);
-		break;
-	    default:
-		break;
-	    }
-
-	    at_answer = new_answer;
-	}
-
-	lastchar = newchar;
-	move(ROW, COL + ans_col);
-	refresh();
-
-	if (done) {
-	    interrupts_ok = 0;
-	    V_exit();
-	    return (newchar != CTRLC);
-	}
-    }
-
-    return -1;
-}
-
-
-/**
- * \fn int V_intrpt_ok (void)
- *
- * \brief Allow CTRL-C.
- *
- * <i>V_call()</i> normally only allows the ESC character to end the 
- * interactive input session. Sometimes, it is desirable to allow the 
- * user to cancel the session. To provide this alternate means of exit, 
- * the programmer can call <i>V_intrpt_ok()</i> before <i>V_call()</i>. 
- * This allows the user to enter CTRL-C, which causes <i>V_call()</i> to 
- * return a value of 0 instead of 1.<br>
- * A message is automatically supplied to the user on line 23 saying to 
- * use CTRL-C to cancel the input session. The normal message 
- * accompanying <i>V_call()</i> is moved up to line 22.<br>
- * <b>Note:</b> When <i>V_intrpt_ok()</i> is called, the programmer must 
- * limit the use of <i>V_line()</i>, <i>V_ques()</i>, and 
- * <i>V_const()</i> to lines 0-21.
- *
- * \return always returns 0
- */
-
-void V_intrpt_ok(void)
-{
-    interrupts_ok = 1;		/* will be set false when V_call() exists */
-}
-
-
-/**
- * \fn int V_intrpt_msg (const char *msg)
- *
- * \brief Change CTRL-C message.
- *
- * A call to <i>V_intrpt_msg()</i> changes the default 
- * <i>V_intrpt_ok()</i> message from (OR <CTRL-C> TO CANCEL) to (OR 
- * <CTRL-C> TO <i>msg</i>). The message is (re)set to the default by 
- * <i>V_clear()</i>.
- *
- * \param[in] msg
- * \return always returns 0
- */
-
-void V_intrpt_msg(const char *msg)
-{
-    strcpy(V__.interrupt_msg, msg);
-}
-
-
-static void fmt(char *s, int n, double x)
-{
-    char buf[20];
-
-    if (n >= 0)
-	sprintf(buf, "%%.%dlf", n);
-    else
-	strcpy(buf, "%.5lf");
-
-    /* I had to use .5lf instead of just lf since a number like 65.8 got 
-     * sprintf'ed as 65.800003 this is a hack - I admit it.
-     */
-    sprintf(s, buf, x);
-    if (n < 0)
-	V__trim_decimal(s);
-}
-
-
-static void centered(const char *msg)
-{
-    int indent;
-
-    indent = (80 - strlen(msg)) / 2;
-    while (indent-- > 0)
-	addstr(" ");
-
-    addstr(msg);
-    addstr("\n");
-}

+ 0 - 61
lib/vask/V_clear.c

@@ -1,61 +0,0 @@
-
-/**
- * \file V_clear.c
- *
- * \brief Screen clearning functions.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * \author GRASS GIS Development Team
- *
- * \date 1999-2006
- */
-
-#include <stdio.h>
-#include <grass/vask.h>
-
-
-#define DECIMAL_PLACES -1
-
-
-/*!
- * \brief Zero out prompt and answer arrays.
- *
- * This routine initializes the screen description information and must 
- * be called before each new screen layout description.
- *
- *  \return always returns 0
- */
-
-void V_clear(void)
-{
-    static const char text[] = "";
-    int at_answer;
-
-    for (at_answer = 0; at_answer < MAX_ANSW; at_answer++)
-	V__.usr_answ[at_answer].length = 0;
-
-    for (at_answer = 0; at_answer < MAX_CONST; at_answer++)
-	V__.constant[at_answer].length = 0;
-
-    for (at_answer = 0; at_answer < MAX_LINE; at_answer++)
-	V__.page.line[at_answer] = text;
-
-    V__.NUM_CONST = 0;
-    V__.NUM_ANSW = 0;
-    V__.NUM_LINE = 0;
-    V_float_accuracy(DECIMAL_PLACES);
-    sprintf(V__.interrupt_msg, "CANCEL");
-}

+ 0 - 88
lib/vask/V_const.c

@@ -1,88 +0,0 @@
-
-/**
- * \file V_const.c
- *
- * \brief Display constant functions.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * \author GRASS GIS Development Team
- *
- * \date 1999-2006
- */
-
-#include <stdio.h>
-#include <grass/vask.h>
-
-
-/**
- * \fn int V_const (void *src, char var_type, int row, int col, int length)
- *
- * \brief Define screen constant.
- *
- * This routine allows a program to identify a constant, and where that 
- * constant should be placed on the screen in the next call to 
- * <i>V_call()</i>. <b>var_type</b> is one of <i>int</i>, <i>long</i>, 
- * <i>float</i>, <i>double</i>, or <i>char</i>.
- *
- * \param[in] src
- * \param[in] var_type
- * \param[in] row
- * \param[in] col
- * \param[in] len
- * \return 0 on success
- * \return -1 on error
- */
-
-int V_const(void *src, int var_type, int row, int col, int length)
-{
-    union target targetptr;
-
-    targetptr.i = src;
-
-    if (V__.NUM_CONST >= MAX_CONST) {
-	V_error("Too many constants in call to V_const");
-	return (-1);
-    }
-    if ((row < 0) || (row >= MAX_LINE)) {
-	V_error("Illegal row (%d) in call to V_const", row);
-	return (-1);
-    }
-    if ((col < 0) || (col > 80)) {
-	V_error("Illegal column (%d) in call to V_const", col);
-	return (-1);
-    }
-    if ((length < 0) || ((length + col) > 80)) {
-	V_error("Length out of bounds in call to V_const");
-	return (-1);
-    }
-
-    if ((var_type == 's') || (var_type == 'i') || (var_type == 'f')
-	|| (var_type == 'l') || (var_type == 'd')) {
-	V__.constant[V__.NUM_CONST].targetptr = targetptr;
-	V__.constant[V__.NUM_CONST].var_type = var_type;
-	V__.constant[V__.NUM_CONST].row = row;
-	V__.constant[V__.NUM_CONST].col = col;
-	V__.constant[V__.NUM_CONST].length = length;
-	V__.constant[V__.NUM_CONST].decimal_places = V__.decimal_places;
-
-	V__.NUM_CONST++;
-	return (0);
-    }
-    else {
-	V_error("Illegal variable type in call to V_const");
-	return (-1);
-    }
-}

+ 0 - 52
lib/vask/V_error.c

@@ -1,52 +0,0 @@
-
-/**
- * \file V_error.c
- *
- * \brief Display error functions.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * \author GRASS GIS Development Team
- *
- * \date 1999-2006
- */
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <grass/gis.h>
-#include <grass/vask.h>
-
-/**
- * \fn int V_error (char *message)
- *
- * \brief Dispay error routine.
- *
- * Deals with error messages generated by other Visual ask routines.
- *
- * \param[in] message
- * \return always returns 0
- */
-
-void V_error(const char *fmt, ...)
-{
-    va_list ap;
-
-    va_start(ap, fmt);
-    fprintf(stderr, "V_ask error: ");
-    vfprintf(stderr, fmt, ap);
-    va_end(ap);
-
-    G_sleep(4);
-}

+ 0 - 67
lib/vask/V_exit.c

@@ -1,67 +0,0 @@
-
-/**
- * \file V_exit.c
- *
- * \brief Interactive exit functions.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * \author GRASS GIS Development Team
- *
- * \date 1999-2006
- */
-
-#include <grass/config.h>
-#include <stdio.h>
-#include <grass/vask.h>
-
-
-/**
- * \fn int V_exit ()
- *
- * \brief Erases the current screen and flushes the current curses setup.
- *
- * \return always returns 0
- */
-
-void V_exit(void)
-{
-#ifdef HAVE_KEYPAD
-    keypad(stdscr, 0);
-#endif
-    clear();
-    refresh();
-
-    /* added for Mips' braindead implementation of curses 
-     * and the ordering is important
-     */
-    echo();
-    nl();
-    noraw();
-
-    endwin();
-    fflush(stdout);
-    fflush(stderr);
-    fflush(stdin);
-
-    /* Added 17 Sep 1990  dpg.  is a hack we have been using on Sys V 
-     * machines it is not the correct way, but it seems to do the job.
-     * Fixes the problem with prompts not being displayed after 
-     * exitting curses. */
-#ifdef SYSV
-    setvbuf(stderr, NULL, _IONBF, 0);
-    setvbuf(stdout, NULL, _IONBF, 0);
-#endif
-}

+ 0 - 64
lib/vask/V_init.c

@@ -1,64 +0,0 @@
-
-/**
- * \file V_init.c
- *
- * \brief Interactive initialization functions.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * \author GRASS GIS Development Team
- *
- * \date 1999-2006
- */
-
-#include <grass/config.h>
-#include <stdlib.h>
-#include <grass/gis.h>
-#include <grass/vask.h>
-
-
-/**
- * \fn int V_init ()
- *
- * \brief Initialize curses and prepare screen.
- *
- * \return always returns 0
- */
-
-void V_init(void)
-{
-    static int first = 1;
-
-    G_clear_screen();		/* this is a kludge - xterm has problems
-				 * it shows what was on the screen after
-				 * endwin is called in V_exit()
-				 */
-    if (first) {
-	initscr();		/* initialize curses and tty */
-	first = 0;
-    }
-
-    /* the order of these 3 calls is important for
-     * Mips' braindead implementation of curses  */
-    noecho();
-    nonl();
-    raw();
-
-    clear();
-    refresh();
-#ifdef HAVE_KEYPAD
-    keypad(stdscr, 1);
-#endif
-}

+ 0 - 57
lib/vask/V_line.c

@@ -1,57 +0,0 @@
-
-/**
- * \file V_line.c
- *
- * \brief Display line functions.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * \author GRASS GIS Development Team
- *
- * \date 1999-2006
- */
-
-#include <grass/vask.h>
-
-
-/**
- * \fn int V_line (int linenumber, char *text)
- * 
- * \brief Add line of text to screen for next call to <i>V_call()</i>.
- *
- * This routine is used to place lines of text on the screen. 
- * <b>linenumber</b> is an integer value of 0-22 specifying the row on 
- * the screen where the <b>text</b> is placed. The top row on the screen 
- * is row 0.<br>
- * <b>Warning:</b> <i>V_line()</i> does not copy the text to the screen 
- * description. It only saves the text address. This implies that each 
- * call to <i>V_line()</i> must use a different text buffer.
- *
- * \param[in] linenumber
- * \param[in] text
- * \return 0 on success
- * \return -1 on error
- */
-
-int V_line(int linenumber, const char *text)
-{
-    if (linenumber >= MAX_LINE || linenumber < 0) {
-	V_error("Linenumber out of bounds in call to V_line");
-	return (-1);
-    }
-    V__.page.line[linenumber] = text;
-
-    return 0;
-}

+ 0 - 119
lib/vask/V_ques.c

@@ -1,119 +0,0 @@
-
-/**
- * \file V_ques.c
- *
- * \brief Display question functions.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * \author GRASS GIS Development Team
- *
- * \date 1999-2006
- */
-
-#include <grass/vask.h>
-
-
-/**
- * \fn int V_ques (void *src, char var_type, int row, int col, int length)
- *
- * \brief Define screen question.
- *
- * <i>V_ques()</i> allows a program to identify a prompt field and where 
- * that field should be placed on the screen in the next call to 
- * <i>V_call()</i>.<br>
- * <i>V_ques()</i> specifies that the contents of memory at the address 
- * of <b>src</b> are to be displayed on the screen at location 
- * <b>row</b>, <b>col</b> for <b>len</b> characters.<br>
- * <i>V_ques()</i> further specifies that this screen location is a 
- * prompt field. The user will be allowed to change the field on the 
- * screen and thus change the <b>src</b> itself.
- * <b>var_type</b> specifies what type <b>src</b> points to: 'i' (int), 
- * 'l' (long), 'f' (float), 'd' (double), or 's' (character string).<br>
- * <b>row</b> is an integer value of 0-22 specifying the row on the 
- * screen where the value is placed. The top row on the screen is row 
- * 0.<br>
- * <b>col</b> is an integer value of 0-79 specifying the column on the 
- * screen where the value is placed. The leftmost column on the screen 
- * is column 0.<br>
- * <b>len</b> specifies the number of columns that the value will 
- * use.<br>
- * <b>Note:</b> The size of a character array passed to <i>V_ques()</i>
- * must be at least one byte longer than the length of the prompt field 
- * to allow for NULL termination. Currently, you are limited to 20 
- * constants and 80 variables.<br>
- * <b>Warning:</b> These routines store the address of <b>src</b> and 
- * not the value itself. This implies that different variables must be 
- * used for different calls. Programmers will instinctively use 
- * different variables with <i>V_ques()</i>, but it is a stumbling block 
- * for <i>V_const()</i>. Also, the programmer must initialize 
- * <b>src</b> prior to calling these routines.
- *
- * \remarks {Technically <b>src</b> needs to be initialized before
- * the call to <i>V_call()</i> since <i>V_const()</i> and 
- * <i>V_ques()</i> only store the address of <b>src</b>. 
- * <i>V_call()</i> looks up the values and places them on the screen.}
- *
- * \param[in] src
- * \param[in] var_type
- * \param[in] row
- * \param[in] col
- * \param[in] len
- * \return 0 on success
- * \return -1 on error
- */
-
-int V_ques(void *src, int var_type, int row, int col, int length)
-{
-    union target targetptr;
-
-    targetptr.i = src;
-
-    if (V__.NUM_ANSW >= MAX_ANSW) {
-	V_error("Too many questions in call to V_ques");
-	return (-1);
-    }
-    if ((row < 0) || (row >= MAX_LINE)) {
-	V_error("Illegal row (%d) in call to V_ques", row);
-	return (-1);
-    }
-    if ((col < 0) || (col >= 80)) {
-	V_error("Illegal column (%d) in call to V_ques", col);
-	return (-1);
-    }
-    if (length <= 0) {
-	V_error("Negative length in call to V_ques");
-	return (-1);
-    }
-    if (length + col > 80)
-	length = 80 - col;
-
-    if ((var_type == 's') || (var_type == 'i') || (var_type == 'f')
-	|| (var_type == 'l') || (var_type == 'd')) {
-	V__.usr_answ[V__.NUM_ANSW].targetptr = targetptr;
-	V__.usr_answ[V__.NUM_ANSW].var_type = var_type;
-	V__.usr_answ[V__.NUM_ANSW].row = row;
-	V__.usr_answ[V__.NUM_ANSW].col = col;
-	V__.usr_answ[V__.NUM_ANSW].length = length;
-	V__.usr_answ[V__.NUM_ANSW].decimal_places = V__.decimal_places;
-
-	V__.NUM_ANSW++;
-	return (0);
-    }
-    else {
-	V_error("Illegal variable type in call to V_ques");
-	return (-1);
-    }
-}

+ 0 - 110
lib/vask/V_support.c

@@ -1,110 +0,0 @@
-
-/**
- * \file V_support.c
- *
- * \brief Interactive support functions.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * \author GRASS GIS Development Team
- *
- * \date 1999-2006
- */
-
-#include <grass/config.h>
-#include <stdio.h>
-#ifndef __MINGW32__
-#include <pwd.h>
-#endif
-#include <unistd.h>
-#include <sys/types.h>
-#include <curses.h>
-#include <grass/gis.h>
-#include <grass/vask.h>
-#include <grass/glocale.h>
-
-
-/**
- * \fn int V__dump_window ()
- *
- * \brief Dumps screen to file.
- *
- * \return 0 on success
- * \return -1 on error
- */
-
-int V__dump_window(void)
-{
-    int atrow, atcol;
-    FILE *file;
-    char home[GPATH_MAX];
-    int curx, cury;
-
-    sprintf(home, "%s/visual_ask", G_home());
-
-    if ((file = fopen(home, "a")) == NULL) {
-	V_error(_("Unable to open file %s"), home);
-	return (-1);
-    }
-
-    getyx(stdscr, cury, curx);
-
-    fprintf(file,
-	    "--------------------------------------------------------\n");
-    for (atrow = 0; atrow < LINES; atrow++) {
-	for (atcol = 0; atcol < COLS - 1; atcol++) {
-	    move(atrow, atcol);
-	    fprintf(file, "%c", (int)(inch() & A_CHARTEXT));
-	}
-	fprintf(file, "\n");
-    }
-    fprintf(file,
-	    "--------------------------------------------------------\n");
-    fprintf(file, "\n\n");
-    fclose(file);
-
-    move(cury, curx);
-    return 0;
-}
-
-
-/**
- * \fn int V__remove_trail (int ans_col, char *answer)
- *
- * \brief Remove trailing text from <b>answer</b>?
- *
- * \param[in] ans_col
- * \param[in] answer
- * \return always returns 0;
- */
-
-void V__remove_trail(int ans_col, char *answer)
-{
-    char *ans_ptr;
-
-    ans_ptr = answer + ans_col;
-    while (ans_col >= 0) {
-	int c = *(unsigned char *)ans_ptr;
-
-	if (c > '\040' && c != '\177' && c != '_')
-	    return;
-
-	*ans_ptr = '\0';
-	ans_col--;
-	ans_ptr--;
-    }
-
-    return;
-}

+ 0 - 56
lib/vask/V_trim_dec.c

@@ -1,56 +0,0 @@
-
-/**
- * \file V_trim_dec.c
- *
- * \brief Display trim functions.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * \author GRASS GIS Development Team
- *
- * \date 1999-2006
- */
-
-#include <grass/vask.h>
-
-
-/**
- * \fn int V__trim_decimal (char *buf)
- *
- * \brief Remove trailing zeros from decimal number.
- *
- * For example: 23.45000 would return 23.45.
- *
- * \param[in,out] buf
- * \return always returns 0
- */
-
-void V__trim_decimal(char *buf)
-{
-    char *mark;
-
-    /* find the . */
-    while (*buf != '.')
-	if (*buf++ == '\0')
-	    return;
-
-    mark = buf;
-    while (*++buf)
-	if (*buf != '0')
-	    mark = buf + 1;
-
-    while (*mark)
-	*mark++ = 0;
-}

+ 0 - 58
raster/r.coin/check.c

@@ -1,58 +0,0 @@
-
-/****************************************************************************
- *
- * MODULE:       r.coin
- *
- * AUTHOR(S):    Michael O'Shea - CERL
- *               Michael Shapiro - CERL
- *
- * PURPOSE:      Calculates the coincidence of two raster map layers.
- *
- * COPYRIGHT:    (C) 2006 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.
- *
- ***************************************************************************/
-
-#include <stdlib.h>
-#include "coin.h"
-
-
-/* computes the approximate number of lines/pages an 80 column
- * report would take, and asks the user if this is ok
- */
-int check_report_size(void)
-{
-    long nlines;
-    long npages;
-    long npanels;
-    char buf[100];
-
-
-    npanels = ncat1 / 3;
-    if (ncat1 % 3)
-	npanels++;
-
-    nlines = (12 + ncat2) * npanels + 11 + ncat2;
-    npages = (nlines + 65) / 66;
-
-    while (1) {
-	fprintf(stdout, "\nThe coincidence table is %d rows by %d columns\n",
-		ncat2, ncat1);
-	fprintf(stdout,
-		"The report will require approximately %ld lines (%ld pages)\n",
-		nlines, npages);
-	fprintf(stdout, "Do you want to continue? ");
-	while (1) {
-	    fprintf(stdout, "(y/n) ");
-	    if (!G_gets(buf))
-		break;
-	    if (*buf == 'y' || *buf == 'Y')
-		return 1;
-	    if (*buf == 'n' || *buf == 'N')
-		exit(0);
-	}
-    }
-}

+ 0 - 156
raster/r.coin/inter.c

@@ -1,156 +0,0 @@
-
-/****************************************************************************
- *
- * MODULE:       r.coin
- *
- * AUTHOR(S):    Michael O'Shea - CERL
- *               Michael Shapiro - CERL
- *
- * PURPOSE:      Calculates the coincidence of two raster map layers.
- *
- * COPYRIGHT:    (C) 2006 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.
- *
- ***************************************************************************/
-
-#include <stdlib.h>
-#include "coin.h"
-#include <grass/spawn.h>
-#include <grass/glocale.h>
-
-
-int interactive_version(void)
-{
-    int cols;
-    char key;
-    char line[128], outname[GNAME_MAX], command[1024];
-    char ans[80];
-
-    setbuf(stderr, NULL);
-
-    G_clear_screen();
-    G_message(_("GIS Coincidence Tabulation Facility\n"));
-    G_message(_("This utility will allow you to compare the "
-		"coincidence of two map layers\n"));
-
-    mapset1 = G_ask_cell_old("Enter Name of Map Layer 1", map1name);
-    if (!mapset1)
-	G_fatal_error(_("Raster map <%s> not found"), map1name);
-
-    mapset2 = G_ask_cell_old("Enter Name of Map Layer 2", map2name);
-    if (!mapset2)
-	G_fatal_error(_("Raster map <%s> not found"), map2name);
-
-    make_coin();
-    check_report_size();
-
-
-    while (1) {
-	G_clear_screen();
-	G_message(_("The report can be made in one of 8 units."));
-	G_message(_("Please choose a unit by entering one of the "
-		    "following letter codes:"));
-	G_message(_("     'c': cells"));
-	G_message(_("     'p': percent cover of region"));
-	G_message(_("     'x': percent of '%s' category (column)"), map1name);
-	G_message(_("     'y': percent of '%s' category (row)"), map2name);
-	G_message(_("     'a': acres"));
-	G_message(_("     'h': hectares"));
-	G_message(_("     'k': square kilometers"));
-	G_message(_("     'm': square miles\n"));
-	G_message(_("     'Q': quit"));
-	fprintf(stderr, "> ");
-
-	*ans = 0;
-	if (!G_gets(ans))
-	    continue;
-	if (sscanf(ans, "%c", &key) != 1)
-	    continue;
-
-	switch (key) {
-	case 'c':
-	case 'p':
-	case 'x':
-	case 'y':
-	case 'a':
-	case 'h':
-	case 'k':
-	case 'm':
-	    print_coin(key, 80, 1);
-	    break;
-	case 'Q':
-	    exit(0);
-	default:
-	    continue;
-	}
-
-	sprintf(command, "%s \"%s\"", getenv("GRASS_PAGER"),
-		G_convert_dirseps_to_host(dumpname));
-	G_system(command);
-
-	while (1) {
-	    fprintf(stderr,
-		    _
-		    ("Do you wish to save this report in a file? (y/n) [n] "));
-	    *ans = 0;
-	    if (!G_gets(ans))
-		continue;
-	    G_strip(ans);
-	    if (ans[0] != 'y' && ans[0] != 'Y')
-		break;
-
-	    fprintf(stderr, _("Enter the file name or path\n> "));
-	    if (!G_gets(line))
-		continue;
-	    if (sscanf(line, "%s", outname) != 1)
-		continue;
-	    fprintf(stderr, _("'%s' being saved\n"), outname);
-	    if (G_copy_file(dumpname, outname))
-		/* Break out if file copy was successful otherwise try again */
-		break;
-	}
-
-	while (1) {
-	    *ans = 0;
-	    fprintf(stderr,
-		    _
-		    ("Do you wish to print this report (requires Unix lpr command)? (y/n) [n] "));
-	    if (!G_gets(ans))
-		continue;
-	    G_strip(ans);
-	    if (ans[0] != 'y' && ans[0] != 'Y')
-		break;
-
-	  ask132:
-	    fprintf(stderr,
-		    _("Do you wish it printed in 80 or 132 columns?\n> "));
-	    *ans = 0;
-	    if (!G_gets(ans))
-		continue;
-	    G_strip(ans);
-	    if (sscanf(ans, "%d", &cols) != 1)
-		goto ask132;
-	    if (cols == 132)
-		print_coin(key, 132, 1);
-	    else if (cols != 80)
-		goto ask132;
-	    G_spawn("lpr", "lpr", dumpname, NULL);
-	    break;
-	}
-
-	do {
-	    fprintf(stderr, _("Do you wish to run this report with a "
-			      "different unit of measure? (y/n) [y] "));
-	    *ans = 0;
-	}
-	while (!G_gets(ans));
-	G_strip(ans);
-	if (*ans == 'n' || *ans == 'N')
-	    break;
-    }
-
-    return 0;
-}

+ 1 - 4
raster/r.coin/main.c

@@ -52,10 +52,7 @@ int main(int argc, char *argv[])
     window_cells = G_window_rows() * G_window_cols();
 
 
-    if (argc > 1)
-	command_version(argc, argv);
-    else
-	interactive_version();
+    command_version(argc, argv);
 
     unlink(dumpname);
     unlink(statname);

+ 2 - 2
raster/r.le/r.le.setup/Makefile

@@ -2,8 +2,8 @@ MODULE_TOPDIR = ../../..
 
 PGM = r.le.setup
 
-LIBES = $(DISPLAYLIB) $(RASTERLIB) $(SITESLIB) $(VECTLIB) $(GISLIB) $(DATETIMELIB) $(VASKLIB) $(CURSES)
-DEPENDENCIES = $(RASTERDEP) $(DISPLAYDEP) $(SITESDEP) $(VECTDEP) $(GISDEP) $(DATETIMEDEP) $(VASKDEP)
+LIBES = $(DISPLAYLIB) $(RASTERLIB) $(SITESLIB) $(VECTLIB) $(GISLIB) $(DATETIMELIB)
+DEPENDENCIES = $(RASTERDEP) $(DISPLAYDEP) $(SITESDEP) $(VECTDEP) $(GISDEP) $(DATETIMEDEP)
 EXTRA_INC = $(VECT_INC)
 EXTRA_CFLAGS = $(VECT_CFLAGS)
 CLEAN_SUBDIRS = polytocell

+ 1 - 0
raster3d/r3.mkdspf/main.c

@@ -89,6 +89,7 @@ int main(int argc, char *argv[])
     out->key = "dspf";
     out->type = TYPE_STRING;
     out->required = YES;
+    out->gisprompt = "new_file,file,output";
     out->description = _("Name of output display file");
 
     levels = G_define_option();

+ 2 - 14
raster3d/r3.mkdspf/r3_find.c

@@ -30,9 +30,6 @@ int g3_find_dsp_file(char *cell, char *file, char *mset)
 /* return NULL on error: otherwise returns dspout */
 char *check_get_any_dspname(char *dspf, char *g3f, char *mset)
 {
-    char element[200], question[200];
-    static char dspout[200];
-
     if (!G_legal_filename(dspf))
 	return (NULL);
 
@@ -41,18 +38,9 @@ char *check_get_any_dspname(char *dspf, char *g3f, char *mset)
 
     if (mset) {			/* otherwise must be reading only  */
 	if (g3_find_dsp_file(g3f, dspf, mset)) {	/* already exists */
-	    sprintf(question, "\n** %s exists. ok to overwrite? ", dspf);
-	    if (!G_yes(question, 0)) {
-		if (NULL == G_ask_any("", dspout, element, "display", 1))
-		    return (NULL);
-
-		return (dspout);
-	    }
-	    /* or else just print a warning & use it as is */
+	    /* the parser should handle the overwrite check */
 	}
     }
 
-    strcpy(dspout, dspf);
-
-    return (dspout);
+    return dspf;
 }

+ 0 - 6
vector/v.transform/Makefile

@@ -5,12 +5,6 @@ PGM=v.transform
 
 include $(MODULE_TOPDIR)/include/Make/Module.make
 
-ifdef MINGW
-EXTRA_LIB=
-else
-EXTRA_LIB=$(VASKLIB) $(CURSES)
-endif
-
 DEPENDENCIES = $(VECTDEP) $(DBMIDEP) $(GISDEP)
 LIBES     = $(VECTLIB) $(DBMILIB) $(TRANSLIB) $(EXTRA_LIB) $(GISLIB)
 EXTRA_INC = $(VECT_INC)

+ 0 - 143
vector/v.transform/ask_trans.c

@@ -1,143 +0,0 @@
-/*
- ****************************************************************************
- *
- * MODULE:       v.transform
- * AUTHOR(S):    See other files as well...
- *               Eric G. Miller <egm2@jps.net>
- * PURPOSE:      To transform a vector layer's coordinates via a set of tie
- *               points.
- * COPYRIGHT:    (C) 2002 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.
- *
- *****************************************************************************/
-/*
- *
- *  ask_transform_coor (n_points) -
- *   Uses Vask to get the sets of coordinates from the user.
- *
- *  shrink_map_coor()  -  condense the arrays used for the transform
- *  library, also turns on the use[] if the coordinate set if valid.
- *
- *  Written by the GRASS Team, 02/16/90, -mh .
- */
-
-#ifndef __MINGW32__
-#include <unistd.h>
-#include <stdio.h>
-#include <grass/gis.h>
-#include <grass/vask.h>
-#include <grass/glocale.h>
-#include "trans.h"
-
-static int shrink_map_coor(void);
-
-int ask_transform_coor(int n_points)
-{
-    int i;
-    int coor_cnt;
-    int at_line;
-    int at_point[MAX_COOR];
-
-    /*  at_point must be an array for Vask  */
-
-    char tmp[82];
-
-
-    /*  number of coordinates we can handle.  this may be the second time
-     *   to this menu and some points may have been registered
-     */
-
-    coor_cnt = MAX_COOR - reg_cnt;
-    V_clear();
-
-    V_line(1, "                               MAP REGISTRATION");
-    V_line(2,
-	   " ------------------------------------------------------------------------");
-    V_line(3,
-	   "|             |        Existing Map          |           New Map         |");
-    V_line(4,
-	   "|   Point #   |   X coord        Y coord     |   X coord        Y coord  |");
-    V_line(5,
-	   " ------------------------------------------------------------------------");
-
-    for (i = 0; i < MAX_COOR; i++) {
-	at_line = i + 7;
-	at_point[i] = i + 1;
-
-	V_const(&at_point[i], 'i', at_line, 6, 6);
-	V_ques(&ax[i], 'd', at_line, 15, 12);
-	V_ques(&ay[i], 'd', at_line, 30, 12);
-	V_ques(&bx[i], 'd', at_line, 45, 12);
-	V_ques(&by[i], 'd', at_line, 60, 12);
-    }
-
-    /*  show min needed and max they can go to  */
-    sprintf(tmp, "    Enter %d to %d points.  Current number of points: %d",
-	    (MIN_COOR > reg_cnt) ? MIN_COOR - reg_cnt : 0, coor_cnt,
-	    n_points);
-    V_line(at_line + 3, tmp);
-
-    V_intrpt_ok();
-
-    /* add message before exit */
-    if (!V_call()) {
-	V_exit();
-	G_message(_("ask_transform_coor():  Leaving session.. \n"));
-	G_sleep(2);
-	return (-1);
-    }
-
-
-    return (shrink_map_coor());
-}
-
-/* 
- *  Condense the arrays and update use[].
- */
-
-
-static int shrink_map_coor(void)
-{
-
-    int i, k;
-
-    for (i = 0, k = 0; i < MAX_COOR; i++) {
-	if (ax[i] == 0.0 || ay[i] == 0.0 || bx[i] == 0.0 || by[i] == 0.0)
-	    continue;
-	use[i] = 1;
-
-	/*  same place count it, but skip it  */
-	if (i == k) {
-	    ++k;
-	    continue;
-	}
-
-	/*  valid point store them  */
-	*(bx + k) = *(bx + i);
-	*(by + k) = *(by + i);
-	*(ax + k) = *(ax + i);
-	*(ay + k) = *(ay + i);
-	*(use + k) = *(use + i);
-	*(residuals + k) = *(residuals + i);
-	++k;
-    }
-
-    /*  now make sure everything else is zero'ed out  */
-    i = (k <= 0) ? 0 : k;
-    for (; i < MAX_COOR; i++) {
-
-	*(bx + i) = 0.0;
-	*(by + i) = 0.0;
-	*(ax + i) = 0.0;
-	*(ay + i) = 0.0;
-	*(use + i) = 0;
-	*(residuals + i) = 0.0;
-    }
-
-    return (k);
-
-}
-#endif /* __MINGW32__ */