~ubuntu-branches/ubuntu/vivid/grass/vivid-proposed

« back to all changes in this revision

Viewing changes to lib/imagery/ask_group.c

  • Committer: Package Import Robot
  • Author(s): Bas Couwenberg
  • Date: 2015-02-20 23:12:08 UTC
  • mfrom: (8.2.6 experimental)
  • Revision ID: package-import@ubuntu.com-20150220231208-1u6qvqm84v430b10
Tags: 7.0.0-1~exp1
* New upstream release.
* Update python-ctypes-ternary.patch to use if/else instead of and/or.
* Drop check4dev patch, rely on upstream check.
* Add build dependency on libpq-dev to grass-dev for libpq-fe.h.
* Drop patches applied upstream, refresh remaining patches.
* Update symlinks for images switched from jpg to png.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
/*************************************************************
3
 
* I_ask_group_old (prompt,group)
4
 
*
5
 
* prompt the user for an imagery group file name
6
 
*************************************************************/
7
 
#include <string.h>
8
 
#include <grass/gis.h>
9
 
#include <grass/imagery.h>
10
 
static int ask_group(char *, char *);
11
 
 
12
 
 
13
 
/*!
14
 
 * \brief prompt for an existing group
15
 
 *
16
 
 * Asks the user to enter the name of an existing <b>group</b>
17
 
 * in the current mapset.
18
 
 *
19
 
 *  \param prompt
20
 
 *  \param group
21
 
 *  \return int
22
 
 */
23
 
 
24
 
int I_ask_group_old(char *prompt, char *group)
25
 
{
26
 
    while (1) {
27
 
        if (*prompt == 0)
28
 
            prompt = "Select an imagery group file";
29
 
        if (!ask_group(prompt, group))
30
 
            return 0;
31
 
        if (I_find_group(group))
32
 
            return 1;
33
 
        fprintf(stderr, "\n** %s - not found **\n\n", group);
34
 
    }
35
 
}
36
 
 
37
 
static int ask_group(char *prompt, char *group)
38
 
{
39
 
    char buf[1024];
40
 
 
41
 
    while (1) {
42
 
        fprintf(stderr, "\n%s\n", prompt);
43
 
        fprintf(stderr,
44
 
                "Enter 'list' for a list of existing imagery groups\n");
45
 
        fprintf(stderr, "Enter 'list -f' for a verbose listing\n");
46
 
        fprintf(stderr, "Hit RETURN %s\n", G_get_ask_return_msg());
47
 
        fprintf(stderr, "> ");
48
 
        if (!G_gets(buf))
49
 
            continue;
50
 
 
51
 
        G_squeeze(buf);
52
 
        fprintf(stderr, "<%s>\n", buf);
53
 
        if (*buf == 0)
54
 
            return 0;
55
 
 
56
 
        if (strcmp(buf, "list") == 0)
57
 
            I_list_groups(0);
58
 
        else if (strcmp(buf, "list -f") == 0)
59
 
            I_list_groups(1);
60
 
        else if (G_legal_filename(buf) < 0)
61
 
            fprintf(stderr, "\n** <%s> - illegal name **\n\n", buf);
62
 
        else
63
 
            break;
64
 
    }
65
 
    strcpy(group, buf);
66
 
    return 1;
67
 
}