~ubuntu-branches/ubuntu/wily/grass/wily

« back to all changes in this revision

Viewing changes to lib/imagery/list_subgp.c

Tags: 7.0.0~rc1+ds1-1~exp1
* New upstream release candidate.
* Repack upstream tarball, remove precompiled Python objects.
* Add upstream metadata.
* Update gbp.conf and Vcs-Git URL to use the experimental branch.
* Update watch file for GRASS 7.0.
* Drop build dependencies for Tcl/Tk, add build dependencies:
  python-numpy, libnetcdf-dev, netcdf-bin, libblas-dev, liblapack-dev
* Update Vcs-Browser URL to use cgit instead of gitweb.
* Update paths to use grass70.
* Add configure options: --with-netcdf, --with-blas, --with-lapack,
  remove --with-tcltk-includes.
* Update patches for GRASS 7.
* Update copyright file, changes:
  - Update copyright years
  - Group files by license
  - Remove unused license sections
* Add patches for various typos.
* Fix desktop file with patch instead of d/rules.
* Use minimal dh rules.
* Bump Standards-Version to 3.9.6, no changes.
* Use dpkg-maintscript-helper to replace directories with symlinks.
  (closes: #776349)
* Update my email to use @debian.org address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*!
2
2
   \file list_subgp.c
3
 
   
 
3
 
4
4
   \brief Imagery Library - List subgroup
5
 
 
6
 
   (C) 2001-2008 by the GRASS Development Team
7
 
   
 
5
 
 
6
   (C) 2001-2008,2013 by the GRASS Development Team
 
7
 
8
8
   This program is free software under the GNU General Public License
9
9
   (>=v2). Read the file COPYING that comes with GRASS for details.
10
 
   
 
10
 
11
11
   \author USA CERL
12
 
*/
 
12
 */
13
13
 
14
14
#include <string.h>
15
15
#include <grass/imagery.h>
16
16
#include <grass/glocale.h>
17
17
 
18
18
/*!
 
19
 * \brief Get list of subgroups which a group contatins.
 
20
 *  
 
21
 * \param group group name
 
22
 * \param[out] subgs_num number of subgroups which the group contains
 
23
 * \return array of subgroup names
 
24
 */
 
25
 
 
26
char **I_list_subgroups(const char *group, int *subgs_num)
 
27
{
 
28
    /* Unlike I_list_subgroup and I_list_subgroup_simple this function 
 
29
       returns array of subgroup names, it does not use fprintf. 
 
30
       This approach should make the function usable in more cases. */
 
31
 
 
32
    char **subgs;
 
33
    char path[GPATH_MAX];
 
34
    char buf[GPATH_MAX];
 
35
    const char *mapset;
 
36
    struct stat sb;
 
37
 
 
38
    *subgs_num = 0;
 
39
 
 
40
    if (I_find_group(group) == 0)
 
41
        return NULL;
 
42
 
 
43
    mapset = G_mapset();
 
44
    sprintf(buf, "group/%s/subgroup", group);
 
45
    G_file_name(path, buf, "", mapset);
 
46
 
 
47
    if (!G_lstat(path, &sb) == 0 || !S_ISDIR(sb.st_mode))
 
48
        return NULL;
 
49
 
 
50
    subgs = G_ls2(path, subgs_num);
 
51
    return subgs;
 
52
}
 
53
 
 
54
/*!
19
55
 * \brief Prints maps in a subgroup (fancy version)
20
56
 *
21
57
 * \param group group name
45
81
            max = len;
46
82
    }
47
83
    fprintf(fd,
48
 
            _("subgroup <%s> of group <%s> references the following raster maps\n"),
 
84
            _
 
85
            ("subgroup <%s> of group <%s> references the following raster maps\n"),
49
86
            subgroup, group);
50
87
    fprintf(fd, "-------------\n");
51
88
    tot_len = 0;